On Wed, 9 Sep 2026 09:40:23 GMT, Per Minborg <[email protected]> wrote:

>> This PR proposes to improve the performance of the newly integrated confined 
>> arena cache. Confined arenas now remember the platform pool array and the 
>> pool array index used for pool acquisition. Upon closing the arena, the pool 
>> can be returned (in most cases) directly to the correct index in the 
>> confined arena cache.
>> 
>> If the opportunistic pool index is occupied, the logic falls back to the 
>> regular path, which scans the array for an empty slot.
>> 
>> The PR additionally proposes to add a test to make sure the unusual release 
>> path works correctly. 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Per Minborg has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Use int for poolSp

src/java.base/share/classes/jdk/internal/foreign/ArenaImpl.java line 74:

> 72:         // This field is set at most once but its content can change 
> arbitarly so it
> 73:         // cannot be @Stable
> 74:         private long[] poolCache;

This field could be made `@Stable` if its type is widened to `Object` (and then 
casts to `long[]` are introduced at use sites).

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

Also, maybe `@Stable` should be split into `@StableField` and `@StableArray` to 
support use cases such as this one.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32766#discussion_r3994734318

Reply via email to