Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 12 additions & 9 deletions src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jint G1ConcurrentRefineThreadControl::initialize(G1ConcurrentRefine* cr) {
assert(cr != nullptr, "G1ConcurrentRefine must not be null");
_cr = cr;

if (max_num_threads() > 0) {
if (is_refinement_enabled()) {
_control_thread = create_refinement_thread();
if (_control_thread == nullptr) {
vm_shutdown_during_initialization("Could not allocate refinement control thread");
Expand Down Expand Up @@ -105,19 +105,19 @@ void G1ConcurrentRefineThreadControl::run_task(WorkerTask* task, uint num_worker
}

void G1ConcurrentRefineThreadControl::control_thread_do(ThreadClosure* tc) {
if (_control_thread != nullptr) {
if (is_refinement_enabled()) {
tc->do_thread(_control_thread);
}
}

void G1ConcurrentRefineThreadControl::worker_threads_do(ThreadClosure* tc) {
if (_control_thread != nullptr) {
if (is_refinement_enabled()) {
_workers->threads_do(tc);
}
}

void G1ConcurrentRefineThreadControl::stop() {
if (_control_thread != nullptr) {
if (is_refinement_enabled()) {
_control_thread->stop();
}
}
Expand Down Expand Up @@ -338,8 +338,11 @@ bool G1ConcurrentRefineSweepState::complete_work(bool concurrent, bool print_log
}

void G1ConcurrentRefineSweepState::snapshot_heap_into(G1CardTableClaimTable* sweep_table) {
// G1CollectedHeap::heap_region_iterate() below will only visit committed regions. Initialize
// all entries in the state table here to not require special handling when iterating over it.
// G1CollectedHeap::heap_region_iterate() below will only visit currently committed
// regions. Initialize all entries in the state table here and later in this method
// selectively enable regions that we are interested. This way regions committed
// later will be automatically excluded from iteration.
// Their refinement table must be completely empty anyway.
sweep_table->reset_all_to_claimed();

class SnapshotRegionsClosure : public G1HeapRegionClosure {
Expand All @@ -351,7 +354,7 @@ void G1ConcurrentRefineSweepState::snapshot_heap_into(G1CardTableClaimTable* swe
bool do_heap_region(G1HeapRegion* r) override {
if (!r->is_free()) {
// Need to scan all parts of non-free regions, so reset the claim.
// No need for synchronization: we are only interested about regions
// No need for synchronization: we are only interested in regions
// 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.
Expand Down Expand Up @@ -395,7 +398,7 @@ jint G1ConcurrentRefine::initialize() {
}

G1ConcurrentRefineSweepState& G1ConcurrentRefine::sweep_state_for_merge() {
bool has_sweep_claims = sweep_state().complete_work(false);
bool has_sweep_claims = sweep_state().complete_work(false /* concurrent */);
if (has_sweep_claims) {
log_debug(gc, refine)("Continue existing work");
} else {
Expand Down Expand Up @@ -485,7 +488,7 @@ void G1ConcurrentRefine::adjust_after_gc(double logged_cards_time_ms,
update_pending_cards_target(logged_cards_time_ms,
processed_logged_cards,
goal_ms);
if (_thread_control.max_num_threads() != 0) {
if (_thread_control.is_refinement_enabled()) {
_needs_adjust = true;
if (is_pending_cards_target_initialized()) {
_thread_control.activate();
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class G1ConcurrentRefineThreadControl {
void assert_current_thread_is_control_refinement_thread() const NOT_DEBUG_RETURN;

uint max_num_threads() const { return _max_num_threads; }
bool is_refinement_enabled() const { return _max_num_threads > 0; }

// Activate the control thread.
void activate();
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1ConcurrentRefineWorkTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class G1RefineRegionClosure : public G1HeapRegionClosure {
} else if (res == G1RemSet::AlreadyToCSet) {
*dest_card = G1CardTable::g1_to_cset_card;
_refine_stats.inc_cards_already_refer_to_cset();
} else if (res == G1RemSet::HasToCSetRef) {
} else if (res == G1RemSet::HasRefToCSet) {
*dest_card = G1CardTable::g1_to_cset_card;
_refine_stats.inc_cards_refer_to_cset();
} else if (res == G1RemSet::NoInteresting) {
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/gc/g1/g1OopClosures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,19 @@ class G1RootRegionScanClosure : public ClaimMetadataVisitingOopIterateClosure {
class G1ConcurrentRefineOopClosure: public BasicOopIterateClosure {
G1CollectedHeap* _g1h;
uint _worker_id;
bool _has_to_cset_ref;
bool _has_to_old_ref;
bool _has_ref_to_cset;
bool _has_ref_to_old;

public:
G1ConcurrentRefineOopClosure(G1CollectedHeap* g1h, uint worker_id) :
_g1h(g1h),
_worker_id(worker_id),
_has_to_cset_ref(false),
_has_to_old_ref(false) {
_has_ref_to_cset(false),
_has_ref_to_old(false) {
}

bool has_to_cset_ref() const { return _has_to_cset_ref; }
bool has_to_old_ref() const { return _has_to_old_ref; }
bool has_ref_to_cset() const { return _has_ref_to_cset; }
bool has_ref_to_old() const { return _has_ref_to_old; }

virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }

Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1OopClosures.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ inline static void check_obj_during_refinement(T* p, oop const obj) {
template <class T>
inline void G1ConcurrentRefineOopClosure::do_oop_work(T* p) {
// Early out if we already found a to-young reference.
if (_has_to_cset_ref) {
if (_has_ref_to_cset) {
return;
}

Expand All @@ -152,8 +152,8 @@ inline void G1ConcurrentRefineOopClosure::do_oop_work(T* p) {
}

G1HeapRegion* to_region = _g1h->heap_region_containing(obj);
_has_to_cset_ref = to_region->is_young();
if (_has_to_cset_ref) {
_has_ref_to_cset = to_region->is_young();
if (_has_ref_to_cset) {
return;
}
G1HeapRegionRemSet* to_rem_set = to_region->rem_set();
Expand All @@ -164,7 +164,7 @@ inline void G1ConcurrentRefineOopClosure::do_oop_work(T* p) {

if (from->rem_set()->cset_group() != to_rem_set->cset_group()) {
to_rem_set->add_reference(p, _worker_id);
_has_to_old_ref = true;
_has_ref_to_old = true;
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/hotspot/share/gc/g1/g1Policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,17 @@ class G1Policy: public CHeapObj<mtGC> {

uint _free_regions_at_end_of_collection;

// Tracks the number of cards marked as dirty (only) during garbage collection
// (evacuation) on the card table.
// This is needed to properly account for those cards in the heuristics to start
// refinement at the correct time which needs to know how many cards are currently
// approximately on the card table.
// After the first completed refinement sweep of the refinement table between two
// garbage collections this value is reset to zero as that refinement processed all
// those cards.
size_t _pending_cards_from_gc;
// Tracks the approximate number of cards found as to-collection-set by either the
// garbage collection or the most recent refinement sweep.
size_t _to_collection_set_cards;

G1ConcurrentStartToMixedTimeTracker _concurrent_start_to_mixed;
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1RemSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,10 +1358,10 @@ G1RemSet::RefineResult G1RemSet::refine_card_concurrently(CardValue* const card_

G1ConcurrentRefineOopClosure conc_refine_cl(_g1h, worker_id);
if (r->oops_on_memregion_seq_iterate_careful<false>(dirty_region, &conc_refine_cl) != nullptr) {
if (conc_refine_cl.has_to_cset_ref()) {
return HasToCSetRef;
} else if (conc_refine_cl.has_to_old_ref()) {
return HasToOldRef;
if (conc_refine_cl.has_ref_to_cset()) {
return HasRefToCSet;
} else if (conc_refine_cl.has_ref_to_old()) {
return HasRefToOld;
} else {
return NoInteresting;
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1RemSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ class G1RemSet: public CHeapObj<mtGC> {
G1GCPhaseTimes::GCParPhases objcopy_phase);

enum RefineResult {
HasToCSetRef, // The (dirty) card has a reference to the collection set.
HasRefToCSet, // The (dirty) card has a reference to the collection set.
AlreadyToCSet, // The card is already one marked as having a reference to the collection set.
HasToOldRef, // The dirty cards contains references to other old regions (not the collection set).
HasRefToOld, // The dirty card contains references to other old regions (not the collection set).
NoInteresting, // There is no interesting reference in the card.
CouldNotParse // The card is unparsable, need to retry later.
};
Expand Down