Skip to content

Commit 33b201f

Browse files
author
Thomas Schatzl
committed
8326781
initial version initial draft some improvmeents Make things work forgotten fix
1 parent e85355a commit 33b201f

12 files changed

+112
-42
lines changed

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,7 @@ void G1CollectedHeap::ref_processing_init() {
15061506
// * Reference discovery will not need a barrier.
15071507

15081508
// Concurrent Mark ref processor
1509+
_is_alive_closure_cm.set_concurrent_mark(concurrent_mark());
15091510
_ref_processor_cm =
15101511
new ReferenceProcessor(&_is_subject_to_discovery_cm,
15111512
ParallelGCThreads, // degree of mt processing

src/hotspot/share/gc/g1/g1CollectionSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class G1PrintCollectionSetDetailClosure : public HeapRegionClosure {
255255
assert(r->in_collection_set(), "Region %u should be in collection set", r->hrm_index());
256256
_st->print_cr(" " HR_FORMAT ", TAMS: " PTR_FORMAT " PB: " PTR_FORMAT ", age: %4d",
257257
HR_FORMAT_PARAMS(r),
258-
p2i(r->top_at_mark_start()),
258+
p2i(G1CollectedHeap::heap()->concurrent_mark()->top_at_mark_start(r)),
259259
p2i(r->parsable_bottom()),
260260
r->has_surv_rate_group() ? checked_cast<int>(r->age_in_surv_rate_group()) : -1);
261261
return false;

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@
7777
#include "utilities/growableArray.hpp"
7878
#include "utilities/powerOfTwo.hpp"
7979

80+
G1CMIsAliveClosure::G1CMIsAliveClosure(G1CollectedHeap* g1h) :
81+
_g1h(g1h), _cm(g1h->concurrent_mark()) { }
82+
83+
void G1CMIsAliveClosure::set_concurrent_mark(G1ConcurrentMark* cm) {
84+
assert(_cm == nullptr, "already set");
85+
_cm = cm;
86+
}
87+
8088
bool G1CMBitMapClosure::do_addr(HeapWord* const addr) {
8189
assert(addr < _cm->finger(), "invariant");
8290
assert(addr >= _task->finger(), "invariant");
@@ -501,6 +509,7 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h,
501509
_max_concurrent_workers(0),
502510

503511
_region_mark_stats(NEW_C_HEAP_ARRAY(G1RegionMarkStats, _g1h->max_reserved_regions(), mtGC)),
512+
_top_at_mark_starts(NEW_C_HEAP_ARRAY(HeapWord*, _g1h->max_reserved_regions(), mtGC)),
504513
_top_at_rebuild_starts(NEW_C_HEAP_ARRAY(HeapWord*, _g1h->max_reserved_regions(), mtGC)),
505514
_needs_remembered_set_rebuild(false)
506515
{
@@ -558,6 +567,7 @@ void G1ConcurrentMark::reset() {
558567

559568
uint max_reserved_regions = _g1h->max_reserved_regions();
560569
for (uint i = 0; i < max_reserved_regions; i++) {
570+
_top_at_mark_starts[i] = _g1h->bottom_addr_for_region(i);
561571
_top_at_rebuild_starts[i] = nullptr;
562572
_region_mark_stats[i].clear();
563573
}
@@ -570,6 +580,7 @@ void G1ConcurrentMark::clear_statistics(HeapRegion* r) {
570580
for (uint j = 0; j < _max_num_tasks; ++j) {
571581
_tasks[j]->clear_mark_stats_cache(region_idx);
572582
}
583+
_top_at_mark_starts[region_idx] = _g1h->bottom_addr_for_region(region_idx);
573584
_top_at_rebuild_starts[region_idx] = nullptr;
574585
_region_mark_stats[region_idx].clear();
575586
}
@@ -647,6 +658,7 @@ void G1ConcurrentMark::reset_at_marking_complete() {
647658
}
648659

649660
G1ConcurrentMark::~G1ConcurrentMark() {
661+
FREE_C_HEAP_ARRAY(HeapWord*, _top_at_mark_starts);
650662
FREE_C_HEAP_ARRAY(HeapWord*, _top_at_rebuild_starts);
651663
FREE_C_HEAP_ARRAY(G1RegionMarkStats, _region_mark_stats);
652664
// The G1ConcurrentMark instance is never freed.
@@ -692,7 +704,7 @@ class G1ClearBitMapTask : public WorkerTask {
692704
assert(_bitmap->get_next_marked_addr(r->bottom(), r->end()) == r->end(), "Should not have marked bits");
693705
return r->bottom();
694706
}
695-
assert(_bitmap->get_next_marked_addr(r->top_at_mark_start(), r->end()) == r->end(), "Should not have marked bits above tams");
707+
assert(_bitmap->get_next_marked_addr(_cm->top_at_mark_start(r), r->end()) == r->end(), "Should not have marked bits above tams");
696708
}
697709
return r->end();
698710
}
@@ -844,7 +856,7 @@ class G1PreConcurrentStartTask::NoteStartOfMarkTask : public G1AbstractSubTask {
844856

845857
void G1PreConcurrentStartTask::ResetMarkingStateTask::do_work(uint worker_id) {
846858
// Reset marking state.
847-
_cm->reset();
859+
//_cm->reset();
848860
}
849861

850862
class NoteStartOfMarkHRClosure : public HeapRegionClosure {
@@ -877,6 +889,7 @@ void G1ConcurrentMark::pre_concurrent_start(GCCause::Cause cause) {
877889

878890
ClassLoaderDataGraph::verify_claimed_marks_cleared(ClassLoaderData::_claim_strong);
879891

892+
reset();
880893
G1PreConcurrentStartTask cl(cause, this);
881894
G1CollectedHeap::heap()->run_batch_task(&cl);
882895

@@ -1014,9 +1027,9 @@ void G1ConcurrentMark::scan_root_region(const MemRegion* region, uint worker_id)
10141027
#ifdef ASSERT
10151028
HeapWord* last = region->last();
10161029
HeapRegion* hr = _g1h->heap_region_containing(last);
1017-
assert(hr->is_old() || hr->top_at_mark_start() == hr->bottom(),
1030+
assert(hr->is_old() || top_at_mark_start(hr) == hr->bottom(),
10181031
"Root regions must be old or survivor/eden but region %u is %s", hr->hrm_index(), hr->get_type_str());
1019-
assert(hr->top_at_mark_start() == region->start(),
1032+
assert(top_at_mark_start(hr) == region->start(),
10201033
"MemRegion start should be equal to TAMS");
10211034
#endif
10221035

@@ -1078,11 +1091,11 @@ bool G1ConcurrentMark::wait_until_root_region_scan_finished() {
10781091
}
10791092

10801093
void G1ConcurrentMark::add_root_region(HeapRegion* r) {
1081-
root_regions()->add(r->top_at_mark_start(), r->top());
1094+
root_regions()->add(top_at_mark_start(r), r->top());
10821095
}
10831096

10841097
bool G1ConcurrentMark::is_root_region(HeapRegion* r) {
1085-
return root_regions()->contains(MemRegion(r->top_at_mark_start(), r->top()));
1098+
return root_regions()->contains(MemRegion(top_at_mark_start(r), r->top()));
10861099
}
10871100

10881101
void G1ConcurrentMark::root_region_scan_abort_and_wait() {
@@ -1944,9 +1957,9 @@ HeapRegion* G1ConcurrentMark::claim_region(uint worker_id) {
19441957
if (res == finger && curr_region != nullptr) {
19451958
// we succeeded
19461959
HeapWord* bottom = curr_region->bottom();
1947-
HeapWord* limit = curr_region->top_at_mark_start();
1960+
HeapWord* limit = top_at_mark_start(curr_region);
19481961

1949-
log_trace(gc, marking)("Claim region %u bottom " PTR_FORMAT " tams " PTR_FORMAT, curr_region->hrm_index(), p2i(curr_region->bottom()), p2i(curr_region->top_at_mark_start()));
1962+
log_trace(gc, marking)("Claim region %u bottom " PTR_FORMAT " tams " PTR_FORMAT, curr_region->hrm_index(), p2i(curr_region->bottom()), p2i(top_at_mark_start(curr_region)));
19501963
// notice that _finger == end cannot be guaranteed here since,
19511964
// someone else might have moved the finger even further
19521965
assert(_finger >= end, "the finger should have moved forward");
@@ -2169,7 +2182,7 @@ void G1CMTask::setup_for_region(HeapRegion* hr) {
21692182
void G1CMTask::update_region_limit() {
21702183
HeapRegion* hr = _curr_region;
21712184
HeapWord* bottom = hr->bottom();
2172-
HeapWord* limit = hr->top_at_mark_start();
2185+
HeapWord* limit = _cm->top_at_mark_start(hr);
21732186

21742187
if (limit == bottom) {
21752188
// The region was collected underneath our feet.

src/hotspot/share/gc/g1/g1ConcurrentMark.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ typedef GenericTaskQueueSet<G1CMTaskQueue, mtGC> G1CMTaskQueueSet;
9797
// reference processor as the _is_alive_non_header field
9898
class G1CMIsAliveClosure : public BoolObjectClosure {
9999
G1CollectedHeap* _g1h;
100+
G1ConcurrentMark* _cm;
100101
public:
101-
G1CMIsAliveClosure(G1CollectedHeap* g1h) : _g1h(g1h) { }
102+
G1CMIsAliveClosure(G1CollectedHeap* g1h);
103+
void set_concurrent_mark(G1ConcurrentMark* cm);
104+
102105
bool do_object_b(oop obj);
103106
};
104107

@@ -539,6 +542,7 @@ class G1ConcurrentMark : public CHeapObj<mtGC> {
539542

540543
// Region statistics gathered during marking.
541544
G1RegionMarkStats* _region_mark_stats;
545+
HeapWord* volatile* _top_at_mark_starts;
542546
// Top pointer for each region at the start of the rebuild remembered set process
543547
// for regions which remembered sets need to be rebuilt. A null for a given region
544548
// means that this region does not be scanned during the rebuilding remembered
@@ -558,10 +562,16 @@ class G1ConcurrentMark : public CHeapObj<mtGC> {
558562
// Set live bytes for concurrent marking.
559563
void set_live_bytes(uint region, size_t live_bytes) { _region_mark_stats[region]._live_words = live_bytes / HeapWordSize; }
560564

565+
inline void update_top_at_mark_start(HeapRegion* r);
566+
inline void reset_top_at_mark_start(HeapRegion* r);
567+
inline HeapWord* top_at_mark_start(HeapRegion* r) const;
568+
inline HeapWord* top_at_mark_start(uint region) const;
569+
inline bool obj_allocated_since_mark_start(oop obj) const;
570+
561571
// Sets the internal top_at_region_start for the given region to current top of the region.
562572
inline void update_top_at_rebuild_start(HeapRegion* r);
563573
// TARS for the given region during remembered set rebuilding.
564-
inline HeapWord* top_at_rebuild_start(uint region) const;
574+
inline HeapWord* top_at_rebuild_start(HeapRegion* r) const;
565575

566576
// Clear statistics gathered during the concurrent cycle for the given region after
567577
// it has been reclaimed.

src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ inline bool G1CMIsAliveClosure::do_object_b(oop obj) {
4848
return true;
4949
}
5050

51-
HeapRegion* hr = _g1h->heap_region_containing(obj);
5251
// All objects allocated since the start of marking are considered live.
53-
if (hr->obj_allocated_since_marking_start(obj)) {
52+
if (_cm->obj_allocated_since_mark_start(obj)) {
5453
return true;
5554
}
5655

@@ -66,15 +65,16 @@ inline bool G1CMSubjectToDiscoveryClosure::do_object_b(oop obj) {
6665
}
6766

6867
inline bool G1ConcurrentMark::mark_in_bitmap(uint const worker_id, oop const obj) {
69-
HeapRegion* const hr = _g1h->heap_region_containing(obj);
70-
71-
if (hr->obj_allocated_since_marking_start(obj)) {
68+
if (obj_allocated_since_mark_start(obj)) {
7269
return false;
7370
}
7471

7572
// Some callers may have stale objects to mark above TAMS after humongous reclaim.
7673
// Can't assert that this is a valid object at this point, since it might be in the process of being copied by another thread.
77-
assert(!hr->is_continues_humongous(), "Should not try to mark object " PTR_FORMAT " in Humongous continues region %u above TAMS " PTR_FORMAT, p2i(obj), hr->hrm_index(), p2i(hr->top_at_mark_start()));
74+
DEBUG_ONLY(HeapRegion* const hr = _g1h->heap_region_containing(obj);)
75+
assert(!hr->is_continues_humongous(),
76+
"Should not try to mark object " PTR_FORMAT " in Humongous continues region %u above TAMS " PTR_FORMAT,
77+
p2i(obj), hr->hrm_index(), p2i(top_at_mark_start(hr)));
7878

7979
bool success = _mark_bitmap.par_mark(obj);
8080
if (success) {
@@ -184,9 +184,44 @@ inline size_t G1CMTask::scan_objArray(objArrayOop obj, MemRegion mr) {
184184
return mr.word_size();
185185
}
186186

187-
inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(uint region) const {
187+
inline void G1ConcurrentMark::update_top_at_mark_start(HeapRegion* r) {
188+
uint const region = r->hrm_index();
189+
assert(region < _g1h->max_reserved_regions(), "Tried to access TAMS for region %u out of bounds", region);
190+
assert(_top_at_mark_starts[region] == r->bottom(),
191+
"TAMS for region %u has already been set to " PTR_FORMAT " should be bottom " PTR_FORMAT,
192+
region, p2i(_top_at_mark_starts[region]), p2i(r->bottom()));
193+
_top_at_mark_starts[region] = r->top();
194+
}
195+
196+
inline void G1ConcurrentMark::reset_top_at_mark_start(HeapRegion* r) {
197+
_top_at_mark_starts[r->hrm_index()] = r->bottom();
198+
}
199+
200+
inline HeapWord* G1ConcurrentMark::top_at_mark_start(HeapRegion* r) const {
201+
HeapWord* value = top_at_mark_start(r->hrm_index());
202+
assert(r->top_at_mark_start() == top_at_mark_start(r->hrm_index()),
203+
"Inconsistency check region %u %s " PTR_FORMAT " " PTR_FORMAT,
204+
r->hrm_index(), r->get_short_type_str(), p2i(r->top_at_mark_start()), p2i(top_at_mark_start(r->hrm_index()) ) );
205+
206+
return value;
207+
}
208+
209+
inline HeapWord* G1ConcurrentMark::top_at_mark_start(uint region) const {
188210
assert(region < _g1h->max_reserved_regions(), "Tried to access TARS for region %u out of bounds", region);
189-
return _top_at_rebuild_starts[region];
211+
return _top_at_mark_starts[region];
212+
}
213+
214+
inline bool G1ConcurrentMark::obj_allocated_since_mark_start(oop obj) const {
215+
uint const region = _g1h->addr_to_region(obj);
216+
assert(region < _g1h->max_reserved_regions(), "obj " PTR_FORMAT " outside heap %u", p2i(obj), region);
217+
assert(_g1h->region_at(region)->top_at_mark_start() == top_at_mark_start(region),
218+
"Inconsistency region %u %s " PTR_FORMAT " " PTR_FORMAT, region, _g1h->region_at(region)->get_short_type_str(), p2i(_g1h->region_at(region)->top_at_mark_start()), p2i(top_at_mark_start(region))
219+
);
220+
return cast_from_oop<HeapWord*>(obj) >= top_at_mark_start(region);
221+
}
222+
223+
inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(HeapRegion* r) const {
224+
return _top_at_rebuild_starts[r->hrm_index()];
190225
}
191226

192227
inline void G1ConcurrentMark::update_top_at_rebuild_start(HeapRegion* r) {

src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask {
105105
// - been allocated after rebuild start, or
106106
// - been reclaimed by a collection.
107107
bool should_rebuild_or_scrub(HeapRegion* hr) const {
108-
return _cm->top_at_rebuild_start(hr->hrm_index()) != nullptr;
108+
return _cm->top_at_rebuild_start(hr) != nullptr;
109109
}
110110

111111
// Helper used by both humongous objects and when chunking an object larger than the
@@ -229,7 +229,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask {
229229
assert(should_rebuild_or_scrub(hr), "must be");
230230

231231
log_trace(gc, marking)("Scrub and rebuild region: " HR_FORMAT " pb: " PTR_FORMAT " TARS: " PTR_FORMAT " TAMS: " PTR_FORMAT,
232-
HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr->hrm_index())), p2i(hr->top_at_mark_start()));
232+
HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr)), p2i(_cm->top_at_mark_start(hr)));
233233

234234
if (scan_and_scrub_to_pb(hr, hr->bottom(), pb)) {
235235
log_trace(gc, marking)("Scan and scrub aborted for region: %u", hr->hrm_index());
@@ -246,7 +246,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask {
246246
hr->note_end_of_scrubbing();
247247

248248
// Rebuild from TAMS (= parsable_bottom) to TARS.
249-
if (scan_from_pb_to_tars(hr, pb, _cm->top_at_rebuild_start(hr->hrm_index()))) {
249+
if (scan_from_pb_to_tars(hr, pb, _cm->top_at_rebuild_start(hr))) {
250250
log_trace(gc, marking)("Rebuild aborted for region: %u (%s)", hr->hrm_index(), hr->get_short_type_str());
251251
return true;
252252
}
@@ -272,7 +272,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask {
272272
"Humongous object not live");
273273

274274
log_trace(gc, marking)("Rebuild for humongous region: " HR_FORMAT " pb: " PTR_FORMAT " TARS: " PTR_FORMAT,
275-
HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr->hrm_index())));
275+
HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr)));
276276

277277
// Scan the humongous object in chunks from bottom to top to rebuild remembered sets.
278278
HeapWord* humongous_end = hr->humongous_start_region()->bottom() + humongous->size();

src/hotspot/share/gc/g1/g1HeapRegion.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,6 @@ class HeapRegion : public CHeapObj<mtGC> {
540540
inline bool is_in_parsable_area(const void* const addr) const;
541541
inline static bool is_in_parsable_area(const void* const addr, const void* const pb);
542542

543-
bool obj_allocated_since_marking_start(oop obj) const {
544-
return cast_from_oop<HeapWord*>(obj) >= top_at_mark_start();
545-
}
546-
547543
// Update the region state after a failed evacuation.
548544
void handle_evacuation_failure(bool retain);
549545

src/hotspot/share/gc/g1/g1HeapRegion.inline.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,18 @@ inline void HeapRegion::update_bot_for_obj(HeapWord* obj_start, size_t obj_size)
267267
}
268268

269269
inline HeapWord* HeapRegion::top_at_mark_start() const {
270-
return Atomic::load(&_top_at_mark_start);
270+
HeapWord* value = Atomic::load(&_top_at_mark_start);
271+
assert(value == G1CollectedHeap::heap()->concurrent_mark()->top_at_mark_start(hrm_index()),
272+
"must be equal region %u %s " PTR_FORMAT " " PTR_FORMAT,
273+
hrm_index(), get_short_type_str(),
274+
p2i(value), p2i(G1CollectedHeap::heap()->concurrent_mark()->top_at_mark_start(hrm_index())));
275+
return value;
271276
}
272277

273278
inline void HeapRegion::set_top_at_mark_start(HeapWord* value) {
274279
Atomic::store(&_top_at_mark_start, value);
280+
assert(_top_at_mark_start == G1CollectedHeap::heap()->concurrent_mark()->top_at_mark_start(this),
281+
"duh " PTR_FORMAT " " PTR_FORMAT, p2i(_top_at_mark_start), p2i(G1CollectedHeap::heap()->concurrent_mark()->top_at_mark_start(this)));
275282
}
276283

277284
inline HeapWord* HeapRegion::parsable_bottom() const {
@@ -290,6 +297,7 @@ inline void HeapRegion::reset_parsable_bottom() {
290297
inline void HeapRegion::note_start_of_marking() {
291298
assert(top_at_mark_start() == bottom(), "Region's TAMS must always be at bottom");
292299
if (is_old_or_humongous() && !is_collection_set_candidate()) {
300+
G1CollectedHeap::heap()->concurrent_mark()->update_top_at_mark_start(this);
293301
set_top_at_mark_start(top());
294302
}
295303
}
@@ -324,6 +332,7 @@ inline void HeapRegion::reset_top_at_mark_start() {
324332
// all at that point).
325333
// - otherwise we reclaim regions only during GC and we do not read tams and the
326334
// bitmap concurrently.
335+
G1CollectedHeap::heap()->concurrent_mark()->reset_top_at_mark_start(this);
327336
set_top_at_mark_start(bottom());
328337
}
329338

src/hotspot/share/gc/g1/g1HeapVerifier.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,12 @@ class G1VerifyRegionMarkingStateClosure : public HeapRegionClosure {
462462
G1ConcurrentMark* cm = G1CollectedHeap::heap()->concurrent_mark();
463463

464464
bool part_of_marking = r->is_old_or_humongous() && !r->is_collection_set_candidate();
465+
HeapWord* top_at_mark_start = cm->top_at_mark_start(r);
465466

466467
if (part_of_marking) {
467-
guarantee(r->bottom() != r->top_at_mark_start(), "region %u (%s) does not have TAMS set",
468-
r->hrm_index(), r->get_short_type_str());
468+
guarantee(r->bottom() != top_at_mark_start,
469+
"region %u (%s) does not have TAMS set",
470+
r->hrm_index(), r->get_short_type_str());
469471
size_t marked_bytes = cm->live_bytes(r->hrm_index());
470472

471473
MarkedBytesClosure cl;
@@ -475,9 +477,9 @@ class G1VerifyRegionMarkingStateClosure : public HeapRegionClosure {
475477
"region %u (%s) live bytes actual %zu and cache %zu differ",
476478
r->hrm_index(), r->get_short_type_str(), cl.marked_bytes(), marked_bytes);
477479
} else {
478-
guarantee(r->bottom() == r->top_at_mark_start(),
480+
guarantee(r->bottom() == top_at_mark_start,
479481
"region %u (%s) has TAMS set " PTR_FORMAT " " PTR_FORMAT,
480-
r->hrm_index(), r->get_short_type_str(), p2i(r->bottom()), p2i(r->top_at_mark_start()));
482+
r->hrm_index(), r->get_short_type_str(), p2i(r->bottom()), p2i(top_at_mark_start));
481483
guarantee(cm->live_bytes(r->hrm_index()) == 0,
482484
"region %u (%s) has %zu live bytes recorded",
483485
r->hrm_index(), r->get_short_type_str(), cm->live_bytes(r->hrm_index()));
@@ -542,9 +544,10 @@ void G1HeapVerifier::verify_bitmap_clear(bool from_tams) {
542544
G1VerifyBitmapClear(bool from_tams) : _from_tams(from_tams) { }
543545

544546
virtual bool do_heap_region(HeapRegion* r) {
545-
G1CMBitMap* bitmap = G1CollectedHeap::heap()->concurrent_mark()->mark_bitmap();
547+
G1ConcurrentMark* cm = G1CollectedHeap::heap()->concurrent_mark();
548+
G1CMBitMap* bitmap = cm->mark_bitmap();
546549

547-
HeapWord* start = _from_tams ? r->top_at_mark_start() : r->bottom();
550+
HeapWord* start = _from_tams ? cm->top_at_mark_start(r) : r->bottom();
548551

549552
HeapWord* mark = bitmap->get_next_marked_addr(start, r->end());
550553
guarantee(mark == r->end(), "Found mark at " PTR_FORMAT " in region %u from start " PTR_FORMAT, p2i(mark), r->hrm_index(), p2i(start));

src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
#include "precompiled.hpp"
26+
#include "gc/g1/g1CollectedHeap.inline.hpp"
2627
#include "gc/g1/g1CollectionSetChooser.hpp"
2728
#include "gc/g1/g1HeapRegion.inline.hpp"
2829
#include "gc/g1/g1HeapRegionRemSet.inline.hpp"
@@ -101,7 +102,8 @@ bool G1RemSetTrackingPolicy::update_before_rebuild(HeapRegion* r, size_t live_by
101102

102103
assert(!r->rem_set()->is_updating(), "Remembered set of region %u is updating before rebuild", r->hrm_index());
103104

104-
size_t live_bytes_above_tams = pointer_delta(r->top(), r->top_at_mark_start()) * HeapWordSize;
105+
HeapWord* top_at_mark_start = G1CollectedHeap::heap()->concurrent_mark()->top_at_mark_start(r);
106+
size_t live_bytes_above_tams = pointer_delta(r->top(), top_at_mark_start) * HeapWordSize;
105107
size_t total_live_bytes = live_bytes_below_tams + live_bytes_above_tams;
106108

107109
bool selected_for_rebuild = false;

0 commit comments

Comments
 (0)