455 assert(map != NULL, "map must be set"); 456 457 // frame owned by optimizing compiler 458 assert(_cb->frame_size() >= 0, "must have non-zero frame size"); 459 intptr_t* sender_sp = unextended_sp() + _cb->frame_size(); 460 461 // On Intel the return_address is always the word on the stack 462 address sender_pc = (address) *(sender_sp-1); 463 464 // This is the saved value of EBP which may or may not really be an FP. 465 // It is only an FP if the sender is an interpreter frame (or C1?). 466 intptr_t** saved_fp_addr = (intptr_t**) (sender_sp - frame::sender_sp_offset); 467 468 // Repair the sender sp if this is a method with scalarized value type args 469 sender_sp = repair_sender_sp(sender_sp, saved_fp_addr); 470 471 if (map->update_map()) { 472 // Tell GC to use argument oopmaps for some runtime stubs that need it. 473 // For C1, the runtime stub might not have oop maps, so set this flag 474 // outside of update_register_map. 475 map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread())); 476 if (_cb->oop_maps() != NULL) { 477 OopMapSet::update_register_map(this, map); 478 } 479 480 // Since the prolog does the save and restore of EBP there is no oopmap 481 // for it so we must fill in its location as if there was an oopmap entry 482 // since if our caller was compiled code there could be live jvm state in it. 483 update_map_with_saved_link(map, saved_fp_addr); 484 } 485 486 assert(sender_sp != sp(), "must have changed"); 487 return frame(sender_sp, sender_sp, *saved_fp_addr, sender_pc); 488 } 489 490 491 //------------------------------------------------------------------------------ 492 // frame::sender 493 frame frame::sender(RegisterMap* map) const { 494 // Default is we done have to follow them. The sender_for_xxx will 495 // update it accordingly 496 map->set_include_argument_oops(false); 497 498 if (is_entry_frame()) return sender_for_entry_frame(map); 499 if (is_interpreted_frame()) return sender_for_interpreter_frame(map); 500 assert(_cb == CodeCache::find_blob(pc()),"Must be the same"); 501 502 if (_cb != NULL) { 503 return sender_for_compiled_frame(map); 504 } 505 // Must be native-compiled frame, i.e. the marshaling code for native 506 // methods that exists in the core system. 507 return frame(sender_sp(), link(), sender_pc()); 508 } 509 510 bool frame::is_interpreted_frame_valid(JavaThread* thread) const { 511 assert(is_interpreted_frame(), "Not an interpreted frame"); 512 // These are reasonable sanity checks 513 if (fp() == 0 || (intptr_t(fp()) & (wordSize-1)) != 0) { 514 return false; | 455 assert(map != NULL, "map must be set"); 456 457 // frame owned by optimizing compiler 458 assert(_cb->frame_size() >= 0, "must have non-zero frame size"); 459 intptr_t* sender_sp = unextended_sp() + _cb->frame_size(); 460 461 // On Intel the return_address is always the word on the stack 462 address sender_pc = (address) *(sender_sp-1); 463 464 // This is the saved value of EBP which may or may not really be an FP. 465 // It is only an FP if the sender is an interpreter frame (or C1?). 466 intptr_t** saved_fp_addr = (intptr_t**) (sender_sp - frame::sender_sp_offset); 467 468 // Repair the sender sp if this is a method with scalarized value type args 469 sender_sp = repair_sender_sp(sender_sp, saved_fp_addr); 470 471 if (map->update_map()) { 472 // Tell GC to use argument oopmaps for some runtime stubs that need it. 473 // For C1, the runtime stub might not have oop maps, so set this flag 474 // outside of update_register_map. 475 bool caller_args = _cb->caller_must_gc_arguments(map->thread()); 476 if (!caller_args) { 477 nmethod* nm = _cb->as_nmethod_or_null(); 478 if (nm != NULL && nm->is_compiled_by_c1() && pc() < nm->verified_value_entry_point()) { 479 // The VEP and VVEP(RO) of C1-compiled methods call buffer_value_args_xxx 480 // before doing any argument shuffling, so we need to scan the oops 481 // as the caller passes them. 482 NativeCall* call = nativeCall_before(pc()); 483 address dest = call->destination(); 484 if (dest == Runtime1::entry_for(Runtime1::buffer_value_args_no_receiver_id) || 485 dest == Runtime1::entry_for(Runtime1::buffer_value_args_id)) { 486 caller_args = true; 487 } 488 } 489 } 490 map->set_include_argument_oops(caller_args); 491 if (_cb->oop_maps() != NULL) { 492 OopMapSet::update_register_map(this, map); 493 } 494 495 // Since the prolog does the save and restore of EBP there is no oopmap 496 // for it so we must fill in its location as if there was an oopmap entry 497 // since if our caller was compiled code there could be live jvm state in it. 498 update_map_with_saved_link(map, saved_fp_addr); 499 } 500 501 assert(sender_sp != sp(), "must have changed"); 502 return frame(sender_sp, sender_sp, *saved_fp_addr, sender_pc); 503 } 504 505 506 //------------------------------------------------------------------------------ 507 // frame::sender 508 frame frame::sender(RegisterMap* map) const { 509 // Default is we don't have to follow them. The sender_for_xxx will 510 // update it accordingly 511 map->set_include_argument_oops(false); 512 513 if (is_entry_frame()) return sender_for_entry_frame(map); 514 if (is_interpreted_frame()) return sender_for_interpreter_frame(map); 515 assert(_cb == CodeCache::find_blob(pc()),"Must be the same"); 516 517 if (_cb != NULL) { 518 return sender_for_compiled_frame(map); 519 } 520 // Must be native-compiled frame, i.e. the marshaling code for native 521 // methods that exists in the core system. 522 return frame(sender_sp(), link(), sender_pc()); 523 } 524 525 bool frame::is_interpreted_frame_valid(JavaThread* thread) const { 526 assert(is_interpreted_frame(), "Not an interpreted frame"); 527 // These are reasonable sanity checks 528 if (fp() == 0 || (intptr_t(fp()) & (wordSize-1)) != 0) { 529 return false; |