< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Print this page
rev 52371 : [mq]: lvb.patch
@@ -382,11 +382,15 @@
_alloc_seq_at_last_gc_end(0),
_used_at_last_gc(0) {
log_info(gc, init)("GC threads: " UINT32_FORMAT " parallel, " UINT32_FORMAT " concurrent", ParallelGCThreads, ConcGCThreads);
log_info(gc, init)("Reference processing: %s", ParallelRefProcEnabled ? "parallel" : "serial");
+ if (ShenandoahLoadRefBarrier) {
+ BarrierSet::set_barrier_set(new ShenandoahLRBBarrierSet(this));
+ } else {
BarrierSet::set_barrier_set(new ShenandoahBarrierSet(this));
+ }
_max_workers = MAX2(_max_workers, 1U);
_workers = new ShenandoahWorkGang("Shenandoah GC Threads", _max_workers,
/* are_GC_task_threads */true,
/* are_ConcurrentGC_threads */false);
@@ -1124,10 +1128,30 @@
MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations);
_rp->process_evacuate_roots(&cl, &blobsCl, worker_id);
}
};
+class ShenandoahEvacuateUpdateAllRootsTask : public AbstractGangTask {
+ ShenandoahRootProcessor* _rp;
+public:
+
+ ShenandoahEvacuateUpdateAllRootsTask(ShenandoahRootProcessor* rp) :
+ AbstractGangTask("Shenandoah evacuate and update all roots"),
+ _rp(rp) {
+ // Nothing else to do.
+ }
+
+ void work(uint worker_id) {
+ ShenandoahEvacOOMScope oom_evac_scope;
+ ShenandoahEvacuateUpdateRootsClosure cl;
+ CLDToOopClosure cldCl(&cl);
+ // MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations);
+ CodeBlobToOopClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations);
+ _rp->process_all_roots(&cl, &cl, &cldCl, &blobsCl, NULL, worker_id);
+ }
+};
+
class ShenandoahFixRootsTask : public AbstractGangTask {
ShenandoahRootEvacuator* _rp;
public:
ShenandoahFixRootsTask(ShenandoahRootEvacuator* rp) :
@@ -1145,18 +1169,42 @@
_rp->process_evacuate_roots(&cl, &blobsCl, worker_id);
}
};
+class ShenandoahFixAllRootsTask : public AbstractGangTask {
+ ShenandoahRootProcessor* _rp;
+public:
+
+ ShenandoahFixAllRootsTask(ShenandoahRootProcessor* rp) :
+ AbstractGangTask("Shenandoah update all roots"),
+ _rp(rp)
+ {
+ // Nothing else to do.
+ }
+
+ void work(uint worker_id) {
+ ShenandoahEvacOOMScope oom_evac_scope;
+ ShenandoahUpdateRefsClosure cl;
+ CLDToOopClosure cldCl(&cl);
+ MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations);
+ _rp->process_all_roots(&cl, &cl, &cldCl, &blobsCl, NULL, worker_id);
+ }
+};
+
void ShenandoahHeap::evacuate_and_update_roots() {
#if defined(COMPILER2) || INCLUDE_JVMCI
DerivedPointerTable::clear();
#endif
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only iterate roots while world is stopped");
- {
+ if (ShenandoahLoadRefBarrier) {
+ ShenandoahRootProcessor rp(this, workers()->active_workers(), ShenandoahPhaseTimings::init_evac);
+ ShenandoahEvacuateUpdateAllRootsTask roots_task(&rp);
+ workers()->run_task(&roots_task);
+ } else {
ShenandoahRootEvacuator rp(this, workers()->active_workers(), ShenandoahPhaseTimings::init_evac);
ShenandoahEvacuateUpdateRootsTask roots_task(&rp);
workers()->run_task(&roots_task);
}
@@ -1179,13 +1227,19 @@
// clear() and update_pointers() must always be called in pairs,
// cannot nest with above clear()/update_pointers().
#if defined(COMPILER2) || INCLUDE_JVMCI
DerivedPointerTable::clear();
#endif
+ if (ShenandoahLoadRefBarrier) {
+ ShenandoahRootProcessor rp(this, workers()->active_workers(), ShenandoahPhaseTimings::init_evac);
+ ShenandoahFixAllRootsTask update_roots_task(&rp);
+ workers()->run_task(&update_roots_task);
+ } else {
ShenandoahRootEvacuator rp(this, workers()->active_workers(), ShenandoahPhaseTimings::init_evac);
ShenandoahFixRootsTask update_roots_task(&rp);
workers()->run_task(&update_roots_task);
+ }
#if defined(COMPILER2) || INCLUDE_JVMCI
DerivedPointerTable::update_pointers();
#endif
}
< prev index next >