Skip to content

Commit a9be3d1

Browse files
author
duke
committed
Backport 08db4b99622e488558dd7987c34f1c515fa30426
1 parent dd74835 commit a9be3d1

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ bool ShenandoahConcurrentGC::has_in_place_promotions(ShenandoahHeap* heap) {
831831
return heap->mode()->is_generational() && heap->old_generation()->has_in_place_promotions();
832832
}
833833

834-
template<bool GENERATIONAL>
835834
class ShenandoahConcurrentEvacThreadClosure : public ThreadClosure {
836835
private:
837836
OopClosure* const _oops;
@@ -841,13 +840,9 @@ class ShenandoahConcurrentEvacThreadClosure : public ThreadClosure {
841840
void do_thread(Thread* thread) override {
842841
JavaThread* const jt = JavaThread::cast(thread);
843842
StackWatermarkSet::finish_processing(jt, _oops, StackWatermarkKind::gc);
844-
if (GENERATIONAL) {
845-
ShenandoahThreadLocalData::enable_plab_promotions(thread);
846-
}
847843
}
848844
};
849845

850-
template<bool GENERATIONAL>
851846
class ShenandoahConcurrentEvacUpdateThreadTask : public WorkerTask {
852847
private:
853848
ShenandoahJavaThreadsIterator _java_threads;
@@ -859,30 +854,20 @@ class ShenandoahConcurrentEvacUpdateThreadTask : public WorkerTask {
859854
}
860855

861856
void work(uint worker_id) override {
862-
if (GENERATIONAL) {
863-
Thread* worker_thread = Thread::current();
864-
ShenandoahThreadLocalData::enable_plab_promotions(worker_thread);
865-
}
866-
867857
// ShenandoahEvacOOMScope has to be setup by ShenandoahContextEvacuateUpdateRootsClosure.
868858
// Otherwise, may deadlock with watermark lock
869859
ShenandoahContextEvacuateUpdateRootsClosure oops_cl;
870-
ShenandoahConcurrentEvacThreadClosure<GENERATIONAL> thr_cl(&oops_cl);
860+
ShenandoahConcurrentEvacThreadClosure thr_cl(&oops_cl);
871861
_java_threads.threads_do(&thr_cl, worker_id);
872862
}
873863
};
874864

875865
void ShenandoahConcurrentGC::op_thread_roots() {
876-
ShenandoahHeap* const heap = ShenandoahHeap::heap();
866+
const ShenandoahHeap* const heap = ShenandoahHeap::heap();
877867
assert(heap->is_evacuation_in_progress(), "Checked by caller");
878868
ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_thread_roots);
879-
if (heap->mode()->is_generational()) {
880-
ShenandoahConcurrentEvacUpdateThreadTask<true> task(heap->workers()->active_workers());
881-
heap->workers()->run_task(&task);
882-
} else {
883-
ShenandoahConcurrentEvacUpdateThreadTask<false> task(heap->workers()->active_workers());
884-
heap->workers()->run_task(&task);
885-
}
869+
ShenandoahConcurrentEvacUpdateThreadTask task(heap->workers()->active_workers());
870+
heap->workers()->run_task(&task);
886871
}
887872

888873
void ShenandoahConcurrentGC::op_weak_refs() {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,11 @@ class ShenandoahRetireGCLABClosure : public ThreadClosure {
12381238
// 1. We need to make the plab memory parsable by remembered-set scanning.
12391239
// 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region
12401240
ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread);
1241+
1242+
// Re-enable promotions for the next evacuation phase.
1243+
ShenandoahThreadLocalData::enable_plab_promotions(thread);
1244+
1245+
// Reset the fill size for next evacuation phase.
12411246
if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) {
12421247
ShenandoahThreadLocalData::set_plab_size(thread, 0);
12431248
}

0 commit comments

Comments
 (0)