465 ResourceMark rm; |
465 ResourceMark rm; |
466 CodeBlob* cb = fr->cb(); |
466 CodeBlob* cb = fr->cb(); |
467 assert(cb != NULL, "no codeblob"); |
467 assert(cb != NULL, "no codeblob"); |
468 |
468 |
469 // Any reg might be saved by a safepoint handler (see generate_handler_blob). |
469 // Any reg might be saved by a safepoint handler (see generate_handler_blob). |
470 const int max_saved_on_entry_reg_count = ConcreteRegisterImpl::number_of_registers; |
|
471 assert( reg_map->_update_for_id == NULL || fr->is_older(reg_map->_update_for_id), |
470 assert( reg_map->_update_for_id == NULL || fr->is_older(reg_map->_update_for_id), |
472 "already updated this map; do not 'update' it twice!" ); |
471 "already updated this map; do not 'update' it twice!" ); |
473 debug_only(reg_map->_update_for_id = fr->id()); |
472 debug_only(reg_map->_update_for_id = fr->id()); |
474 |
473 |
475 // Check if caller must update oop argument |
474 // Check if caller must update oop argument |
476 assert((reg_map->include_argument_oops() || |
475 assert((reg_map->include_argument_oops() || |
477 !cb->caller_must_gc_arguments(reg_map->thread())), |
476 !cb->caller_must_gc_arguments(reg_map->thread())), |
478 "include_argument_oops should already be set"); |
477 "include_argument_oops should already be set"); |
479 |
478 |
480 int nof_callee = 0; |
|
481 oop* locs[2*max_saved_on_entry_reg_count+1]; |
|
482 VMReg regs[2*max_saved_on_entry_reg_count+1]; |
|
483 // ("+1" because max_saved_on_entry_reg_count might be zero) |
|
484 |
|
485 // Scan through oopmap and find location of all callee-saved registers |
479 // Scan through oopmap and find location of all callee-saved registers |
486 // (we do not do update in place, since info could be overwritten) |
480 // (we do not do update in place, since info could be overwritten) |
487 |
481 |
488 address pc = fr->pc(); |
482 address pc = fr->pc(); |
489 |
|
490 OopMap* map = cb->oop_map_for_return_address(pc); |
483 OopMap* map = cb->oop_map_for_return_address(pc); |
491 |
484 assert(map != NULL, "no ptr map found"); |
492 assert(map != NULL, " no ptr map found"); |
485 DEBUG_ONLY(int nof_callee = 0;) |
493 |
486 |
494 OopMapValue omv; |
487 for (OopMapStream oms(map, OopMapValue::callee_saved_value); !oms.is_done(); oms.next()) { |
495 for(OopMapStream oms(map,OopMapValue::callee_saved_value); !oms.is_done(); oms.next()) { |
488 OopMapValue omv = oms.current(); |
496 omv = oms.current(); |
489 VMReg reg = omv.content_reg(); |
497 assert(nof_callee < 2*max_saved_on_entry_reg_count, "overflow"); |
490 oop* loc = fr->oopmapreg_to_location(omv.reg(), reg_map); |
498 regs[nof_callee] = omv.content_reg(); |
491 reg_map->set_location(reg, (address) loc); |
499 locs[nof_callee] = fr->oopmapreg_to_location(omv.reg(),reg_map); |
492 DEBUG_ONLY(nof_callee++;) |
500 nof_callee++; |
|
501 } |
493 } |
502 |
494 |
503 // Check that runtime stubs save all callee-saved registers |
495 // Check that runtime stubs save all callee-saved registers |
504 #ifdef COMPILER2 |
496 #ifdef COMPILER2 |
505 assert(cb->is_compiled_by_c1() || !cb->is_runtime_stub() || |
497 assert(cb->is_compiled_by_c1() || !cb->is_runtime_stub() || |
506 (nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT), |
498 (nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT), |
507 "must save all"); |
499 "must save all"); |
508 #endif // COMPILER2 |
500 #endif // COMPILER2 |
509 |
|
510 // Copy found callee-saved register to reg_map |
|
511 for(int i = 0; i < nof_callee; i++) { |
|
512 reg_map->set_location(regs[i], (address)locs[i]); |
|
513 } |
|
514 } |
501 } |
515 |
502 |
516 //============================================================================= |
503 //============================================================================= |
517 // Non-Product code |
504 // Non-Product code |
518 |
505 |