Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8261503: Shenandoah: reconsider verifier memory ordering #2505

Closed
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
16 changes: 8 additions & 8 deletions src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure {
// skip
break;
case ShenandoahVerifier::_verify_liveness_complete:
Atomic::add(&_ld[obj_reg->index()], (uint) obj->size());
Atomic::add(&_ld[obj_reg->index()], (uint) obj->size(), memory_order_relaxed);
// fallthrough for fast failure for un-live regions:
case ShenandoahVerifier::_verify_liveness_conservative:
check(ShenandoahAsserts::_safe_oop, obj, obj_reg->has_live(),
@@ -483,7 +483,7 @@ class ShenandoahVerifierReachableTask : public AbstractGangTask {
}
}

Atomic::add(&_processed, processed);
Atomic::add(&_processed, processed, memory_order_relaxed);
}
};

@@ -512,7 +512,7 @@ class ShenandoahVerifierMarkedRegionTask : public AbstractGangTask {
_processed(0) {};

size_t processed() {
return _processed;
return Atomic::load(&_processed);
}

virtual void work(uint worker_id) {
@@ -522,7 +522,7 @@ class ShenandoahVerifierMarkedRegionTask : public AbstractGangTask {
_options);

while (true) {
size_t v = Atomic::fetch_and_add(&_claimed, 1u);
size_t v = Atomic::fetch_and_add(&_claimed, 1u, memory_order_relaxed);
if (v < _heap->num_regions()) {
ShenandoahHeapRegion* r = _heap->get_region(v);
if (!r->is_humongous() && !r->is_trash()) {
@@ -542,7 +542,7 @@ class ShenandoahVerifierMarkedRegionTask : public AbstractGangTask {
if (_heap->complete_marking_context()->is_marked((oop)obj)) {
verify_and_follow(obj, stack, cl, &processed);
}
Atomic::add(&_processed, processed);
Atomic::add(&_processed, processed, memory_order_relaxed);
}

virtual void work_regular(ShenandoahHeapRegion *r, ShenandoahVerifierStack &stack, ShenandoahVerifyOopClosure &cl) {
@@ -575,7 +575,7 @@ class ShenandoahVerifierMarkedRegionTask : public AbstractGangTask {
}
}

Atomic::add(&_processed, processed);
Atomic::add(&_processed, processed, memory_order_relaxed);
}

void verify_and_follow(HeapWord *addr, ShenandoahVerifierStack &stack, ShenandoahVerifyOopClosure &cl, size_t *processed) {
@@ -747,12 +747,12 @@ void ShenandoahVerifier::verify_at_safepoint(const char *label,
if (r->is_humongous()) {
// For humongous objects, test if start region is marked live, and if so,
// all humongous regions in that chain have live data equal to their "used".
juint start_live = Atomic::load_acquire(&ld[r->humongous_start_region()->index()]);
juint start_live = Atomic::load(&ld[r->humongous_start_region()->index()]);
if (start_live > 0) {
verf_live = (juint)(r->used() / HeapWordSize);
}
} else {
verf_live = Atomic::load_acquire(&ld[r->index()]);
verf_live = Atomic::load(&ld[r->index()]);
}

size_t reg_live = r->get_live_data_words();