RFR: 8377554: Load card table base and other values via AOTRuntimeConstants in AOT code [v7]
Andrew Dinn
adinn at openjdk.org
Thu Feb 26 15:23:47 UTC 2026
On Wed, 25 Feb 2026 19:11:28 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Andrew Dinn has updated the pull request incrementally with one additional commit since the last revision:
>>
>> allow for fake RawPtr ConP addresses
>
> Okay, I will start new testing.
@vnkozlov
> Interesting. In premain we don't have special case for external address constant load. I think C2 will put relocation there already. That is why we have change in type.hpp. Please, look on PrintOptoAssembly without and with you special code for external address.
> Or any other external constant for which C2 use RAW address. I am still puzzled why we do not see issues in premain without your special lea() code for external address.
Well, the first thing I spotted is that this is only ever happening with a raw ptr for the card table base. So, we don't actually encounter this case when we are dumping AOT code.
However, to answer your questions: I stepped through my lea code and found that there is no existing relocation. `lea` was adding a reloc for the supplied `ExternalAddress` and the offset from the previous reloc was always positive (i.e. this was not a duplicate).
The thing I missed is that `lea`, `mov` and `adrp` all insert a relocation. It is not obvious but that happens because there is an implicit constructor being employed in those last two cases. The masm methods are declared as `MacroAssembler::mov(Register r, Address dest)` and `MacroAssembler::adrp(Register r, const Address& dest, uint64_t& offset)`. So, the `con` which is of type `address` is used to construct an `Address` argument. Class `Address` includes this declaration:
Address(address target, relocInfo::relocType rtype = relocInfo::external_word_type);
I have reverted the code to what you have in premain.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29884#issuecomment-3967286819
More information about the hotspot-dev
mailing list