Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
/ jdk16 Public archive

Commit

Permalink
8258714: Shenandoah: Process references before evacuation during degen
Browse files Browse the repository at this point in the history
Reviewed-by: shade
  • Loading branch information
rkennke committed Dec 21, 2020
1 parent e680ebe commit 2525f39
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2055,6 +2055,15 @@ void ShenandoahHeap::op_weak_refs() {
}
}

void ShenandoahHeap::stw_weak_refs(bool full_gc) {
// Weak refs processing
ShenandoahTimingsTracker t(full_gc ? ShenandoahPhaseTimings::full_gc_weakrefs_process
: ShenandoahPhaseTimings::degen_gc_weakrefs_process);
ShenandoahGCWorkerPhase worker_phase(full_gc ? ShenandoahPhaseTimings::full_gc_weakrefs_process
: ShenandoahPhaseTimings::degen_gc_weakrefs_process);
ref_processor()->process_references(workers(), false /* concurrent */);
}

void ShenandoahHeap::op_weak_roots() {
if (is_concurrent_weak_root_in_progress()) {
// Concurrent weak root processing
Expand Down Expand Up @@ -2194,12 +2203,6 @@ void ShenandoahHeap::op_degenerated(ShenandoahDegenPoint point) {
ShenandoahCodeRoots::disarm_nmethods();
}

{
ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_refs_work);
ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_weak_refs_work);
ref_processor()->process_references(workers(), false /* concurrent */);
}

op_cleanup_early();

case _degenerated_evac:
Expand Down Expand Up @@ -2485,6 +2488,7 @@ void ShenandoahHeap::stw_process_weak_roots(bool full_gc) {
void ShenandoahHeap::parallel_cleaning(bool full_gc) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
assert(is_stw_gc_in_progress(), "Only for Degenerated and Full GC");
stw_weak_refs(full_gc);
stw_process_weak_roots(full_gc);
stw_unload_classes(full_gc);
}
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ class ShenandoahHeap : public CollectedHeap {
private:
void stw_unload_classes(bool full_gc);
void stw_process_weak_roots(bool full_gc);
void stw_weak_refs(bool full_gc);

// Prepare concurrent root processing
void prepare_concurrent_roots();
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ void ShenandoahMarkCompact::phase1_mark_heap() {
cm->mark_roots(ShenandoahPhaseTimings::full_gc_scan_roots);
cm->finish_mark_from_roots(/* full_gc = */ true);
heap->mark_complete_marking_context();
rp->process_references(heap->workers(), false /* concurrent */);
heap->parallel_cleaning(true /* full_gc */);
}

Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ bool ShenandoahPhaseTimings::is_worker_phase(Phase phase) {
case full_gc_adjust_roots:
case degen_gc_scan_conc_roots:
case degen_gc_update_roots:
case full_gc_weakrefs_process:
case full_gc_scan_conc_roots:
case full_gc_purge_class_unload:
case full_gc_purge_weak_par:
case degen_gc_weakrefs_process:
case degen_gc_purge_class_unload:
case degen_gc_purge_weak_par:
case heap_iteration_roots:
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ class outputStream;
f(degen_gc, "Pause Degenerated GC (N)") \
f(degen_gc_scan_conc_roots, " Degen Mark Roots") \
SHENANDOAH_PAR_PHASE_DO(degen_gc_conc_mark_, " DM: ", f) \
f(degen_gc_weakrefs, " Weak References") \
f(degen_gc_weakrefs_process, " Process") \
f(degen_gc_purge, " System Purge") \
f(degen_gc_purge_class_unload, " Unload Classes") \
SHENANDOAH_PAR_PHASE_DO(degen_gc_purge_cu_par_, " DCU: ", f) \
Expand Down

1 comment on commit 2525f39

@openjdk-notifier
Copy link

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.