RFR: 8331087: Move immutable nmethod data from CodeCache [v2]

Vladimir Kozlov kvn at openjdk.org
Sun Apr 28 23:45:08 UTC 2024


On Sun, 28 Apr 2024 23:37:22 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Move immutable nmethod's data from CodeCache to C heap. It includes `dependencies, nul_chk_table, handler_table, scopes_pcs, scopes_data, speculations, jvmci_data`. It amounts for about 30% (optimized VM) of space in CodeCache.
>> 
>> Use HotSpot's `os::malloc()` to allocate memory in C heap for immutable nmethod's data. Bail out compilation if allocation failed.
>> 
>> Shuffle fields order and change some fields size from 4 to 2 bytes to avoid nmethod's header size increase.
>> 
>> Tested tier1-5, stress,xcomp
>> 
>> Our performance testing does not show difference.
>> 
>> Example of updated `-XX:+PrintNMethodStatistics` output is in JBS comment.
>
> Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address comments. Moved jvmci_data back to mutable data section.

Update:
1. Addressed @dean-long first comments.
2. Based on discussion with Doug and Tom (see comments in [JDK-8331087](https://bugs.openjdk.org/browse/JDK-8331087)), moved `jvmci_data` back to nmethod's mutable data section.
3. Replaced my allocation failure handling code with call to `vm_exit_out_of_memory()`.

    I verified (with `UseNewCode` hack`) that out of memory is correctly reported in fastdebug and product VMs:

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 64 bytes. Error detail: nmethod: no space for immutable data
# An error report file with more information is saved as:
# /scratch/kvn/jdk_git/hs_err_pid4086275.log

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

PR Comment: https://git.openjdk.org/jdk/pull/18984#issuecomment-2081701059


More information about the serviceability-dev mailing list