Skip to content

Commit

Permalink
8318585: Rename CodeCache::UnloadingScope to UnlinkingScope
Browse files Browse the repository at this point in the history
Reviewed-by: ayang, iwalulya, mli
  • Loading branch information
Thomas Schatzl committed Oct 23, 2023
1 parent ffadd63 commit 4eab39d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/code/codeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
}
Expand Down
11 changes: 7 additions & 4 deletions src/hotspot/share/code/codeCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1FullCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/psParallelCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/serial/genMarkSweep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

3 comments on commit 4eab39d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 4eab39d Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 4eab39d Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch backport-GoeLin-4eab39d9 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 4eab39d9 from the openjdk/jdk repository.

The commit being backported was authored by Thomas Schatzl on 23 Oct 2023 and was reviewed by Albert Mingkun Yang, Ivan Walulya and Hamlin Li.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-4eab39d9:backport-GoeLin-4eab39d9
$ git checkout backport-GoeLin-4eab39d9
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-4eab39d9

Please sign in to comment.