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

Andrew Dinn adinn at openjdk.org
Tue Feb 24 10:06:57 UTC 2026


On Tue, 24 Feb 2026 05:49:53 GMT, Vladimir Kozlov <kvn 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.
>
> src/hotspot/share/code/aotCodeCache.cpp line 1460:
> 
>> 1458:     // n.b. use local as macro consumes arg multiple times
>> 1459:     address to_add = *p++;
>> 1460:     SET_ADDRESS(_extrs, to_add);
> 
> Should we use this local in premain repo too?

Ah, no. That is not actually needed in this PR nor is it yet needed in premain (although it won't do any harm). I'll remove it to avoid confusion.

This change needs to be made in the stub save and restore PR. In that PR macro `SET_ADDRESS` is modified to enter the address into the external addresses array and also cache the address and its index in a hash table which means the macro argument is dereferenced twice.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29884#discussion_r2845785121


More information about the hotspot-dev mailing list