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

Ioi Lam iklam at openjdk.org
Thu Jul 3 15:34:55 UTC 2025


On Wed, 18 Jun 2025 17:27:29 GMT, Aleksey Shipilev <shade 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.
>
> I still dislike hooking up to compiler infrastructure to figure out if something is adding interned strings. I really, really dislike the divergence we would introduce with JDK 25 -> JDK 26 once a variant of [JDK-8357473](https://bugs.openjdk.org/browse/JDK-8357473) lands in mainline. I cannot yet think of better solution though, let me think about it some more. At very least we need to get the sequencing of patches right...

Thanks @shipilev @coleenp for the review

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

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


More information about the hotspot-dev mailing list