734 // Install compiled code. Instantly it can execute. 735 void methodOopDesc::set_code(methodHandle mh, nmethod *code) { 736 assert( code, "use clear_code to remove code" ); 737 assert( mh->check_code(), "" ); 738 739 guarantee(mh->adapter() != NULL, "Adapter blob must already exist!"); 740 741 // These writes must happen in this order, because the interpreter will 742 // directly jump to from_interpreted_entry which jumps to an i2c adapter 743 // which jumps to _from_compiled_entry. 744 mh->_code = code; // Assign before allowing compiled code to exec 745 746 int comp_level = code->comp_level(); 747 // In theory there could be a race here. In practice it is unlikely 748 // and not worth worrying about. 749 if (comp_level > mh->highest_tier_compile()) { 750 mh->set_highest_tier_compile(comp_level); 751 } 752 753 OrderAccess::storestore(); 754 mh->_from_compiled_entry = code->verified_entry_point(); 755 OrderAccess::storestore(); 756 // Instantly compiled code can execute. 757 mh->_from_interpreted_entry = mh->get_i2c_entry(); 758 759 } 760 761 762 bool methodOopDesc::is_overridden_in(klassOop k) const { 763 instanceKlass* ik = instanceKlass::cast(k); 764 765 if (ik->is_interface()) return false; 766 767 // If method is an interface, we skip it - except if it 768 // is a miranda method 769 if (instanceKlass::cast(method_holder())->is_interface()) { 770 // Check that method is not a miranda method 771 if (ik->lookup_method(name(), signature()) == NULL) { 772 // No implementation exist - so miranda method 773 return false; 774 } 775 return true; 776 } 777 | 734 // Install compiled code. Instantly it can execute. 735 void methodOopDesc::set_code(methodHandle mh, nmethod *code) { 736 assert( code, "use clear_code to remove code" ); 737 assert( mh->check_code(), "" ); 738 739 guarantee(mh->adapter() != NULL, "Adapter blob must already exist!"); 740 741 // These writes must happen in this order, because the interpreter will 742 // directly jump to from_interpreted_entry which jumps to an i2c adapter 743 // which jumps to _from_compiled_entry. 744 mh->_code = code; // Assign before allowing compiled code to exec 745 746 int comp_level = code->comp_level(); 747 // In theory there could be a race here. In practice it is unlikely 748 // and not worth worrying about. 749 if (comp_level > mh->highest_tier_compile()) { 750 mh->set_highest_tier_compile(comp_level); 751 } 752 753 OrderAccess::storestore(); 754 #ifdef SHARK 755 mh->_from_interpreted_entry = code->instructions_begin(); 756 #else 757 mh->_from_compiled_entry = code->verified_entry_point(); 758 OrderAccess::storestore(); 759 // Instantly compiled code can execute. 760 mh->_from_interpreted_entry = mh->get_i2c_entry(); 761 #endif // SHARK 762 763 } 764 765 766 bool methodOopDesc::is_overridden_in(klassOop k) const { 767 instanceKlass* ik = instanceKlass::cast(k); 768 769 if (ik->is_interface()) return false; 770 771 // If method is an interface, we skip it - except if it 772 // is a miranda method 773 if (instanceKlass::cast(method_holder())->is_interface()) { 774 // Check that method is not a miranda method 775 if (ik->lookup_method(name(), signature()) == NULL) { 776 // No implementation exist - so miranda method 777 return false; 778 } 779 return true; 780 } 781 |