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

Ioi Lam iklam at openjdk.org
Tue Jul 1 18:26:58 UTC 2025


On Fri, 27 Jun 2025 16:01:19 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge branch 'master' into 8358680-aot-cache-creation-fails-with-no-strings-should-have-been-added
>  - @coleenp comment: change items_count() to items_count_acquire()
>  - 8358680: AOT cache creation fails: no strings should have been added

> Atomics are supposed to work with bool

I updated the code to use `bool` instead. What I did wrong was I used `0` instead of `false, and the templates didn't like it.


Atomic::release_store(&_disable_interning_during_cds_dump, 0)

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

PR Comment: https://git.openjdk.org/jdk/pull/25816#issuecomment-3025089027


More information about the hotspot-dev mailing list