< prev index next >

src/hotspot/share/oops/method.cpp

Print this page
rev 54838 : [mq]: 8221734-v2
rev 54839 : [mq]: 8221734-v3


 798   CompiledMethod* nm = code(); // Put it into local variable to guard against concurrent updates
 799   if (nm != NULL) {
 800     nm->make_not_entrant();
 801   }
 802 }
 803 
 804 
 805 bool Method::has_native_function() const {
 806   if (is_method_handle_intrinsic())
 807     return false;  // special-cased in SharedRuntime::generate_native_wrapper
 808   address func = native_function();
 809   return (func != NULL && func != SharedRuntime::native_method_throw_unsatisfied_link_error_entry());
 810 }
 811 
 812 
 813 void Method::clear_native_function() {
 814   // Note: is_method_handle_intrinsic() is allowed here.
 815   set_native_function(
 816     SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
 817     !native_bind_event_is_interesting);
 818   Method::unlink_code(this);
 819 }
 820 
 821 address Method::critical_native_function() {
 822   methodHandle mh(this);
 823   return NativeLookup::lookup_critical_entry(mh);
 824 }
 825 
 826 
 827 void Method::set_signature_handler(address handler) {
 828   address* signature_handler =  signature_handler_addr();
 829   *signature_handler = handler;
 830 }
 831 
 832 
 833 void Method::print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason) {
 834   if (PrintCompilation && report) {
 835     ttyLocker ttyl;
 836     tty->print("made not %scompilable on ", is_osr ? "OSR " : "");
 837     if (comp_level == CompLevel_all) {
 838       tty->print("all levels ");


 935   }
 936   CompilationPolicy::policy()->disable_compilation(this);
 937   assert(!CompilationPolicy::can_be_osr_compiled(this, comp_level), "sanity check");
 938 }
 939 
 940 // Revert to using the interpreter and clear out the nmethod
 941 void Method::clear_code() {
 942   // this may be NULL if c2i adapters have not been made yet
 943   // Only should happen at allocate time.
 944   if (adapter() == NULL) {
 945     _from_compiled_entry    = NULL;
 946   } else {
 947     _from_compiled_entry    = adapter()->get_c2i_entry();
 948   }
 949   OrderAccess::storestore();
 950   _from_interpreted_entry = _i2i_entry;
 951   OrderAccess::storestore();
 952   _code = NULL;
 953 }
 954 
 955 void Method::unlink_code(Method *method, CompiledMethod *compare) {
 956   if (method == NULL) {
 957     return;
 958   }
 959   MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 960   if (method->code() == compare ||
 961       method->from_compiled_entry() == compare->verified_entry_point()) {
 962     method->clear_code();






 963   }
 964 }
 965 
 966 void Method::unlink_code(Method *method) {
 967   if (method != NULL) {
 968     MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 969     method->clear_code();
 970   }
 971 }
 972 
 973 #if INCLUDE_CDS
 974 // Called by class data sharing to remove any entry points (which are not shared)
 975 void Method::unlink_method() {
 976   _code = NULL;
 977 
 978   assert(DumpSharedSpaces, "dump time only");
 979   // Set the values to what they should be at run time. Note that
 980   // this Method can no longer be executed during dump time.
 981   _i2i_entry = Interpreter::entry_for_cds_method(this);
 982   _from_interpreted_entry = _i2i_entry;
 983 
 984   if (is_native()) {
 985     *native_function_addr() = NULL;
 986     set_signature_handler(NULL);
 987   }
 988   NOT_PRODUCT(set_compiled_invocation_count(0);)
 989 
 990   CDSAdapterHandlerEntry* cds_adapter = (CDSAdapterHandlerEntry*)adapter();




 798   CompiledMethod* nm = code(); // Put it into local variable to guard against concurrent updates
 799   if (nm != NULL) {
 800     nm->make_not_entrant();
 801   }
 802 }
 803 
 804 
 805 bool Method::has_native_function() const {
 806   if (is_method_handle_intrinsic())
 807     return false;  // special-cased in SharedRuntime::generate_native_wrapper
 808   address func = native_function();
 809   return (func != NULL && func != SharedRuntime::native_method_throw_unsatisfied_link_error_entry());
 810 }
 811 
 812 
 813 void Method::clear_native_function() {
 814   // Note: is_method_handle_intrinsic() is allowed here.
 815   set_native_function(
 816     SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
 817     !native_bind_event_is_interesting);
 818   this->unlink_code();
 819 }
 820 
 821 address Method::critical_native_function() {
 822   methodHandle mh(this);
 823   return NativeLookup::lookup_critical_entry(mh);
 824 }
 825 
 826 
 827 void Method::set_signature_handler(address handler) {
 828   address* signature_handler =  signature_handler_addr();
 829   *signature_handler = handler;
 830 }
 831 
 832 
 833 void Method::print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason) {
 834   if (PrintCompilation && report) {
 835     ttyLocker ttyl;
 836     tty->print("made not %scompilable on ", is_osr ? "OSR " : "");
 837     if (comp_level == CompLevel_all) {
 838       tty->print("all levels ");


 935   }
 936   CompilationPolicy::policy()->disable_compilation(this);
 937   assert(!CompilationPolicy::can_be_osr_compiled(this, comp_level), "sanity check");
 938 }
 939 
 940 // Revert to using the interpreter and clear out the nmethod
 941 void Method::clear_code() {
 942   // this may be NULL if c2i adapters have not been made yet
 943   // Only should happen at allocate time.
 944   if (adapter() == NULL) {
 945     _from_compiled_entry    = NULL;
 946   } else {
 947     _from_compiled_entry    = adapter()->get_c2i_entry();
 948   }
 949   OrderAccess::storestore();
 950   _from_interpreted_entry = _i2i_entry;
 951   OrderAccess::storestore();
 952   _code = NULL;
 953 }
 954 
 955 void Method::unlink_code(CompiledMethod *compare) {



 956   MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 957   // We need to check if both the _code and _from_compiled_code_entry_point
 958   // refer to this nmethod because there is a race in setting these two fields
 959   // in Method* as seen in bugid 4947125.
 960   // If the vep() points to the zombie nmethod, the memory for the nmethod
 961   // could be flushed and the compiler and vtable stubs could still call
 962   // through it.
 963   if (code() == compare ||
 964       from_compiled_entry() == compare->verified_entry_point()) {
 965     clear_code();
 966   }
 967 }
 968 
 969 void Method::unlink_code() {

 970   MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 971   clear_code();

 972 }
 973 
 974 #if INCLUDE_CDS
 975 // Called by class data sharing to remove any entry points (which are not shared)
 976 void Method::unlink_method() {
 977   _code = NULL;
 978 
 979   assert(DumpSharedSpaces, "dump time only");
 980   // Set the values to what they should be at run time. Note that
 981   // this Method can no longer be executed during dump time.
 982   _i2i_entry = Interpreter::entry_for_cds_method(this);
 983   _from_interpreted_entry = _i2i_entry;
 984 
 985   if (is_native()) {
 986     *native_function_addr() = NULL;
 987     set_signature_handler(NULL);
 988   }
 989   NOT_PRODUCT(set_compiled_invocation_count(0);)
 990 
 991   CDSAdapterHandlerEntry* cds_adapter = (CDSAdapterHandlerEntry*)adapter();


< prev index next >