On Sun, 20 Sep 2026 22:21:58 GMT, Vladimir Kozlov <[email protected]> wrote:
>> src/hotspot/share/cds/aotCacheAccess.cpp line 91:
>>
>>> 89:
>>> 90: size_t offset = AOTCompressedPointers::get_byte_offset(narrowp);
>>> 91: if (offset == 0 || offset >
>>> AOTCompressedPointers::MaxMetadataOffsetBytes ||
>>
>> IMO if we want these checks, they should be put in
>> `AOTCompressedPointers::decode/decode_not_null` so that other code in
>> AOTCache is also protected against spurious/corrupted narrowPtr.
>
> I would leave it here since only AOT Code Cache use this.
Other code like `RunTimeClassInfo`, `ReadClosure`, `CompactHashTable` also read
`narrowPtr` to convert to metadata. Other than the `size > (high_offset -
offset)`, rest of the checks should be applicable to these users as well. Let's
ask @iklam about this.
>> src/hotspot/share/ci/ciField.cpp line 373:
>>
>>> 371: return ciConstant();
>>> 372: }
>>> 373: if (CURRENT_ENV->is_aot_compile()) { // Restrict only when we
>>> generate AOT code
>>
>> This check can be moved to the top of the method to avoid executing other
>> code when this condition is true.
>
> I can move it above FoldStableValues check. I see that _constant_value is
> directly accessed in ciField::print(). If I move AOT check to the beginning,
> ciField::print() will produce different output.
>
> Main reason AOT check is placed at the end of these methods is it is true
> only in AOT assembly phase during AOT compilation. I don't want to slow down
> normal execution.
Ok, that makes sense.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30778#discussion_r4063996162
PR Review Comment: https://git.openjdk.org/jdk/pull/30778#discussion_r4064000734