RFR: Use method offset as the hash for storing nmethods [v3]

Vladimir Kozlov kvn at openjdk.org
Thu Aug 14 23:44:23 UTC 2025


On Thu, 14 Aug 2025 21:42:46 GMT, Ashutosh Mehra <asmehra 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.
>
> Ashutosh Mehra has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Remove Method* from AOTCodeEntry
>    
>    Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
>  - Fix compile failure
>    
>    Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>

May be `SharedBaseAddress` is not correct to use during assembly phase?

(aotCacheAccess.hpp:79) points to:

  static Method* convert_offset_to_method(uint offset_from_base_addr) {
    Metadata* metadata = (Metadata*)((address)SharedBaseAddress + offset_from_base_addr); <<<<<<< here
    assert(metadata->is_method(), "sanity check");

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

PR Comment: https://git.openjdk.org/leyden/pull/91#issuecomment-3190209664


More information about the leyden-dev mailing list