RFR: 8371783: Refactor GCCause in VM_CollectForMetadataAllocation
Albert Mingkun Yang
ayang at openjdk.org
Wed Nov 19 12:00:24 UTC 2025
On Thu, 13 Nov 2025 10:08:36 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:
> Hello,
>
> We should improve how we use and set GCCause in VM_CollectForMetadataAllocation to make it more clear when reading the code what is going on.
>
> When constructing a VM_CollectForMetadataAllocation operation, we pass in a GCCause, which is not always the cause that is used, since we might also have to clear soft references as a last resort if earlier collection attemps is not enough to free up memory.
>
> The GCCauseSetter at the start of this operation is also redundant as subsequent calls to initiate a GC set the cause themselves.
>
> Testing:
> * Oracle's tier1-3
src/hotspot/share/gc/shared/gcVMOperations.cpp line 210:
> 208: SvcGCMarker sgcm(SvcGCMarker::FULL);
> 209:
> 210: CollectedHeap* heap = Universe::heap();
This `heap` var can be moved down now, I think.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28287#discussion_r2541693878
More information about the hotspot-gc-dev
mailing list