RFR: 8377554: Load card table base and other values via AOTRuntimeConstants in AOT code [v4]

Erik Österlund eosterlund at openjdk.org
Tue Feb 24 18:36:29 UTC 2026


On Tue, 24 Feb 2026 16:33:06 GMT, Andrew Dinn <adinn at openjdk.org> wrote:

>> Generated stubs and nmethods embed some runtime-derived constants, such as the card table base, directly into code as instruction operands. AOT code generation cannot rely on these constants being valid between the assembly run and a production run and adjusting the constants at load time is not currently supported. So, instead AOT generation must employ code which loads the constants from a table whose address can be relocated at load time.
>
> Andrew Dinn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix header issue

Changes requested by eosterlund (Reviewer).

src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp line 150:

> 148: #if INCLUDE_CDS
> 149:   if (AOTCodeCache::is_on_for_dump()) {
> 150:     __ movptr(rscratch, ExternalAddress(AOTRuntimeConstants::card_table_address()));

Note that it seems like you are loading what we call the "card table base", which is not the same thing as the "card table address". The base is a shifted and biased number related to the address as an optimization trick, but is not dereferenceable, for example. The address is where the table starts (the address of the first byte of the card table).

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

PR Review: https://git.openjdk.org/jdk/pull/29884#pullrequestreview-3849826443
PR Review Comment: https://git.openjdk.org/jdk/pull/29884#discussion_r2848891565


More information about the hotspot-dev mailing list