equal
deleted
inserted
replaced
1051 |
1051 |
1052 // This nmethod is being unloaded, make sure that dependencies |
1052 // This nmethod is being unloaded, make sure that dependencies |
1053 // recorded in instanceKlasses get flushed. |
1053 // recorded in instanceKlasses get flushed. |
1054 // Since this work is being done during a GC, defer deleting dependencies from the |
1054 // Since this work is being done during a GC, defer deleting dependencies from the |
1055 // InstanceKlass. |
1055 // InstanceKlass. |
1056 assert(Universe::heap()->is_gc_active(), "should only be called during gc"); |
1056 assert(Universe::heap()->is_gc_active() || Thread::current()->is_ConcurrentGC_thread(), |
|
1057 "should only be called during gc"); |
1057 flush_dependencies(/*delete_immediately*/false); |
1058 flush_dependencies(/*delete_immediately*/false); |
1058 |
1059 |
1059 // Break cycle between nmethod & method |
1060 // Break cycle between nmethod & method |
1060 LogTarget(Trace, class, unload, nmethod) lt; |
1061 LogTarget(Trace, class, unload, nmethod) lt; |
1061 if (lt.is_enabled()) { |
1062 if (lt.is_enabled()) { |
1093 } |
1094 } |
1094 _method = NULL; // Clear the method of this dead nmethod |
1095 _method = NULL; // Clear the method of this dead nmethod |
1095 } |
1096 } |
1096 |
1097 |
1097 // Make the class unloaded - i.e., change state and notify sweeper |
1098 // Make the class unloaded - i.e., change state and notify sweeper |
1098 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
1099 assert(SafepointSynchronize::is_at_safepoint() || Thread::current()->is_ConcurrentGC_thread(), |
|
1100 "must be at safepoint"); |
1099 |
1101 |
1100 // Unregister must be done before the state change |
1102 // Unregister must be done before the state change |
1101 Universe::heap()->unregister_nmethod(this); |
1103 Universe::heap()->unregister_nmethod(this); |
1102 |
1104 |
1103 // Log the unloading. |
1105 // Log the unloading. |
2921 _speculation_log = NULL; |
2923 _speculation_log = NULL; |
2922 } |
2924 } |
2923 } |
2925 } |
2924 |
2926 |
2925 void nmethod::maybe_invalidate_installed_code() { |
2927 void nmethod::maybe_invalidate_installed_code() { |
|
2928 if (!is_compiled_by_jvmci()) { |
|
2929 return; |
|
2930 } |
|
2931 |
2926 assert(Patching_lock->is_locked() || |
2932 assert(Patching_lock->is_locked() || |
2927 SafepointSynchronize::is_at_safepoint(), "should be performed under a lock for consistency"); |
2933 SafepointSynchronize::is_at_safepoint(), "should be performed under a lock for consistency"); |
2928 oop installed_code = JNIHandles::resolve(_jvmci_installed_code); |
2934 oop installed_code = JNIHandles::resolve(_jvmci_installed_code); |
2929 if (installed_code != NULL) { |
2935 if (installed_code != NULL) { |
2930 // Update the values in the InstalledCode instance if it still refers to this nmethod |
2936 // Update the values in the InstalledCode instance if it still refers to this nmethod |