New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8276887: G1: Move precleaning to Concurrent Mark From Roots subphase #6327
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1068,75 +1068,23 @@ void ReferenceProcessor::preclean_discovered_references(BoolObjectClosure* is_al | ||
EnqueueDiscoveredFieldClosure* enqueue, | ||
YieldClosure* yield, | ||
GCTimer* gc_timer) { | ||
// These lists can be handled here in any order and, indeed, concurrently. | ||
Ticks preclean_start = Ticks::now(); | ||
|
||
// Soft references | ||
{ | ||
GCTraceTime(Debug, gc, ref) tm("Preclean SoftReferences", gc_timer); | ||
log_reflist("SoftRef before: ", _discoveredSoftRefs, _max_num_queues); | ||
for (uint i = 0; i < _max_num_queues; i++) { | ||
if (yield->should_return()) { | ||
return; | ||
} | ||
if (preclean_discovered_reflist(_discoveredSoftRefs[i], is_alive, | ||
enqueue, yield)) { | ||
log_reflist("SoftRef abort: ", _discoveredSoftRefs, _max_num_queues); | ||
return; | ||
} | ||
} | ||
log_reflist("SoftRef after: ", _discoveredSoftRefs, _max_num_queues); | ||
} | ||
uint worker_id = WorkerThread::current()->id(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logging is potentially far more verbose than previously, since there will now be a line for each concurrent marking thread, rather than one line for the previously single-threaded precleaning. We have mechanisms for collecting and reporting timing and work units for parallel activities that should be used here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new logs are on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is trace logging, but that doesn't make the verbosity or content good. Consider a machine with a large amount of concurrency; one might be interested in any of the totals/min/max/avg, and having to extract that manually is going to be annoying. I'm okay with it being a followup though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thomas suggested this as well. I will address this in a followup PR. |
||
|
||
// Weak references | ||
{ | ||
GCTraceTime(Debug, gc, ref) tm("Preclean WeakReferences", gc_timer); | ||
log_reflist("WeakRef before: ", _discoveredWeakRefs, _max_num_queues); | ||
for (uint i = 0; i < _max_num_queues; i++) { | ||
if (yield->should_return()) { | ||
return; | ||
} | ||
if (preclean_discovered_reflist(_discoveredWeakRefs[i], is_alive, | ||
enqueue, yield)) { | ||
log_reflist("WeakRef abort: ", _discoveredWeakRefs, _max_num_queues); | ||
return; | ||
} | ||
} | ||
log_reflist("WeakRef after: ", _discoveredWeakRefs, _max_num_queues); | ||
} | ||
size_t soft_count = _discoveredSoftRefs[worker_id].length(); | ||
size_t weak_count = _discoveredWeakRefs[worker_id].length(); | ||
size_t final_count = _discoveredFinalRefs[worker_id].length(); | ||
size_t phantom_count = _discoveredPhantomRefs[worker_id].length(); | ||
|
||
// Final references | ||
{ | ||
GCTraceTime(Debug, gc, ref) tm("Preclean FinalReferences", gc_timer); | ||
log_reflist("FinalRef before: ", _discoveredFinalRefs, _max_num_queues); | ||
for (uint i = 0; i < _max_num_queues; i++) { | ||
if (yield->should_return()) { | ||
return; | ||
} | ||
if (preclean_discovered_reflist(_discoveredFinalRefs[i], is_alive, | ||
enqueue, yield)) { | ||
log_reflist("FinalRef abort: ", _discoveredFinalRefs, _max_num_queues); | ||
return; | ||
} | ||
} | ||
log_reflist("FinalRef after: ", _discoveredFinalRefs, _max_num_queues); | ||
} | ||
preclean_discovered_reflist(_discoveredSoftRefs[worker_id], is_alive, enqueue, yield); | ||
preclean_discovered_reflist(_discoveredWeakRefs[worker_id], is_alive, enqueue, yield); | ||
preclean_discovered_reflist(_discoveredFinalRefs[worker_id], is_alive, enqueue, yield); | ||
preclean_discovered_reflist(_discoveredPhantomRefs[worker_id], is_alive, enqueue, yield); | ||
|
||
// Phantom references | ||
{ | ||
GCTraceTime(Debug, gc, ref) tm("Preclean PhantomReferences", gc_timer); | ||
log_reflist("PhantomRef before: ", _discoveredPhantomRefs, _max_num_queues); | ||
for (uint i = 0; i < _max_num_queues; i++) { | ||
if (yield->should_return()) { | ||
return; | ||
} | ||
if (preclean_discovered_reflist(_discoveredPhantomRefs[i], is_alive, | ||
enqueue, yield)) { | ||
log_reflist("PhantomRef abort: ", _discoveredPhantomRefs, _max_num_queues); | ||
return; | ||
} | ||
} | ||
log_reflist("PhantomRef after: ", _discoveredPhantomRefs, _max_num_queues); | ||
} | ||
log_trace(gc, ref)("Worker (%d): Precleaning Soft (%zu), Weak (%zu), Final (%zu), Phantom (%zu) %f ms", | ||
worker_id, soft_count, weak_count, final_count, phantom_count, | ||
(Ticks::now() - preclean_start).seconds()*1000); | ||
} | ||
|
||
bool ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the name of this confusingly close to
do_marking_step
by the task. I can see how this could be called a "step" with preclean being another (new) step, but I think the confusion with the other function outweighs that and needs a different name here. Maybe justdo_marking
ordo_all_marking
or something like that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to
do_marking
.