From 83adde986667a2fbfb620bf90f6e27607f660e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Thu, 20 Dec 2018 10:41:45 +0100 Subject: [PATCH] 8215491: ICStubInterface::finalize finds zombie nmethod with ZGC concurrent class unloading Reviewed-by: dlong, coleenp --- src/hotspot/share/code/nmethod.cpp | 7 +++++++ src/hotspot/share/runtime/sweeper.cpp | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index bbd416bf828..02c9247bf2a 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1283,6 +1283,13 @@ bool nmethod::make_not_entrant_or_zombie(int state) { 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 diff --git a/src/hotspot/share/runtime/sweeper.cpp b/src/hotspot/share/runtime/sweeper.cpp index 88a94f32dfb..c5e5a7fdfc1 100644 --- a/src/hotspot/share/runtime/sweeper.cpp +++ b/src/hotspot/share/runtime/sweeper.cpp @@ -717,12 +717,6 @@ NMethodSweeper::MethodStateChange NMethodSweeper::process_compiled_method(Compil // 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);