Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
0372026
Card table as DCQ
tschatzl Feb 11, 2025
7782295
* remove some commented out debug code
tschatzl Feb 24, 2025
9e26abb
* remove mention of "enqueue" or "enqueuing" for actions related to p…
tschatzl Feb 24, 2025
3004a96
* fix crash when writing dirty cards for memory regions during card t…
tschatzl Feb 24, 2025
b8100b9
* mdoerr review: fix comments in ppc code
tschatzl Feb 24, 2025
0100d8e
* only provide byte map base for JavaThreads
tschatzl Feb 25, 2025
9ef9c5f
* remove unnecessarily added logging
tschatzl Feb 25, 2025
e51eec8
* ayang review 1
tschatzl Feb 28, 2025
7d361fc
* ayang review 1 (ctd)
tschatzl Feb 28, 2025
d87935a
* fix assert
tschatzl Feb 28, 2025
810bf2d
* fix comment (trailing whitespace)
tschatzl Mar 3, 2025
b3dd008
ayang review 2
tschatzl Mar 3, 2025
8f46dc9
* iwalulya initial comments
tschatzl Mar 4, 2025
9e2ee54
* do not change card table base for gc threads during swapping
tschatzl Mar 4, 2025
442d9ea
* iwalulya review 2
tschatzl Mar 4, 2025
fc674f0
* ayang review - fix comment
tschatzl Mar 4, 2025
b4d19d9
iwalulya review
tschatzl Mar 4, 2025
4a97811
ayang review
tschatzl Mar 4, 2025
a457e6e
* fix whitespace
tschatzl Mar 5, 2025
350a4fa
* iwalulya review
tschatzl Mar 6, 2025
c994000
* ayang review 3
tschatzl Mar 7, 2025
93b884f
* fix card table verification crashes: in the first refinement phase,…
tschatzl Mar 8, 2025
758fac0
* optimized RISCV gen_write_ref_array_post_barrier() implementation c…
tschatzl Mar 11, 2025
aec9505
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Mar 12, 2025
3766b76
* ayang review
tschatzl Mar 12, 2025
7861117
* when aborting refinement during full collection, the global card ta…
tschatzl Mar 13, 2025
51a9eed
* ayang review
tschatzl Mar 14, 2025
b073017
Merge branch 'master' into 8342381-card-table-instead-of-dcq
tschatzl Mar 14, 2025
447fe39
* more documentation on why we need to rendezvous the gc threads
tschatzl Mar 15, 2025
4d0afd5
* obsolete G1UpdateBufferSize
tschatzl Mar 17, 2025
ff9eb26
Merge branch 'master' into 8342382-card-table-instead-of-dcq3
tschatzl Mar 18, 2025
c833bc8
* factor out card table and refinement table merging into a single
tschatzl Mar 18, 2025
f419556
* fix IR code generation tests that change due to barrier cost changes
tschatzl Mar 19, 2025
5e76a51
* make young gen length revising independent of refinement thread
tschatzl Mar 20, 2025
d931104
Merge branch 'master' into submit/8342382-card-table-instead-of-dcq
tschatzl Mar 21, 2025
6d574da
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Mar 26, 2025
51fb6e6
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Apr 1, 2025
27b3dd6
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Apr 4, 2025
1c5a669
* missing file from merge
tschatzl Apr 4, 2025
c5d5f3a
Reorder includes
robcasloz Apr 9, 2025
9481821
Refine needs_liveness_data
robcasloz Apr 9, 2025
855ec8d
Do not unnecessarily pass around tmp2 in x86
robcasloz Apr 9, 2025
d4649ed
* ayang review: revising young gen length
tschatzl Apr 9, 2025
63b1de8
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Apr 10, 2025
39aa903
* fixes after merge related to 32 bit x86 removal
tschatzl Apr 10, 2025
fcf96a2
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Apr 10, 2025
fd77531
* remove support for 32 bit x86 in the barrier generation code, follo…
tschatzl Apr 10, 2025
068d2a3
* indentation fix
tschatzl Apr 10, 2025
e683152
* ayang review (part 1)
tschatzl Apr 11, 2025
a3b2386
* ayang review (part 2 - yield duration changes)
tschatzl Apr 11, 2025
e4bf1ac
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Apr 23, 2025
51dfbe5
Merge branch 'master' into card-table-as-dcq-merge
tschatzl Apr 29, 2025
8b56880
* ayang review: remove sweep_epoch
tschatzl Apr 29, 2025
1def83a
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl May 15, 2025
c07a73d
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Jun 10, 2025
750ed2d
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Jun 27, 2025
441c234
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Jul 7, 2025
5ab928e
Merge branch 'master' into pull/23739
tschatzl Jul 14, 2025
4b21868
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Jul 17, 2025
cea0e1b
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Jul 23, 2025
dd83638
* remove unused G1DetachedRefinementStats_lock
tschatzl Jul 23, 2025
23aa2c8
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Jul 28, 2025
188fc81
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Aug 5, 2025
7fe518e
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Aug 12, 2025
6c88f1d
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Aug 22, 2025
e8a8282
* forgot to actually save the files
tschatzl Aug 22, 2025
cc4b7a0
* fix merge error
tschatzl Aug 22, 2025
4a41b40
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Sep 1, 2025
b3873d6
* commit merge changes
tschatzl Sep 1, 2025
104d506
* improve logging for refinement, making it similar to marking logging
tschatzl Sep 3, 2025
2a614a2
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Sep 4, 2025
4601bf8
* sort includes
tschatzl Sep 8, 2025
87b4136
* iwalulya: remove confusing comment
tschatzl Sep 10, 2025
e7c3a06
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Sep 10, 2025
de1469d
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Sep 10, 2025
d0ca906
* aph review, fix some comment
tschatzl Sep 10, 2025
b47c7b0
* walulyai review
tschatzl Sep 10, 2025
c469c13
* walulyai review
tschatzl Sep 10, 2025
74e9240
* therealaph suggestion for avoiding the register aliasin in gen_writ…
tschatzl Sep 12, 2025
1ced9f9
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Sep 12, 2025
bf8cab3
* iwalulya review
tschatzl Sep 12, 2025
b5d22d5
Merge branch 'master' into 8342382-card-table-instead-of-dcq
tschatzl Sep 22, 2025
53ef008
* improved gen_write_ref_array_post_barrier() for riscv, contributed …
tschatzl Sep 22, 2025
6e37f8d
* iwalulya: "Amount of" -> "Number of" in new flag description
tschatzl Sep 22, 2025
311bb3e
* walulyai: remove cost_per_pending_card_ms_default array since we on…
tschatzl Sep 22, 2025
d80d690
* walulyai: remove unnecessarily introduced newline
tschatzl Sep 22, 2025
3c889e9
* walulyai: bufferNodeList can be removed
tschatzl Sep 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1BarrierSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class G1CardTable;
// removes the need for any fine-grained (per mutator write) synchronization between
// them, keeping the write barrier simple.
//
// The refinement threads mark cards in the the current collection set specially on the
// The refinement threads mark cards in the current collection set specially on the
// card table - this is fine wrt to synchronization with the mutator, because at
// most the mutator will overwrite it again if there is a race, as G1 will scan the
// entire card either way during the GC pause.
Expand Down
6 changes: 6 additions & 0 deletions src/hotspot/share/gc/g1/g1CardTable.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ inline bool G1CardTable::mark_clean_as_from_remset(CardValue* card) {
}

// Returns bits from a where mask is 0, and bits from b where mask is 1.
//
// Example:
// a = 0xAAAAAAAA
// b = 0xBBBBBBBB
// mask = 0xFF00FF00
// result = 0xBBAABBAA
inline size_t blend(size_t a, size_t b, size_t mask) {
return a ^ ((a ^ b) & mask);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1CardTableClaimTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ G1CardTableClaimTable::~G1CardTableClaimTable() {
FREE_C_HEAP_ARRAY(uint, _card_claims);
}

void G1CardTableClaimTable::initialize(size_t max_reserved_regions) {
void G1CardTableClaimTable::initialize(uint max_reserved_regions) {
assert(_card_claims == nullptr, "Must not be initialized twice");
_card_claims = NEW_C_HEAP_ARRAY(uint, max_reserved_regions, mtGC);
_max_reserved_regions = max_reserved_regions;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1CardTableClaimTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class G1HeapRegionClosure;
// Claiming works on full region (all cards in region) or a range of contiguous cards
// (chunk). Chunk size is given at construction time.
class G1CardTableClaimTable : public CHeapObj<mtGC> {
size_t _max_reserved_regions;
uint _max_reserved_regions;

// Card table iteration claim values for every heap region, from 0 (completely unclaimed)
// to (>=) G1HeapRegion::CardsPerRegion (completely claimed).
Expand All @@ -57,7 +57,7 @@ class G1CardTableClaimTable : public CHeapObj<mtGC> {
~G1CardTableClaimTable();

// Allocates the data structure and initializes the claims to unclaimed.
void initialize(size_t max_reserved_regions);
void initialize(uint max_reserved_regions);

void reset_all_claims_to_unclaimed();
void reset_all_claims_to_claimed();
Expand Down
69 changes: 47 additions & 22 deletions src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@
G1ConcurrentRefineWorkState::G1ConcurrentRefineWorkState(uint max_reserved_regions) :
_state(State::Idle),
_refine_work_epoch(0),
_sweep_state(new G1CardTableClaimTable(G1CollectedHeap::get_chunks_per_region_for_merge())),
_sweep_table(new G1CardTableClaimTable(G1CollectedHeap::get_chunks_per_region_for_merge())),
_stats()
{
_sweep_state->initialize(max_reserved_regions);
_sweep_table->initialize(max_reserved_regions);
}

G1ConcurrentRefineWorkState::~G1ConcurrentRefineWorkState() {
delete _sweep_state;
delete _sweep_table;
}

void G1ConcurrentRefineWorkState::set_state_start_time() {
Expand Down Expand Up @@ -264,24 +264,34 @@
return advance_state(State::SnapshotHeap);
}

void G1ConcurrentRefineWorkState::snapshot_heap() {
assert_state(State::SnapshotHeap);
void G1ConcurrentRefineWorkState::snapshot_heap(bool concurrent) {
if (concurrent) {
assert_state(State::SnapshotHeap);

set_state_start_time();
set_state_start_time();
} else {
assert(is_in_progress() && _state < State::SnapshotHeap, "Must be before %s but is %s", state_name(State::SnapshotHeap), state_name(_state));
}

snapshot_heap_into(_sweep_state);
snapshot_heap_into(_sweep_table);

advance_state(State::SweepRT);
if (concurrent) {
advance_state(State::SweepRT);
}
}

bool G1ConcurrentRefineWorkState::sweep_rt_step() {
void G1ConcurrentRefineWorkState::sweep_rt_start() {
assert_state(State::SweepRT);

set_state_start_time();
}

bool G1ConcurrentRefineWorkState::sweep_rt_step() {
assert_state(State::SweepRT);

G1ConcurrentRefine* cr = G1CollectedHeap::heap()->concurrent_refine();

G1ConcurrentRefineWorkTask task(_sweep_state, &_stats, cr->num_threads_wanted());
G1ConcurrentRefineWorkTask task(_sweep_table, &_stats, cr->num_threads_wanted());
cr->run_with_refinement_workers(&task);

if (task.sweep_completed()) {
Expand Down Expand Up @@ -332,18 +342,16 @@
return has_sweep_rt_work;
}

void G1ConcurrentRefineWorkState::snapshot_heap_into(G1CardTableClaimTable* sweep_state) {
sweep_state->reset_all_claims_to_claimed();
void G1ConcurrentRefineWorkState::snapshot_heap_into(G1CardTableClaimTable* sweep_table) {
// G1CollectedHeap::heap_region_iterate() will only visit committed regions. In the
// state table

Check failure on line 347 in src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp

View check run for this annotation

openjdk / jcheck-openjdk/jdk-23739

Whitespace error

Column 16: trailing whitespace
sweep_table->reset_all_claims_to_claimed();

class SnapshotRegionsClosure : public G1HeapRegionClosure {
G1CardTableClaimTable* _sweep_state;
G1CardTableClaimTable* _sweep_table;

public:
size_t _num_clean;
size_t _num_dirty;
size_t _num_to_cset;

SnapshotRegionsClosure(G1CardTableClaimTable* sweep_state) : G1HeapRegionClosure(), _sweep_state(sweep_state), _num_clean(0), _num_dirty(0), _num_to_cset(0) { }
SnapshotRegionsClosure(G1CardTableClaimTable* sweep_table) : G1HeapRegionClosure(), _sweep_table(sweep_table) { }

bool do_heap_region(G1HeapRegion* r) override {
if (!r->is_free()) {
Expand All @@ -352,11 +360,11 @@
// that were allocated before the handshake; the handshake makes such
// regions' metadata visible to all threads, and we do not care about
// humongous regions that were allocated afterwards.
_sweep_state->reset_to_unclaimed(r->hrm_index());
_sweep_table->reset_to_unclaimed(r->hrm_index());
}
return false;
}
} cl(sweep_state);
} cl(sweep_table);
G1CollectedHeap::heap()->heap_region_iterate(&cl);
}

Expand Down Expand Up @@ -391,14 +399,31 @@
return _thread_control.initialize(this);
}

G1ConcurrentRefineWorkState& G1ConcurrentRefine::refine_state_for_merge() {
bool has_sweep_claims = refine_state().complete(false);
if (has_sweep_claims) {
log_debug(gc, refine)("Continue existing work");
} else {
// Refinement has been interrupted without having a snapshot. There may
// be a mix of already swapped and not-swapped card tables assigned to threads,
// so they might have already dirtied the swapped card tables.
// Conservatively scan all (non-free, non-committed) region's card tables,
// creating the snapshot right now.
log_debug(gc, refine)("Create work from scratch");

refine_state().snapshot_heap(false /* concurrent */);
}
return refine_state();
}

void G1ConcurrentRefine::run_with_refinement_workers(WorkerTask* task) {
_thread_control.run_task(task, num_threads_wanted());
}

void G1ConcurrentRefine::notify_region_reclaimed(G1HeapRegion* r) {
assert_at_safepoint();
if (_refine_state.is_in_progress()) {
_refine_state.sweep_state()->claim_all_cards(r->hrm_index());
_refine_state.sweep_table()->claim_all_cards(r->hrm_index());
}
}

Expand Down Expand Up @@ -517,7 +542,7 @@
size_t sampled_code_root_rs_length() const { return _sampled_code_root_rs_length; }
};

// Adjust the target length (in regions) of the young gen, based on the the
// Adjust the target length (in regions) of the young gen, based on the
// current length of the remembered sets.
//
// At the end of the GC G1 determines the length of the young gen based on
Expand Down
11 changes: 7 additions & 4 deletions src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class G1ConcurrentRefineWorkState {
size_t _refine_work_epoch;

// Current heap snapshot.
G1CardTableClaimTable* _sweep_state;
G1CardTableClaimTable* _sweep_table;

// Start times for all states.
Ticks _state_start[static_cast<uint>(State::Last)];
Expand All @@ -140,14 +140,15 @@ class G1ConcurrentRefineWorkState {
bool swap_global_card_table();
bool swap_java_threads_ct();
bool swap_gc_threads_ct();
void snapshot_heap();
void snapshot_heap(bool concurrent = true);
void sweep_rt_start();
bool sweep_rt_step();

bool complete(bool concurrent, bool print_log = true);

static void snapshot_heap_into(G1CardTableClaimTable* sweep_state);
static void snapshot_heap_into(G1CardTableClaimTable* sweep_table);

G1CardTableClaimTable* sweep_state() { return _sweep_state; }
G1CardTableClaimTable* sweep_table() { return _sweep_table; }
G1ConcurrentRefineStats* stats() { return &_stats; }
void reset_stats();

Expand Down Expand Up @@ -231,6 +232,8 @@ class G1ConcurrentRefine : public CHeapObj<mtGC> {

G1ConcurrentRefineWorkState& refine_state() { return _refine_state; }

G1ConcurrentRefineWorkState& refine_state_for_merge();

void run_with_refinement_workers(WorkerTask* task);

void notify_region_reclaimed(G1HeapRegion* r);
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ void G1ConcurrentRefineThread::do_refinement() {

// 5. Sweep refinement table until done
bool interrupted_by_gc = false;

state.sweep_rt_start();
while (true) {
bool completed = state.sweep_rt_step();

Expand Down
56 changes: 18 additions & 38 deletions src/hotspot/share/gc/g1/g1RemSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
class G1RemSetScanState : public CHeapObj<mtGC> {
class G1DirtyRegions;

G1CardTableClaimTable _card_state;
G1CardTableClaimTable _card_claim_table;
// The complete set of regions which card table needs to be cleared at the end
// of GC because we scribbled over these card table entries.
//
Expand Down Expand Up @@ -142,11 +142,11 @@ class G1RemSetScanState : public CHeapObj<mtGC> {
}

void add_dirty_region(uint region) {
if (_contains[region]) {
return;
}
if (_contains[region]) {
return;
}

bool marked_as_dirty = Atomic::cmpxchg(&_contains[region], false, true) == false;
bool marked_as_dirty = Atomic::cmpxchg(&_contains[region], false, true) == false;
if (marked_as_dirty) {
uint allocated = Atomic::fetch_then_add(&_cur_idx, 1u);
_buffer[allocated] = region;
Expand Down Expand Up @@ -234,7 +234,7 @@ class G1ClearCardTableTask : public G1AbstractSubTask {

public:
G1RemSetScanState() :
_card_state(G1CollectedHeap::get_chunks_per_region_for_scan()),
_card_claim_table(G1CollectedHeap::get_chunks_per_region_for_scan()),
_all_dirty_regions(nullptr),
_next_dirty_regions(nullptr),
_scan_top(nullptr) { }
Expand All @@ -243,8 +243,8 @@ class G1ClearCardTableTask : public G1AbstractSubTask {
FREE_C_HEAP_ARRAY(HeapWord*, _scan_top);
}

void initialize(size_t max_reserved_regions) {
_card_state.initialize(max_reserved_regions);
void initialize(uint max_reserved_regions) {
_card_claim_table.initialize(max_reserved_regions);
_scan_top = NEW_C_HEAP_ARRAY(HeapWord*, max_reserved_regions, mtGC);
}

Expand All @@ -253,7 +253,7 @@ class G1ClearCardTableTask : public G1AbstractSubTask {
// become used during the collection these values must be valid
// for those regions as well.
void prepare() {
size_t max_reserved_regions = _card_state.max_reserved_regions();
size_t max_reserved_regions = _card_claim_table.max_reserved_regions();

for (size_t i = 0; i < max_reserved_regions; i++) {
clear_scan_top((uint)i);
Expand All @@ -268,7 +268,7 @@ class G1ClearCardTableTask : public G1AbstractSubTask {
// regions.
//assert(_next_dirty_regions->size() == 0, "next dirty regions must be empty");

_card_state.reset_all_claims_to_unclaimed();
_card_claim_table.reset_all_claims_to_unclaimed();
}

void complete_evac_phase(bool merge_dirty_regions) {
Expand Down Expand Up @@ -331,7 +331,7 @@ class G1ClearCardTableTask : public G1AbstractSubTask {
}

bool has_cards_to_scan(uint region) {
return _card_state.has_unclaimed_cards(region);
return _card_claim_table.has_unclaimed_cards(region);
}

void add_dirty_region(uint const region) {
Expand Down Expand Up @@ -367,7 +367,7 @@ class G1ClearCardTableTask : public G1AbstractSubTask {
}

G1CardTableChunkClaimer claimer(uint region_idx) {
return G1CardTableChunkClaimer(&_card_state, region_idx);
return G1CardTableChunkClaimer(&_card_claim_table, region_idx);
}
};

Expand Down Expand Up @@ -827,20 +827,20 @@ class MergeRefinementTableTask : public WorkerTask {
while (claim.has_next()) {
size_t const start_idx = region_card_base_idx + claim.value();

size_t* card_cur_card = (size_t*)card_table->byte_for_index(start_idx);
size_t* card_cur_word = (size_t*)card_table->byte_for_index(start_idx);

size_t* refinement_cur_card = (size_t*)refinement_table->byte_for_index(start_idx);
size_t* const refinement_end_card = refinement_cur_card + claim.size() / (sizeof(size_t) / sizeof(G1CardTable::CardValue));

for (; refinement_cur_card < refinement_end_card; ++refinement_cur_card, ++card_cur_card) {
for (; refinement_cur_card < refinement_end_card; ++refinement_cur_card, ++card_cur_word) {
size_t value = *refinement_cur_card;
*refinement_cur_card = G1CardTable::WordAllClean;
// Dirty is "0", so we need to logically-and here. This is also safe
// for all other possible values in the card table; at this point this
// can be either g1_dirty_card or g1_to_cset_card which will both be
// scanned.
size_t new_value = *card_cur_card & value;
*card_cur_card = new_value;
size_t new_value = *card_cur_word & value;
*card_cur_word = new_value;
}
}

Expand Down Expand Up @@ -1230,30 +1230,10 @@ class G1MergeHeapRootsTask : public WorkerTask {
static void merge_refinement_table() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();

G1CardTableClaimTable* claim;
G1CardTableClaimTable constructed(G1CollectedHeap::get_chunks_per_region_for_merge());

G1ConcurrentRefineWorkState& state = g1h->concurrent_refine()->refine_state();
bool has_sweep_claims = state.complete(false);
if (has_sweep_claims) {
log_debug(gc, refine)("Continue existing work");
claim = state.sweep_state();
} else {
// Refinement has been interrupted without having a snapshot. There may
// be a mix of already swapped and not-swapped card tables assigned to threads,
// so they might have already dirtied the swapped card tables.
// Conservatively scan all (non-free, non-committed) region's card tables,
// creating the snapshot right now.
log_debug(gc, refine)("Create work from scratch");

constructed.initialize(g1h->max_reserved_regions());
G1ConcurrentRefineWorkState::snapshot_heap_into(&constructed);
claim = &constructed;
}

G1ConcurrentRefineWorkState& state = g1h->concurrent_refine()->refine_state_for_merge();
WorkerThreads* workers = g1h->workers();

MergeRefinementTableTask cl(claim, workers->active_workers());
MergeRefinementTableTask cl(state.sweep_table(), workers->active_workers());
log_debug(gc, ergo)("Running %s using %u workers", cl.name(), workers->active_workers());
workers->run_task(&cl);
}
Expand Down