Skip to content
Permalink
Browse files
8242641: Shenandoah: clear live data and update TAMS optimistically
Reviewed-by: rkennke
  • Loading branch information
shipilev committed Apr 14, 2020
1 parent 3602186 commit b98e863f5774934eb2dc6deefc7cc0365c32aa81
Showing 1 changed file with 27 additions and 3 deletions.
@@ -1375,11 +1375,14 @@ class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionCl
ShenandoahInitMarkUpdateRegionStateClosure() : _ctx(ShenandoahHeap::heap()->marking_context()) {}

void heap_region_do(ShenandoahHeapRegion* r) {
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->index());
if (r->is_active()) {
r->clear_live_data();
_ctx->capture_top_at_mark_start(r);
// Check if region needs updating its TAMS. We have updated it already during concurrent
// reset, so it is very likely we don't need to do another write here.
if (_ctx->top_at_mark_start(r) != r->top()) {
_ctx->capture_top_at_mark_start(r);
}
} else {
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->index());
assert(_ctx->top_at_mark_start(r) == r->top(),
"Region " SIZE_FORMAT " should already have correct TAMS", r->index());
}
@@ -1787,11 +1790,32 @@ void ShenandoahHeap::op_roots() {
set_concurrent_root_in_progress(false);
}

class ShenandoahResetUpdateRegionStateClosure : public ShenandoahHeapRegionClosure {
private:
ShenandoahMarkingContext* const _ctx;
public:
ShenandoahResetUpdateRegionStateClosure() : _ctx(ShenandoahHeap::heap()->marking_context()) {}

void heap_region_do(ShenandoahHeapRegion* r) {
if (r->is_active()) {
// Reset live data and set TAMS optimistically. We would recheck these under the pause
// anyway to capture any updates that happened since now.
r->clear_live_data();
_ctx->capture_top_at_mark_start(r);
}
}

bool is_thread_safe() { return true; }
};

void ShenandoahHeap::op_reset() {
if (ShenandoahPacing) {
pacer()->setup_for_reset();
}
reset_mark_bitmap();

ShenandoahResetUpdateRegionStateClosure cl;
parallel_heap_region_iterate(&cl);
}

void ShenandoahHeap::op_preclean() {

0 comments on commit b98e863

Please sign in to comment.