Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ bool ShenandoahConcurrentGC::has_in_place_promotions(ShenandoahHeap* heap) {
return heap->mode()->is_generational() && heap->old_generation()->has_in_place_promotions();
}

template<bool GENERATIONAL>
class ShenandoahConcurrentEvacThreadClosure : public ThreadClosure {
private:
OopClosure* const _oops;
Expand All @@ -833,13 +832,9 @@ class ShenandoahConcurrentEvacThreadClosure : public ThreadClosure {
void do_thread(Thread* thread) override {
JavaThread* const jt = JavaThread::cast(thread);
StackWatermarkSet::finish_processing(jt, _oops, StackWatermarkKind::gc);
if (GENERATIONAL) {
ShenandoahThreadLocalData::enable_plab_promotions(thread);
}
}
};

template<bool GENERATIONAL>
class ShenandoahConcurrentEvacUpdateThreadTask : public WorkerTask {
private:
ShenandoahJavaThreadsIterator _java_threads;
Expand All @@ -851,30 +846,20 @@ class ShenandoahConcurrentEvacUpdateThreadTask : public WorkerTask {
}

void work(uint worker_id) override {
if (GENERATIONAL) {
Thread* worker_thread = Thread::current();
ShenandoahThreadLocalData::enable_plab_promotions(worker_thread);
}

// ShenandoahEvacOOMScope has to be setup by ShenandoahContextEvacuateUpdateRootsClosure.
// Otherwise, may deadlock with watermark lock
ShenandoahContextEvacuateUpdateRootsClosure oops_cl;
ShenandoahConcurrentEvacThreadClosure<GENERATIONAL> thr_cl(&oops_cl);
ShenandoahConcurrentEvacThreadClosure thr_cl(&oops_cl);
_java_threads.threads_do(&thr_cl, worker_id);
}
};

void ShenandoahConcurrentGC::op_thread_roots() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
const ShenandoahHeap* const heap = ShenandoahHeap::heap();
assert(heap->is_evacuation_in_progress(), "Checked by caller");
ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_thread_roots);
if (heap->mode()->is_generational()) {
ShenandoahConcurrentEvacUpdateThreadTask<true> task(heap->workers()->active_workers());
heap->workers()->run_task(&task);
} else {
ShenandoahConcurrentEvacUpdateThreadTask<false> task(heap->workers()->active_workers());
heap->workers()->run_task(&task);
}
ShenandoahConcurrentEvacUpdateThreadTask task(heap->workers()->active_workers());
heap->workers()->run_task(&task);
}

void ShenandoahConcurrentGC::op_weak_refs() {
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,11 @@ class ShenandoahRetireGCLABClosure : public ThreadClosure {
// 1. We need to make the plab memory parsable by remembered-set scanning.
// 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region
ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread);

// Re-enable promotions for the next evacuation phase.
ShenandoahThreadLocalData::enable_plab_promotions(thread);

// Reset the fill size for next evacuation phase.
if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) {
ShenandoahThreadLocalData::set_plab_size(thread, 0);
}
Expand Down