@@ -176,27 +176,26 @@ inline void HeapRegion::prepare_for_full_gc() {
176176
177177inline void HeapRegion::reset_compacted_after_full_gc (HeapWord* new_top) {
178178 set_top (new_top);
179- // After a compaction the mark bitmap in a movable region is invalid.
180- // But all objects are live, we get this by setting TAMS to bottom.
181- init_top_at_mark_start ();
182179
183180 reset_after_full_gc_common ();
184181}
185182
186183inline void HeapRegion::reset_skip_compacting_after_full_gc () {
187184 assert (!is_free (), " must be" );
188185
189- _garbage_bytes = 0 ;
190-
191- reset_top_at_mark_start ();
192-
193186 reset_after_full_gc_common ();
194187}
195188
196189inline void HeapRegion::reset_after_full_gc_common () {
190+ // After a full gc the mark bitmap in a movable region is invalid.
191+ // But all objects are live, we get this by setting TAMS to bottom.
192+ G1CollectedHeap::heap ()->concurrent_mark ()->reset_top_at_mark_start (this ); // FIXME
193+
197194 // Everything above bottom() is parsable and live.
198195 reset_parsable_bottom ();
199196
197+ _garbage_bytes = 0 ;
198+
200199 // Clear unused heap memory in debug builds.
201200 if (ZapUnusedHeapArea) {
202201 mangle_unused_area ();
@@ -266,21 +265,6 @@ inline void HeapRegion::update_bot_for_obj(HeapWord* obj_start, size_t obj_size)
266265 _bot_part.update_for_block (obj_start, obj_end);
267266}
268267
269- inline HeapWord* HeapRegion::top_at_mark_start () const {
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;
276- }
277-
278- inline void HeapRegion::set_top_at_mark_start (HeapWord* value) {
279- 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 )));
282- }
283-
284268inline HeapWord* HeapRegion::parsable_bottom () const {
285269 assert (!is_init_completed () || SafepointSynchronize::is_at_safepoint (), " only during initialization or safepoint" );
286270 return _parsable_bottom;
@@ -294,48 +278,22 @@ inline void HeapRegion::reset_parsable_bottom() {
294278 Atomic::release_store (&_parsable_bottom, bottom ());
295279}
296280
297- inline void HeapRegion::note_start_of_marking () {
298- assert (top_at_mark_start () == bottom (), " Region's TAMS must always be at bottom" );
299- if (is_old_or_humongous () && !is_collection_set_candidate ()) {
300- G1CollectedHeap::heap ()->concurrent_mark ()->update_top_at_mark_start (this );
301- set_top_at_mark_start (top ());
302- }
303- }
304-
305- inline void HeapRegion::note_end_of_marking (size_t marked_bytes) {
281+ inline void HeapRegion::note_end_of_marking (HeapWord* top_at_mark_start, size_t marked_bytes) {
306282 assert_at_safepoint ();
307283
308- if (top_at_mark_start () != bottom ()) {
309- _garbage_bytes = byte_size (bottom (), top_at_mark_start () ) - marked_bytes;
284+ if (top_at_mark_start != bottom ()) {
285+ _garbage_bytes = byte_size (bottom (), top_at_mark_start) - marked_bytes;
310286 }
311287
312288 if (needs_scrubbing ()) {
313- _parsable_bottom = top_at_mark_start () ;
289+ _parsable_bottom = top_at_mark_start;
314290 }
315291}
316292
317293inline void HeapRegion::note_end_of_scrubbing () {
318294 reset_parsable_bottom ();
319295}
320296
321- inline void HeapRegion::init_top_at_mark_start () {
322- reset_top_at_mark_start ();
323- _parsable_bottom = bottom ();
324- _garbage_bytes = 0 ;
325- }
326-
327- inline void HeapRegion::reset_top_at_mark_start () {
328- // We do not need a release store here because
329- //
330- // - if this method is called during concurrent bitmap clearing, we do not read
331- // the bitmap any more for live/dead information (we do not read the bitmap at
332- // all at that point).
333- // - otherwise we reclaim regions only during GC and we do not read tams and the
334- // bitmap concurrently.
335- G1CollectedHeap::heap ()->concurrent_mark ()->reset_top_at_mark_start (this );
336- set_top_at_mark_start (bottom ());
337- }
338-
339297inline bool HeapRegion::needs_scrubbing () const {
340298 return is_old ();
341299}
0 commit comments