703 // This function is called after potential safepoints so that nmethod |
703 // This function is called after potential safepoints so that nmethod |
704 // or adapter that it points to is still live and valid. |
704 // or adapter that it points to is still live and valid. |
705 // This function must not hit a safepoint! |
705 // This function must not hit a safepoint! |
706 address methodOopDesc::verified_code_entry() { |
706 address methodOopDesc::verified_code_entry() { |
707 debug_only(No_Safepoint_Verifier nsv;) |
707 debug_only(No_Safepoint_Verifier nsv;) |
|
708 nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code); |
|
709 if (code == NULL && UseCodeCacheFlushing) { |
|
710 nmethod *saved_code = CodeCache::find_and_remove_saved_code(this); |
|
711 if (saved_code != NULL) { |
|
712 methodHandle method(this); |
|
713 assert( ! saved_code->is_osr_method(), "should not get here for osr" ); |
|
714 set_code( method, saved_code ); |
|
715 } |
|
716 } |
|
717 |
708 assert(_from_compiled_entry != NULL, "must be set"); |
718 assert(_from_compiled_entry != NULL, "must be set"); |
709 return _from_compiled_entry; |
719 return _from_compiled_entry; |
710 } |
720 } |
711 |
721 |
712 // Check that if an nmethod ref exists, it has a backlink to this or no backlink at all |
722 // Check that if an nmethod ref exists, it has a backlink to this or no backlink at all |
731 mh->_code = code; // Assign before allowing compiled code to exec |
741 mh->_code = code; // Assign before allowing compiled code to exec |
732 |
742 |
733 int comp_level = code->comp_level(); |
743 int comp_level = code->comp_level(); |
734 // In theory there could be a race here. In practice it is unlikely |
744 // In theory there could be a race here. In practice it is unlikely |
735 // and not worth worrying about. |
745 // and not worth worrying about. |
736 if (comp_level > highest_tier_compile()) { |
746 if (comp_level > mh->highest_tier_compile()) { |
737 set_highest_tier_compile(comp_level); |
747 mh->set_highest_tier_compile(comp_level); |
738 } |
748 } |
739 |
749 |
740 OrderAccess::storestore(); |
750 OrderAccess::storestore(); |
741 mh->_from_compiled_entry = code->verified_entry_point(); |
751 mh->_from_compiled_entry = code->verified_entry_point(); |
742 OrderAccess::storestore(); |
752 OrderAccess::storestore(); |