RFR: Use method offset nmethods hash
Vladimir Kozlov
kvn at openjdk.org
Thu Aug 14 00:43:27 UTC 2025
On Thu, 14 Aug 2025 00:08:57 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Currently AOTCodeEntry for nmethod uses a hash obtained from the method holder's name, method name and signature. This is not very reliable. With https://github.com/openjdk/leyden/pull/90, AOTCodeEntry is always linked to its corresponding Method, so we should be able to use the Method pointer as the hash for AOTCodeEntries for nmethod. However, the problem with pointers are not stable across runs. So instead of the pointer, we can use the offset of the Method in AOTCache. This should work because the Method is guaranteed to be in AOTCache.
>> This PR updates the code to use Method offset as the hash for AOTCodeEntries for nmethods.
>
> src/hotspot/share/code/aotCodeCache.cpp line 934:
>
>> 932: log_info(aot, codecache, nmethod)("Missing entry for '%s' (comp_level %d, hash: " UINT32_FORMAT_X_0 ")", target_name, (uint)comp_level, hash);
>> 933: #ifdef ASSERT
>> 934: } else if (method() != entry->method()) {
>
> As you said we can't use pointers (base could be different).
> I suggest to keep original code here.
May be add `assert(entry->id() == hash`
-------------
PR Review Comment: https://git.openjdk.org/leyden/pull/91#discussion_r2274936484
More information about the leyden-dev
mailing list