RFR: 8364638: Refactor and make accumulated GC CPU time code generic [v10]
Jonas Norlinder
duke at openjdk.org
Tue Aug 19 15:56:39 UTC 2025
On Tue, 19 Aug 2025 14:57:51 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> The motivation to move into `CollectedHeap::before_exit` is that now we finally have a specific method that is called for GC activites during exit so there is no need to conflate java.cpp with these tasks.
>>
>>> this calls back to Universe
>>
>> It called back to Universe in java.cpp too. Maybe you would want `Universe::print_on` to be refactored into CollectedHeap too? If that's the case maybe we should save that for a separate issue.
>>
>> > CLDG printing is not necessarily tired to heap
>>
>> That could be so, but it is put under `gc+exit` tag. Are you suggesting that we should break this apart and do it under another tag?
>
>> now we finally have a specific method that is called for GC activites...
>
> Then, it should be in `Universe::before_exit`, not inside heap.
FWIW; `Universe::print_on` do actually call collected heap as well.
void Universe::print_on(outputStream* st) {
GCMutexLocker hl(Heap_lock); // Heap_lock might be locked by caller thread.
st->print_cr("Heap");
StreamIndentor si(st, 1);
heap()->print_heap_on(st);
MetaspaceUtils::print_on(st);
}
I would be OK with moving it to `Universe::before_exit` and I can see the argument that the log message is conflated with components that are not strictly GC. That being said, I think it would also make sense from a code perspective to put it under GC as the log tag is defined to be GC. The best solution would probably be to redefine the log tags and break the block apart, but that would be out-of-scope for this PR. I'll wait for @kstefanj input before proceeding.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26621#discussion_r2285690897
More information about the hotspot-dev
mailing list