RFR: 8364929: Assign unique id to each AdapterBlob stored in AOTCodeCache [v4]
Ashutosh Mehra
asmehra at openjdk.org
Thu Oct 2 19:40:32 UTC 2025
On Thu, 2 Oct 2025 18:54:57 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Replace overflow check if guarantee statement
>>
>> Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
>
> src/hotspot/share/runtime/sharedRuntime.cpp line 2605:
>
>> 2603: AdapterHandlerEntry* AdapterHandlerLibrary::new_entry(AdapterFingerPrint* fingerprint) {
>> 2604: uint id = (uint)AtomicAccess::add((int*)&_id_counter, 1);
>> 2605: guarantee(id > 0, "id_counter overflow");
>
> I think we can even change this to an assert. We limit the AOT metaspace size to `UnscaledClassSpaceMax` which is 4GB.
>
> https://github.com/openjdk/jdk/blob/1d55adee11fc2fdbf2e009e1308b763fd7217dad/src/hotspot/share/cds/aotMetaspace.cpp#L304C24-L304C45
>
> All AOT methods would have to live within the AOT metaspace , so we will have much fewer than 2^32 methods, which means will we have much fewer than 2^32 signatures. So the `id` will never overflow. Maybe change this to:
>
>
> assert(id > 0, "we can never overflow because AOT cache cannot contain more than 2^32 methods");
Changed it to assert as suggested
> src/hotspot/share/runtime/sharedRuntime.hpp line 687:
>
>> 685:
>> 686: private:
>> 687: uint _id;
>
> This can be moved near `_linked` so it can fit in the existing unused padding.
Good point. Done.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27553#discussion_r2399881707
PR Review Comment: https://git.openjdk.org/jdk/pull/27553#discussion_r2399882092
More information about the hotspot-dev
mailing list