Skip to content

Commit ee5e00b

Browse files
committed
8264279: Shenandoah: Missing handshake after JDK-8263427
Reviewed-by: shade
1 parent ac604a1 commit ee5e00b

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,12 @@ void ShenandoahConcurrentGC::op_weak_roots() {
807807
ShenandoahConcurrentWeakRootsEvacUpdateTask task(ShenandoahPhaseTimings::conc_weak_roots_work);
808808
heap->workers()->run_task(&task);
809809
}
810+
811+
// Perform handshake to flush out dead oops
812+
{
813+
ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_rendezvous);
814+
heap->rendezvous_threads();
815+
}
810816
}
811817

812818
void ShenandoahConcurrentGC::op_class_unloading() {

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,17 @@ class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionCl
15511551
bool is_thread_safe() { return true; }
15521552
};
15531553

1554+
class ShenandoahRendezvousClosure : public HandshakeClosure {
1555+
public:
1556+
inline ShenandoahRendezvousClosure() : HandshakeClosure("ShenandoahRendezvous") {}
1557+
inline void do_thread(Thread* thread) {}
1558+
};
1559+
1560+
void ShenandoahHeap::rendezvous_threads() {
1561+
ShenandoahRendezvousClosure cl;
1562+
Handshake::execute(&cl);
1563+
}
1564+
15541565
void ShenandoahHeap::recycle_trash() {
15551566
free_set()->recycle_trash();
15561567
}

src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class ShenandoahHeap : public CollectedHeap {
126126
friend class ShenandoahConcurrentGC;
127127
friend class ShenandoahDegenGC;
128128
friend class ShenandoahFullGC;
129+
friend class ShenandoahUnload;
129130

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

375+
void rendezvous_threads();
374376
void recycle_trash();
375-
376377
public:
377378
void notify_gc_progress() { _progress_last_gc.set(); }
378379
void notify_gc_no_progress() { _progress_last_gc.unset(); }

src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class outputStream;
8282
f(conc_weak_roots, "Concurrent Weak Roots") \
8383
f(conc_weak_roots_work, " Roots") \
8484
SHENANDOAH_PAR_PHASE_DO(conc_weak_roots_work_, " CWR: ", f) \
85+
f(conc_weak_roots_rendezvous, " Rendezvous") \
8586
f(conc_cleanup_early, "Concurrent Cleanup") \
8687
f(conc_class_unload, "Concurrent Class Unloading") \
8788
f(conc_class_unload_unlink, " Unlink Stale") \

src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,6 @@ void ShenandoahUnload::prepare() {
133133
DependencyContext::cleaning_start();
134134
}
135135

136-
class ShenandoahRendezvousClosure : public HandshakeClosure {
137-
public:
138-
inline ShenandoahRendezvousClosure() : HandshakeClosure("ShenandoahRendezvous") {}
139-
inline void do_thread(Thread* thread) {}
140-
};
141-
142136
void ShenandoahUnload::unload() {
143137
ShenandoahHeap* heap = ShenandoahHeap::heap();
144138
assert(ClassUnloading, "Filtered by caller");
@@ -172,8 +166,7 @@ void ShenandoahUnload::unload() {
172166
// Make sure stale metadata and nmethods are no longer observable
173167
{
174168
ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_class_unload_rendezvous);
175-
ShenandoahRendezvousClosure cl;
176-
Handshake::execute(&cl);
169+
heap->rendezvous_threads();
177170
}
178171

179172
// Purge stale metadata and nmethods that were unlinked

0 commit comments

Comments
 (0)