diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index 85ab194eba4..99539ed80cc 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -1016,7 +1016,7 @@ void CodeCache::increment_unloading_cycle() { } } -CodeCache::UnloadingScope::UnloadingScope(BoolObjectClosure* is_alive) +CodeCache::UnlinkingScope::UnlinkingScope(BoolObjectClosure* is_alive) : _is_unloading_behaviour(is_alive) { _saved_behaviour = IsUnloadingBehaviour::current(); @@ -1025,7 +1025,7 @@ CodeCache::UnloadingScope::UnloadingScope(BoolObjectClosure* is_alive) DependencyContext::cleaning_start(); } -CodeCache::UnloadingScope::~UnloadingScope() { +CodeCache::UnlinkingScope::~UnlinkingScope() { IsUnloadingBehaviour::set_current(_saved_behaviour); DependencyContext::cleaning_end(); } diff --git a/src/hotspot/share/code/codeCache.hpp b/src/hotspot/share/code/codeCache.hpp index 0300179942f..1b65fb3596e 100644 --- a/src/hotspot/share/code/codeCache.hpp +++ b/src/hotspot/share/code/codeCache.hpp @@ -177,14 +177,17 @@ class CodeCache : AllStatic { // GC support static void verify_oops(); - // Scope object managing code cache unloading behavior. - class UnloadingScope: StackObj { + + // Helper scope object managing code cache unlinking behavior, i.e. sets and + // restores the closure that determines which nmethods are going to be removed + // during the unlinking part of code cache unloading. + class UnlinkingScope : StackObj { ClosureIsUnloadingBehaviour _is_unloading_behaviour; IsUnloadingBehaviour* _saved_behaviour; public: - UnloadingScope(BoolObjectClosure* is_alive); - ~UnloadingScope(); + UnlinkingScope(BoolObjectClosure* is_alive); + ~UnlinkingScope(); }; // Code cache unloading heuristics diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index da0e058cc32..f46ac31ceeb 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -1695,7 +1695,7 @@ void G1ConcurrentMark::weak_refs_work() { if (ClassUnloadingWithConcurrentMark) { GCTraceTime(Debug, gc, phases) debug("Class Unloading", _gc_timer_cm); { - CodeCache::UnloadingScope scope(&g1_is_alive); + CodeCache::UnlinkingScope scope(&g1_is_alive); bool unloading_occurred = SystemDictionary::do_unloading(_gc_timer_cm); _g1h->complete_cleaning(unloading_occurred); } diff --git a/src/hotspot/share/gc/g1/g1FullCollector.cpp b/src/hotspot/share/gc/g1/g1FullCollector.cpp index f225937a49f..039f13019ab 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.cpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.cpp @@ -320,7 +320,7 @@ void G1FullCollector::phase1_mark_live_objects() { if (ClassUnloading) { GCTraceTime(Debug, gc, phases) debug("Phase 1: Class Unloading and Cleanup", scope()->timer()); { - CodeCache::UnloadingScope unloading_scope(&_is_alive); + CodeCache::UnlinkingScope unloading_scope(&_is_alive); // Unload classes and purge the SystemDictionary. bool unloading_occurred = SystemDictionary::do_unloading(scope()->timer()); _heap->complete_cleaning(unloading_occurred); diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 637a7d3955c..b8ee8ef6163 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -2055,7 +2055,7 @@ void PSParallelCompact::marking_phase(ParallelOldTracer *gc_tracer) { bool unloading_occurred; { - CodeCache::UnloadingScope scope(is_alive_closure()); + CodeCache::UnlinkingScope scope(is_alive_closure()); // Follow system dictionary roots and unload classes. unloading_occurred = SystemDictionary::do_unloading(&_gc_timer); diff --git a/src/hotspot/share/gc/serial/genMarkSweep.cpp b/src/hotspot/share/gc/serial/genMarkSweep.cpp index 3228493b848..6eb3da6892d 100644 --- a/src/hotspot/share/gc/serial/genMarkSweep.cpp +++ b/src/hotspot/share/gc/serial/genMarkSweep.cpp @@ -202,7 +202,7 @@ void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { bool unloading_occurred; { - CodeCache::UnloadingScope scope(&is_alive); + CodeCache::UnlinkingScope scope(&is_alive); // Unload classes and purge the SystemDictionary. unloading_occurred = SystemDictionary::do_unloading(gc_timer()); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 3e266cd9b4d..b6d77d1147e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1812,7 +1812,7 @@ void ShenandoahHeap::stw_unload_classes(bool full_gc) { ShenandoahPhaseTimings::degen_gc_purge_class_unload; ShenandoahIsAliveSelector is_alive; { - CodeCache::UnloadingScope scope(is_alive.is_alive_closure()); + CodeCache::UnlinkingScope scope(is_alive.is_alive_closure()); ShenandoahGCPhase gc_phase(phase); ShenandoahGCWorkerPhase worker_phase(phase); bool unloading_occurred = SystemDictionary::do_unloading(gc_timer());