RFR: 8373794: Move nmethod header from CodeCache

Vladimir Kozlov kvn at openjdk.org
Wed Feb 11 18:18:42 UTC 2026


On Thu, 18 Dec 2025 17:15:35 GMT, Mikhail Ablakatov <mablakatov 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.
>
>> 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?

@mikabl-arm do you have any performance results to show effect of these changes? You added a lot of indirect loads.

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

PR Comment: https://git.openjdk.org/jdk/pull/28866#issuecomment-3886114645


More information about the serviceability-dev mailing list