RFR: 8373794: Move nmethod header from CodeCache
Mikhail Ablakatov
mablakatov at openjdk.org
Thu Dec 18 17:18:41 UTC 2025
On Thu, 18 Dec 2025 02:23:43 GMT, Dean Long <dlong at openjdk.org> wrote:
> Wouldn't it be better to move the whole CodeBlob header out of the code cache? Instead of nmethod having a _hdr pointer, CodeBlob would be in malloc space and have a _code pointer into the CodeCache.
It might be possible to move both `CodeBlob` and `nmethod` data to the C-heap. We'd still need something like an `_hdr` pointer, since JVM resolves a `CodeBlob` from a method/stub entry point using [`CodeBlob* CodeCache::find_blob(void* start)`](https://github.com/openjdk/jdk/blob/7a7e7c9ae11cb124c14d5d2d3b7e2f5649205106/src/hotspot/share/code/codeCache.cpp#L640). So if we move every member field to the C-heap, we store a pointer to that data right before a method/stub entry point in the CodeCache and that's it. A `_code` pointer pointing from the C-heap into the CodeCache may not be necessary at all.
That said, this would require moving data for other `CodeBlob` subclasses (`AdapterBlob`, `ExceptionBlob`, etc.) to the C-heap, which would significantly broaden the scope of this patch.
@Bhavana-Kilambi , what do you thing? Is this something you've considered?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28866#issuecomment-3671287737
More information about the serviceability-dev
mailing list