< prev index next >

src/hotspot/share/runtime/vframeArray.cpp

Print this page

473 }
474 
475 int vframeArrayElement::on_stack_size(int callee_parameters,
476                                       int callee_locals,
477                                       bool is_top_frame,
478                                       int popframe_extra_stack_expression_els) const {
479   assert(method()->max_locals() == locals()->size(), "just checking");
480   int locks = monitors() == NULL ? 0 : monitors()->number_of_monitors();
481   int temps = expressions()->size();
482   return Interpreter::size_activation(method()->max_stack(),
483                                       temps + callee_parameters,
484                                       popframe_extra_stack_expression_els,
485                                       locks,
486                                       callee_parameters,
487                                       callee_locals,
488                                       is_top_frame);
489 }
490 
491 
492 intptr_t* vframeArray::unextended_sp() const {

493   return _original.unextended_sp();
494 }
495 
496 vframeArray* vframeArray::allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk,
497                                    RegisterMap *reg_map, frame sender, frame caller, frame self,
498                                    bool realloc_failures) {
499 
500   // Allocate the vframeArray
501   vframeArray * result = (vframeArray*) AllocateHeap(sizeof(vframeArray) + // fixed part
502                                                      sizeof(vframeArrayElement) * (chunk->length() - 1), // variable part
503                                                      mtCompiler);
504   result->_frames = chunk->length();
505   result->_owner_thread = thread;
506   result->_sender = sender;
507   result->_caller = caller;
508   result->_original = self;
509   result->set_unroll_block(NULL); // initialize it
510   result->fill_in(thread, frame_size, chunk, reg_map, realloc_failures);
511   return result;
512 }

520 
521   _frame_size = frame_size;
522   for(int i = 0; i < chunk->length(); i++) {
523     element(i)->fill_in(chunk->at(i), realloc_failures);
524   }
525 
526   // Copy registers for callee-saved registers
527   if (reg_map != NULL) {
528     for(int i = 0; i < RegisterMap::reg_count; i++) {
529 #ifdef AMD64
530       // The register map has one entry for every int (32-bit value), so
531       // 64-bit physical registers have two entries in the map, one for
532       // each half.  Ignore the high halves of 64-bit registers, just like
533       // frame::oopmapreg_to_location does.
534       //
535       // [phh] FIXME: this is a temporary hack!  This code *should* work
536       // correctly w/o this hack, possibly by changing RegisterMap::pd_location
537       // in frame_amd64.cpp and the values of the phantom high half registers
538       // in amd64.ad.
539       //      if (VMReg::Name(i) < SharedInfo::stack0 && is_even(i)) {
540         intptr_t* src = (intptr_t*) reg_map->location(VMRegImpl::as_VMReg(i));
541         _callee_registers[i] = src != NULL ? *src : NULL_WORD;
542         //      } else {
543         //      jint* src = (jint*) reg_map->location(VMReg::Name(i));
544         //      _callee_registers[i] = src != NULL ? *src : NULL_WORD;
545         //      }
546 #else
547       jint* src = (jint*) reg_map->location(VMRegImpl::as_VMReg(i));
548       _callee_registers[i] = src != NULL ? *src : NULL_WORD;
549 #endif
550       if (src == NULL) {
551         set_location_valid(i, false);
552       } else {
553         set_location_valid(i, true);
554         jint* dst = (jint*) register_location(i);
555         *dst = *src;
556       }
557     }
558   }
559 }
560 
561 void vframeArray::unpack_to_stack(frame &unpack_frame, int exec_mode, int caller_actual_parameters) {
562   // stack picture
563   //   unpack_frame
564   //   [new interpreter frames ] (frames are skeletal but walkable)
565   //   caller_frame
566   //
567   //  This routine fills in the missing data for the skeletal interpreter frames

473 }
474 
475 int vframeArrayElement::on_stack_size(int callee_parameters,
476                                       int callee_locals,
477                                       bool is_top_frame,
478                                       int popframe_extra_stack_expression_els) const {
479   assert(method()->max_locals() == locals()->size(), "just checking");
480   int locks = monitors() == NULL ? 0 : monitors()->number_of_monitors();
481   int temps = expressions()->size();
482   return Interpreter::size_activation(method()->max_stack(),
483                                       temps + callee_parameters,
484                                       popframe_extra_stack_expression_els,
485                                       locks,
486                                       callee_parameters,
487                                       callee_locals,
488                                       is_top_frame);
489 }
490 
491 
492 intptr_t* vframeArray::unextended_sp() const {
493   assert(owner_thread()->is_in_usable_stack((address) _original.unextended_sp()), INTPTR_FORMAT, p2i(_original.unextended_sp())); 
494   return _original.unextended_sp();
495 }
496 
497 vframeArray* vframeArray::allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk,
498                                    RegisterMap *reg_map, frame sender, frame caller, frame self,
499                                    bool realloc_failures) {
500 
501   // Allocate the vframeArray
502   vframeArray * result = (vframeArray*) AllocateHeap(sizeof(vframeArray) + // fixed part
503                                                      sizeof(vframeArrayElement) * (chunk->length() - 1), // variable part
504                                                      mtCompiler);
505   result->_frames = chunk->length();
506   result->_owner_thread = thread;
507   result->_sender = sender;
508   result->_caller = caller;
509   result->_original = self;
510   result->set_unroll_block(NULL); // initialize it
511   result->fill_in(thread, frame_size, chunk, reg_map, realloc_failures);
512   return result;
513 }

521 
522   _frame_size = frame_size;
523   for(int i = 0; i < chunk->length(); i++) {
524     element(i)->fill_in(chunk->at(i), realloc_failures);
525   }
526 
527   // Copy registers for callee-saved registers
528   if (reg_map != NULL) {
529     for(int i = 0; i < RegisterMap::reg_count; i++) {
530 #ifdef AMD64
531       // The register map has one entry for every int (32-bit value), so
532       // 64-bit physical registers have two entries in the map, one for
533       // each half.  Ignore the high halves of 64-bit registers, just like
534       // frame::oopmapreg_to_location does.
535       //
536       // [phh] FIXME: this is a temporary hack!  This code *should* work
537       // correctly w/o this hack, possibly by changing RegisterMap::pd_location
538       // in frame_amd64.cpp and the values of the phantom high half registers
539       // in amd64.ad.
540       //      if (VMReg::Name(i) < SharedInfo::stack0 && is_even(i)) {
541         intptr_t* src = (intptr_t*) reg_map->location(VMRegImpl::as_VMReg(i), _caller.sp());
542         _callee_registers[i] = src != NULL ? *src : NULL_WORD;
543         //      } else {
544         //      jint* src = (jint*) reg_map->location(VMReg::Name(i));
545         //      _callee_registers[i] = src != NULL ? *src : NULL_WORD;
546         //      }
547 #else
548       jint* src = (jint*) reg_map->location(VMRegImpl::as_VMReg(i), _caller.sp());
549       _callee_registers[i] = src != NULL ? *src : NULL_WORD;
550 #endif
551       if (src == NULL) {
552         set_location_valid(i, false);
553       } else {
554         set_location_valid(i, true);
555         jint* dst = (jint*) register_location(i);
556         *dst = *src;
557       }
558     }
559   }
560 }
561 
562 void vframeArray::unpack_to_stack(frame &unpack_frame, int exec_mode, int caller_actual_parameters) {
563   // stack picture
564   //   unpack_frame
565   //   [new interpreter frames ] (frames are skeletal but walkable)
566   //   caller_frame
567   //
568   //  This routine fills in the missing data for the skeletal interpreter frames
< prev index next >