RFR: 8331087: Move immutable nmethod data from CodeCache

Dean Long dlong at openjdk.org
Sat Apr 27 00:05:12 UTC 2024


On Fri, 26 Apr 2024 21:36:50 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.
>
> src/hotspot/share/code/nmethod.cpp line 117:
> 
>> 115:   result = static_cast<T>(thing); \
>> 116:   assert(static_cast<int>(result) == thing, "failed: %d != %d", static_cast<int>(result), thing);
>> 117: 
> 
> I replaced `checked_cast<>()` with this macro because of next issues:
>  - The existing assert points to `utilities/checkedCast.hpp` file where this method is located and not where failed cast. It does not help when it is used several times in one method (for example, in `nmethod()` constructors).
>  - The existing assert does not print values

I thought @kimbarrett had a draft PR to address the error reporting issue, but I can't seem to find it.  To solve the general problem, I think we need a version of vmassert() that takes `char* file, int lineno` as arguments, and a macro wrapper for checked_cast() that passes `__FILE__` and `__LINEN__` from the caller.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18984#discussion_r1581628786


More information about the serviceability-dev mailing list