< prev index next >

src/hotspot/share/runtime/vframeArray.cpp

Print this page

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

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

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

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

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