Skip to content
Permalink
Browse files

8236732: Shenandoah: Stricter placement for oom-evac scopes

Reviewed-by: zgu
  • Loading branch information
rkennke committed Jan 7, 2020
1 parent 9e09ba5 commit ba6cedcf2466356ba5283f47a95fb6fffc73d875
@@ -199,12 +199,8 @@ oop ShenandoahBarrierSet::load_reference_barrier_impl(oop obj) {
_heap->in_collection_set(obj) &&
obj == fwd) {
Thread *t = Thread::current();
if (t->is_GC_task_thread()) {
return _heap->evacuate_object(obj, t);
} else {
ShenandoahEvacOOMScope oom_evac_scope;
return _heap->evacuate_object(obj, t);
}
ShenandoahEvacOOMScope oom_evac_scope;
return _heap->evacuate_object(obj, t);
} else {
return fwd;
}
@@ -57,7 +57,6 @@ bool ShenandoahBarrierSetNMethod::nmethod_entry_barrier(nmethod* nm) {
}

// Heal oops and disarm
ShenandoahEvacOOMScope scope;
ShenandoahNMethod::heal_nmethod(nm);
ShenandoahNMethod::disarm_nmethod(nm);
return true;
@@ -215,15 +215,13 @@ class ShenandoahNMethodUnlinkClosure : public NMethodClosure {

if (nm->is_unloading()) {
ShenandoahReentrantLocker locker(nm_data->lock());
ShenandoahEvacOOMScope evac_scope;
unlink(nm);
return;
}

ShenandoahReentrantLocker locker(nm_data->lock());

// Heal oops and disarm
ShenandoahEvacOOMScope evac_scope;
if (_heap->is_evacuation_in_progress()) {
ShenandoahNMethod::heal_nmethod(nm);
}
@@ -123,11 +123,3 @@ ShenandoahEvacOOMScope::ShenandoahEvacOOMScope() {
ShenandoahEvacOOMScope::~ShenandoahEvacOOMScope() {
ShenandoahHeap::heap()->leave_evacuation();
}

ShenandoahEvacOOMScopeLeaver::ShenandoahEvacOOMScopeLeaver() {
ShenandoahHeap::heap()->leave_evacuation();
}

ShenandoahEvacOOMScopeLeaver::~ShenandoahEvacOOMScopeLeaver() {
ShenandoahHeap::heap()->enter_evacuation();
}
@@ -119,10 +119,4 @@ class ShenandoahEvacOOMScope : public StackObj {
~ShenandoahEvacOOMScope();
};

class ShenandoahEvacOOMScopeLeaver : public StackObj {
public:
ShenandoahEvacOOMScopeLeaver();
~ShenandoahEvacOOMScopeLeaver();
};

#endif // SHARE_GC_SHENANDOAH_SHENANDOAHEVACOOMHANDLER_HPP
@@ -174,6 +174,7 @@ void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
assert(data != NULL, "Sanity");
assert(data->lock()->owned_by_self(), "Must hold the lock");

ShenandoahEvacOOMScope evac_scope;
ShenandoahEvacuateUpdateRootsClosure cl;
data->oops_do(&cl, true /*fix relocation*/);
}
@@ -41,7 +41,6 @@ ShenandoahClassUnloadingTask::ShenandoahClassUnloadingTask(BoolObjectClosure* is
}

void ShenandoahClassUnloadingTask::work(uint worker_id) {
ShenandoahEvacOOMScope scope;
_code_cache_task.work(worker_id);
// Clean all klasses that were not unloaded.
// The weak metadata in klass doesn't need to be
@@ -173,7 +173,6 @@ class ShenandoahInitTraversalCollectionTask : public AbstractGangTask {
void work(uint worker_id) {
ShenandoahParallelWorkerSession worker_session(worker_id);

ShenandoahEvacOOMScope oom_evac_scope;
ShenandoahObjToScanQueueSet* queues = _heap->traversal_gc()->task_queues();
ShenandoahObjToScanQueue* q = queues->queue(worker_id);

@@ -214,7 +213,6 @@ class ShenandoahConcurrentTraversalCollectionTask : public AbstractGangTask {
void work(uint worker_id) {
ShenandoahConcurrentWorkerSession worker_session(worker_id);
ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers);
ShenandoahEvacOOMScope oom_evac_scope;
ShenandoahTraversalGC* traversal_gc = _heap->traversal_gc();

// Drain all outstanding work in queues.
@@ -237,7 +235,6 @@ class ShenandoahFinalTraversalCollectionTask : public AbstractGangTask {
void work(uint worker_id) {
ShenandoahParallelWorkerSession worker_session(worker_id);

ShenandoahEvacOOMScope oom_evac_scope;
ShenandoahTraversalGC* traversal_gc = _heap->traversal_gc();

ShenandoahObjToScanQueueSet* queues = traversal_gc->task_queues();
@@ -542,7 +539,6 @@ void ShenandoahTraversalGC::main_loop_work(T* cl, jushort* live_data, uint worke

if (work == 0) {
// No more work, try to terminate
ShenandoahEvacOOMScopeLeaver oom_scope_leaver;
ShenandoahSuspendibleThreadSetLeaver stsl(sts_yield && ShenandoahSuspendibleWorkers);
ShenandoahTerminationTimingsTracker term_tracker(worker_id);
ShenandoahTerminatorTerminator tt(_heap);
@@ -811,7 +807,6 @@ class ShenandoahTraversalSingleThreadKeepAliveUpdateClosure : public OopClosure

template <class T>
inline void do_oop_work(T* p) {
ShenandoahEvacOOMScope evac_scope;
_traversal_gc->process_oop<T, false /* string dedup */, false /* degen */, true /* atomic update */>(p, _thread, _queue, _mark_context);
}

@@ -834,7 +829,6 @@ class ShenandoahTraversalSingleThreadKeepAliveUpdateDegenClosure : public OopClo

template <class T>
inline void do_oop_work(T* p) {
ShenandoahEvacOOMScope evac_scope;
_traversal_gc->process_oop<T, false /* string dedup */, true /* degen */, false /* atomic update */>(p, _thread, _queue, _mark_context);
}

@@ -861,7 +855,6 @@ class ShenandoahTraversalPrecleanTask : public AbstractGangTask {
assert(worker_id == 0, "The code below is single-threaded, only one worker is expected");
ShenandoahParallelWorkerSession worker_session(worker_id);
ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers);
ShenandoahEvacOOMScope oom_evac_scope;

ShenandoahHeap* sh = ShenandoahHeap::heap();

@@ -968,7 +961,6 @@ class ShenandoahTraversalSingleThreadedDrainMarkingStackClosure: public VoidClos
assert(sh->process_references(), "why else would we be here?");
shenandoah_assert_rp_isalive_installed();

ShenandoahEvacOOMScope evac_scope;
traversal_gc->main_loop(_worker_id, _terminator, false);

if (_reset_terminator) {
@@ -1010,7 +1002,6 @@ class ShenandoahTraversalRefProcTaskProxy : public AbstractGangTask {
}

void work(uint worker_id) {
ShenandoahEvacOOMScope oom_evac_scope;
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
ShenandoahHeap* heap = ShenandoahHeap::heap();
ShenandoahTraversalDrainMarkingStackClosure complete_gc(worker_id, _terminator);
@@ -51,6 +51,7 @@ void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToSca
} else if (_heap->in_collection_set(obj)) {
oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (obj == forw) {
ShenandoahEvacOOMScope evac_scope;
forw = _heap->evacuate_object(obj, thread);
}
shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());

0 comments on commit ba6cedc

Please sign in to comment.