8215491: ICStubInterface::finalize finds zombie nmethod with ZGC concurrent class unloading
authoreosterlund
Thu, 20 Dec 2018 10:41:45 +0100
changeset 53085 4384060a7ca5
parent 53084 293cec2f7670
child 53086 026842c1809f
8215491: ICStubInterface::finalize finds zombie nmethod with ZGC concurrent class unloading Reviewed-by: dlong, coleenp
src/hotspot/share/code/nmethod.cpp
src/hotspot/share/runtime/sweeper.cpp
--- a/src/hotspot/share/code/nmethod.cpp	Thu Dec 20 10:41:45 2018 +0100
+++ b/src/hotspot/share/code/nmethod.cpp	Thu Dec 20 10:41:45 2018 +0100
@@ -1283,6 +1283,13 @@
       flush_dependencies(/*delete_immediately*/true);
     }
 
+    // Clear ICStubs to prevent back patching stubs of zombie or flushed
+    // nmethods during the next safepoint (see ICStub::finalize).
+    {
+      CompiledICLocker ml(this);
+      clear_ic_stubs();
+    }
+
     // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload
     // event and it hasn't already been reported for this nmethod then
     // report it now. The event may have been reported earlier if the GC
--- a/src/hotspot/share/runtime/sweeper.cpp	Thu Dec 20 10:41:45 2018 +0100
+++ b/src/hotspot/share/runtime/sweeper.cpp	Thu Dec 20 10:41:45 2018 +0100
@@ -717,12 +717,6 @@
     // stack we can safely convert it to a zombie method
     OrderAccess::loadload(); // _stack_traversal_mark and _state
     if (cm->can_convert_to_zombie()) {
-      // Clear ICStubs to prevent back patching stubs of zombie or flushed
-      // nmethods during the next safepoint (see ICStub::finalize).
-      {
-        CompiledICLocker ml(cm);
-        cm->clear_ic_stubs();
-      }
       // Code cache state change is tracked in make_zombie()
       cm->make_zombie();
       SWEEP(cm);