Skip to content
Permalink
Browse files
8264279: Shenandoah: Missing handshake after JDK-8263427
Reviewed-by: shade
  • Loading branch information
zhengyu123 committed Mar 30, 2021
1 parent ac604a1 commit ee5e00b05f5ae8410bc31e15381d068d09c53422
Showing 5 changed files with 21 additions and 9 deletions.
@@ -807,6 +807,12 @@ void ShenandoahConcurrentGC::op_weak_roots() {
ShenandoahConcurrentWeakRootsEvacUpdateTask task(ShenandoahPhaseTimings::conc_weak_roots_work);
heap->workers()->run_task(&task);
}

// Perform handshake to flush out dead oops
{
ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_rendezvous);
heap->rendezvous_threads();
}
}

void ShenandoahConcurrentGC::op_class_unloading() {
@@ -1551,6 +1551,17 @@ class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionCl
bool is_thread_safe() { return true; }
};

class ShenandoahRendezvousClosure : public HandshakeClosure {
public:
inline ShenandoahRendezvousClosure() : HandshakeClosure("ShenandoahRendezvous") {}
inline void do_thread(Thread* thread) {}
};

void ShenandoahHeap::rendezvous_threads() {
ShenandoahRendezvousClosure cl;
Handshake::execute(&cl);
}

void ShenandoahHeap::recycle_trash() {
free_set()->recycle_trash();
}
@@ -126,6 +126,7 @@ class ShenandoahHeap : public CollectedHeap {
friend class ShenandoahConcurrentGC;
friend class ShenandoahDegenGC;
friend class ShenandoahFullGC;
friend class ShenandoahUnload;

// ---------- Locks that guard important data structures in Heap
//
@@ -371,8 +372,8 @@ class ShenandoahHeap : public CollectedHeap {
void update_heap_region_states(bool concurrent);
void rebuild_free_set(bool concurrent);

void rendezvous_threads();
void recycle_trash();

public:
void notify_gc_progress() { _progress_last_gc.set(); }
void notify_gc_no_progress() { _progress_last_gc.unset(); }
@@ -82,6 +82,7 @@ class outputStream;
f(conc_weak_roots, "Concurrent Weak Roots") \
f(conc_weak_roots_work, " Roots") \
SHENANDOAH_PAR_PHASE_DO(conc_weak_roots_work_, " CWR: ", f) \
f(conc_weak_roots_rendezvous, " Rendezvous") \
f(conc_cleanup_early, "Concurrent Cleanup") \
f(conc_class_unload, "Concurrent Class Unloading") \
f(conc_class_unload_unlink, " Unlink Stale") \
@@ -133,12 +133,6 @@ void ShenandoahUnload::prepare() {
DependencyContext::cleaning_start();
}

class ShenandoahRendezvousClosure : public HandshakeClosure {
public:
inline ShenandoahRendezvousClosure() : HandshakeClosure("ShenandoahRendezvous") {}
inline void do_thread(Thread* thread) {}
};

void ShenandoahUnload::unload() {
ShenandoahHeap* heap = ShenandoahHeap::heap();
assert(ClassUnloading, "Filtered by caller");
@@ -172,8 +166,7 @@ void ShenandoahUnload::unload() {
// Make sure stale metadata and nmethods are no longer observable
{
ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_class_unload_rendezvous);
ShenandoahRendezvousClosure cl;
Handshake::execute(&cl);
heap->rendezvous_threads();
}

// Purge stale metadata and nmethods that were unlinked

1 comment on commit ee5e00b

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on ee5e00b Mar 30, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.