RFR: Use method offset as the hash for storing nmethods
Vladimir Kozlov
kvn at openjdk.org
Thu Aug 14 13:10:39 UTC 2025
On Wed, 13 Aug 2025 22:20:37 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.
@ashu-mehra it looks like we don't need `AOTCodeEntry::_method` anymore since you are saving offset as hash in `_id` field. We can always reconstruct `method*` where it is needed. Which is now only in `invalidate_entry()` since you need only offset in `find_entry()`.
And may be few places where we do printing.
-------------
PR Comment: https://git.openjdk.org/leyden/pull/91#issuecomment-3188393036
PR Comment: https://git.openjdk.org/leyden/pull/91#issuecomment-3188395577
More information about the leyden-dev
mailing list