RFR: 8368954: G1: Document why G1 uses TLS storage for the current card table reference
Thomas Schatzl
tschatzl at openjdk.org
Tue Sep 30 15:50:24 UTC 2025
On Tue, 30 Sep 2025 15:18:51 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> Hi all,
>>
>> please review some documentation update why G1 now uses TLS storage to get the current card table base value for the card mark.
>>
>> TLDR: it's the overall fastest currently available way.
>>
>> Testing: local compilation, this is just a trivial documentation change.
>>
>> Thanks,
>> Thomas
>
> src/hotspot/share/gc/g1/g1ThreadLocalData.hpp line 46:
>
>> 44: // way for fast access to this value in the barrier.
>> 45: // E.g. embedding an address to that value directly into the code stream similar
>> 46: // to Serial/Parallel and then loading from that was found to be slower at least
>
> Not sure if I misunderstood this text or not, but Serial/Parallel doesn't embed the "address" into the code stream -- they embed the actual value in the code stream, since the value (card-tabe-base) is constant. G1 can't/doesn't do that, since card-table-base is not constant.
But G1 can embed the address of the value in the code stream, similar to Serial/Parallel (which embed the actual base address). The emphasis should be on the embedding, not what is embedded.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27573#discussion_r2392088099
More information about the hotspot-gc-dev
mailing list