diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp index 441e4943958..3d9693bed10 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp @@ -561,7 +561,7 @@ public: // Sets the internal top_at_region_start for the given region to current top of the region. inline void update_top_at_rebuild_start(HeapRegion* r); // TARS for the given region during remembered set rebuilding. - inline HeapWord* top_at_rebuild_start(uint region) const; + inline HeapWord* top_at_rebuild_start(HeapRegion* r) const; // Clear statistics gathered during the concurrent cycle for the given region after // it has been reclaimed. diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp index 4e4e64ab797..4a05b86ae5a 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp @@ -184,9 +184,8 @@ inline size_t G1CMTask::scan_objArray(objArrayOop obj, MemRegion mr) { return mr.word_size(); } -inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(uint region) const { - assert(region < _g1h->max_reserved_regions(), "Tried to access TARS for region %u out of bounds", region); - return _top_at_rebuild_starts[region]; +inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(HeapRegion* r) const { + return _top_at_rebuild_starts[r->hrm_index()]; } inline void G1ConcurrentMark::update_top_at_rebuild_start(HeapRegion* r) { diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp index ee16c42626c..74e242a0f3f 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp @@ -105,7 +105,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { // - been allocated after rebuild start, or // - been reclaimed by a collection. bool should_rebuild_or_scrub(HeapRegion* hr) const { - return _cm->top_at_rebuild_start(hr->hrm_index()) != nullptr; + return _cm->top_at_rebuild_start(hr) != nullptr; } // Helper used by both humongous objects and when chunking an object larger than the @@ -229,7 +229,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { assert(should_rebuild_or_scrub(hr), "must be"); log_trace(gc, marking)("Scrub and rebuild region: " HR_FORMAT " pb: " PTR_FORMAT " TARS: " PTR_FORMAT " TAMS: " PTR_FORMAT, - HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr->hrm_index())), p2i(hr->top_at_mark_start())); + HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr)), p2i(hr->top_at_mark_start())); if (scan_and_scrub_to_pb(hr, hr->bottom(), pb)) { log_trace(gc, marking)("Scan and scrub aborted for region: %u", hr->hrm_index()); @@ -246,7 +246,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { hr->note_end_of_scrubbing(); // Rebuild from TAMS (= parsable_bottom) to TARS. - if (scan_from_pb_to_tars(hr, pb, _cm->top_at_rebuild_start(hr->hrm_index()))) { + if (scan_from_pb_to_tars(hr, pb, _cm->top_at_rebuild_start(hr))) { log_trace(gc, marking)("Rebuild aborted for region: %u (%s)", hr->hrm_index(), hr->get_short_type_str()); return true; } @@ -272,7 +272,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { "Humongous object not live"); log_trace(gc, marking)("Rebuild for humongous region: " HR_FORMAT " pb: " PTR_FORMAT " TARS: " PTR_FORMAT, - HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr->hrm_index()))); + HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr))); // Scan the humongous object in chunks from bottom to top to rebuild remembered sets. HeapWord* humongous_end = hr->humongous_start_region()->bottom() + humongous->size();