Mercurial > hg > truffle
comparison src/share/vm/compiler/oopMap.cpp @ 20804:7848fc12602b
Merge with jdk8u40-b25
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 14:58:49 +0200 |
parents | 52b4284cb496 6ad19ab94176 |
children | 534f0dde2810 |
comparison
equal
deleted
inserted
replaced
20184:84105dcdb05b | 20804:7848fc12602b |
---|---|
461 ResourceMark rm; | 461 ResourceMark rm; |
462 CodeBlob* cb = fr->cb(); | 462 CodeBlob* cb = fr->cb(); |
463 assert(cb != NULL, "no codeblob"); | 463 assert(cb != NULL, "no codeblob"); |
464 | 464 |
465 // Any reg might be saved by a safepoint handler (see generate_handler_blob). | 465 // Any reg might be saved by a safepoint handler (see generate_handler_blob). |
466 const int max_saved_on_entry_reg_count = ConcreteRegisterImpl::number_of_registers; | |
467 assert( reg_map->_update_for_id == NULL || fr->is_older(reg_map->_update_for_id), | 466 assert( reg_map->_update_for_id == NULL || fr->is_older(reg_map->_update_for_id), |
468 "already updated this map; do not 'update' it twice!" ); | 467 "already updated this map; do not 'update' it twice!" ); |
469 debug_only(reg_map->_update_for_id = fr->id()); | 468 debug_only(reg_map->_update_for_id = fr->id()); |
470 | 469 |
471 // Check if caller must update oop argument | 470 // Check if caller must update oop argument |
472 assert((reg_map->include_argument_oops() || | 471 assert((reg_map->include_argument_oops() || |
473 !cb->caller_must_gc_arguments(reg_map->thread())), | 472 !cb->caller_must_gc_arguments(reg_map->thread())), |
474 "include_argument_oops should already be set"); | 473 "include_argument_oops should already be set"); |
475 | 474 |
476 int nof_callee = 0; | |
477 oop* locs[2*max_saved_on_entry_reg_count+1]; | |
478 VMReg regs[2*max_saved_on_entry_reg_count+1]; | |
479 // ("+1" because max_saved_on_entry_reg_count might be zero) | |
480 | |
481 // Scan through oopmap and find location of all callee-saved registers | 475 // Scan through oopmap and find location of all callee-saved registers |
482 // (we do not do update in place, since info could be overwritten) | 476 // (we do not do update in place, since info could be overwritten) |
483 | 477 |
484 address pc = fr->pc(); | 478 address pc = fr->pc(); |
485 | |
486 OopMap* map = cb->oop_map_for_return_address(pc); | 479 OopMap* map = cb->oop_map_for_return_address(pc); |
487 | 480 assert(map != NULL, "no ptr map found"); |
488 assert(map != NULL, " no ptr map found"); | 481 DEBUG_ONLY(int nof_callee = 0;) |
489 | 482 |
490 OopMapValue omv; | 483 for (OopMapStream oms(map, OopMapValue::callee_saved_value); !oms.is_done(); oms.next()) { |
491 for(OopMapStream oms(map,OopMapValue::callee_saved_value); !oms.is_done(); oms.next()) { | 484 OopMapValue omv = oms.current(); |
492 omv = oms.current(); | 485 VMReg reg = omv.content_reg(); |
493 assert(nof_callee < 2*max_saved_on_entry_reg_count, "overflow"); | 486 oop* loc = fr->oopmapreg_to_location(omv.reg(), reg_map); |
494 regs[nof_callee] = omv.content_reg(); | 487 reg_map->set_location(reg, (address) loc); |
495 locs[nof_callee] = fr->oopmapreg_to_location(omv.reg(),reg_map); | 488 DEBUG_ONLY(nof_callee++;) |
496 nof_callee++; | |
497 } | 489 } |
498 | 490 |
499 // Check that runtime stubs save all callee-saved registers | 491 // Check that runtime stubs save all callee-saved registers |
500 #ifdef COMPILER2 | 492 #ifdef COMPILER2 |
501 assert(cb->is_compiled_by_c1() || cb->is_compiled_by_graal() || !cb->is_runtime_stub() || | 493 assert(cb->is_compiled_by_c1() || cb->is_compiled_by_graal() || !cb->is_runtime_stub() || |
502 (nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT), | 494 (nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT), |
503 "must save all"); | 495 "must save all"); |
504 #endif // COMPILER2 | 496 #endif // COMPILER2 |
505 | |
506 // Copy found callee-saved register to reg_map | |
507 for(int i = 0; i < nof_callee; i++) { | |
508 reg_map->set_location(regs[i], (address)locs[i]); | |
509 } | |
510 } | 497 } |
511 | 498 |
512 //============================================================================= | 499 //============================================================================= |
513 // Non-Product code | 500 // Non-Product code |
514 | 501 |