RFR: 8358680: AOT cache creation fails: no strings should have been added [v3]

Coleen Phillimore coleenp at openjdk.org
Wed Jul 2 11:30:40 UTC 2025


On Tue, 1 Jul 2025 18:26:57 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Background: when writing the string table in the AOT cache, we do this:
>> 
>> 1. Find out the number of strings in the interned string table
>> 2. Allocate Java object arrays that are large enough to store these strings. These arrays are used by `StringTable::lookup_shared()` in the production run.
>> 3. Enter safepoint
>> 4. Copy the strings into the arrays
>> 
>> This bug happened because:
>> 
>> - Step 1 is not thread safe, so it may be reading a stale version of `_items_count`
>> - JIT compiler threads may create more interned strings after step 1
>> 
>> This PR attempts to fix both issues.
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use bool for _disable_interning_during_cds_dump

This looks good.  Couple of simple suggestions and I'll reapprove.

src/hotspot/share/classfile/stringTable.cpp line 951:

> 949: }
> 950: 
> 951: // This is called BEFORE we enter the CDS safepoint. We can allocate still Java object arrays to

Suggestion:

// This is called BEFORE we enter the CDS safepoint. We can still allocate Java object arrays to

src/hotspot/share/classfile/stringTable.cpp line 960:

> 958:   CompileBroker::wait_for_no_active_tasks();
> 959: 
> 960:   precond(THREAD->is_Java_thread());

Suggestion:



If it's TRAPS and THREAD it is a JavaThread now.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25816#pullrequestreview-2978765132
PR Review Comment: https://git.openjdk.org/jdk/pull/25816#discussion_r2179802493
PR Review Comment: https://git.openjdk.org/jdk/pull/25816#discussion_r2179804244


More information about the hotspot-dev mailing list