RFR: 8368954: G1: Document why G1 uses TLS storage for the current card table reference

Albert Mingkun Yang ayang at openjdk.org
Tue Sep 30 15:21:06 UTC 2025


On Tue, 30 Sep 2025 11:27:46 GMT, Thomas Schatzl <tschatzl 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.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27573#discussion_r2391992400


More information about the hotspot-gc-dev mailing list