RFR: 8320826: call allocate_shared_strings_array after all strings are interned
Ioi Lam
iklam at openjdk.org
Thu Nov 30 03:59:04 UTC 2023
On Wed, 29 Nov 2023 19:15:17 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
>> `StringTable::allocate_shared_strings_array()` creates a Java object array that has the exact same size as the number of currently interned strings. Therefore, we need to move it to just before we enter the safepoint, where we know no more Java code would be execute.
>>
>> I also had to change the assert in `StringTable::allocate_shared_strings_array()` to a condition check: it's possible for `HeapShared::init_for_dumping()` to disable heap dumping when a Java agent transforms classes like jdk.internal.math.FDBigInteger.
>
> src/hotspot/share/classfile/stringTable.cpp line 809:
>
>> 807: // to guarantee because CDS runs with a single Java thread. See JDK-8253495.)
>> 808: void StringTable::allocate_shared_strings_array(TRAPS) {
>> 809: if (!CDSConfig::is_dumping_heap()) {
>
> This seems to be redundant considering that `allocate_shared_strings_array()` is only called by `preload_and_dump_impl`. Unless you expect this method to be called elsewhere eventually?
At the point where preload_and_dump_impl() calls allocate_shared_strings_array(), heap dumping may have been disabled. So this check avoids doing unnecessary work for that situation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16839#discussion_r1410125654
More information about the hotspot-runtime-dev
mailing list