Skip to content
Permalink
Browse files
8276548: Use range based visitor for Howl-Full cards
Reviewed-by: ayang, sjohanss
  • Loading branch information
Thomas Schatzl committed Nov 8, 2021
1 parent ea23e73 commit 7320b77b3e451932ee8befa7af4b80593725761e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
@@ -327,12 +327,10 @@ inline void G1CardSetHowl::iterate_cardset(CardSetPtr const card_set, uint index
return;
}
case G1CardSet::CardSetHowl: { // actually FullCardSet
assert(card_set == G1CardSet::FullCardSet, "Must be");
if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlFull)) {
assert(card_set == G1CardSet::FullCardSet, "Must be");
uint offset = index << config->log2_num_cards_in_howl_bitmap();
for (uint i = 0; i < config->num_cards_in_howl_bitmap(); i++) {
found((offset | (uint)i));
}
found(offset, config->num_cards_in_howl_bitmap());
}
return;
}
@@ -123,7 +123,7 @@ class G1RemSetScanState : public CHeapObj<mtGC> {
size_t _num_total_scan_chunks; // Total number of elements in _region_scan_chunks.
uint8_t _scan_chunks_shift; // For conversion between card index and chunk index.
public:
uint scan_chunk_size() const { return (uint)1 << _scan_chunks_shift; }
uint scan_chunk_size_in_cards() const { return (uint)1 << _scan_chunks_shift; }

// Returns whether the chunk corresponding to the given region/card in region contain a
// dirty card, i.e. actually needs scanning.
@@ -368,10 +368,13 @@ class G1RemSetScanState : public CHeapObj<mtGC> {
return _next_dirty_regions->size() * HeapRegion::CardsPerRegion;
}

void set_chunk_region_dirty(size_t const region_card_idx) {
void set_chunk_range_dirty(size_t const region_card_idx, size_t const card_length) {
size_t chunk_idx = region_card_idx >> _scan_chunks_shift;
for (uint i = 0; i < _scan_chunks_per_region; i++) {
_region_scan_chunks[chunk_idx++] = true;
// Make sure that all chunks that contain the range are marked. Calculate the
// chunk of the last card that is actually marked.
size_t const end_chunk = (region_card_idx + card_length - 1) >> _scan_chunks_shift;
for (; chunk_idx <= end_chunk; chunk_idx++) {
_region_scan_chunks[chunk_idx] = true;
}
}

@@ -751,7 +754,7 @@ class G1CardTableChunkClaimer {
}

uint value() const { return _cur_claim; }
uint size() const { return _scan_state->scan_chunk_size(); }
uint size() const { return _scan_state->scan_chunk_size_in_cards(); }
};

// Scans a heap region for dirty cards.
@@ -1208,11 +1211,9 @@ class G1MergeHeapRootsTask : public WorkerTask {
}

void do_card_range(uint const start_card_idx, uint const length) {
assert(start_card_idx == 0, "must be");
assert(length == HeapRegion::CardsPerRegion, "must be");
size_t num_dirtied = _ct->mark_range_dirty(_region_base_idx, HeapRegion::CardsPerRegion);
size_t num_dirtied = _ct->mark_range_dirty(_region_base_idx + start_card_idx, length);
_stats.inc_cards_dirty(num_dirtied);
_scan_state->set_chunk_region_dirty(_region_base_idx);
_scan_state->set_chunk_range_dirty(_region_base_idx + start_card_idx, length);
}

// Helper to merge the cards in the card set for the given region onto the card

1 comment on commit 7320b77

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.