Integrated: 8343394: Make MemorySessionImpl.state a stable field

Quan Anh Mai qamai at openjdk.org
Thu Nov 7 14:35:10 UTC 2024


On Thu, 31 Oct 2024 15:52:04 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

> Hi,
> 
> This patch makes `MemorySessionImpl.state` a `Stable` field so that liveness check of non-closeable scopes such as the global scope can be elided.
> 
> Currently, the `state` field is overloaded with 2 responsibilities, to act as a communication device between `close` and `checkValidState`, as well as a communication device between `close`, `acquire`, and `release`. This patch separates those concerns into `state` and `acquireCount`, allowing `state` to be marked as `@Stable`.
> 
> With the patch, in `MemorySegmentGetUnsafe`, `panama` is able to be on par with `unsafe`:
> 
>     Benchmark                      Mode  Cnt  Score   Error  Units
>     MemorySegmentGetUnsafe.panama  avgt   30  0.340 ± 0.008  ns/op
>     MemorySegmentGetUnsafe.unsafe  avgt   30  0.332 ± 0.004  ns/op
> 
> For reference this is the results without this patch:
> 
>     Benchmark                      Mode  Cnt  Score   Error  Units
>     MemorySegmentGetUnsafe.panama  avgt   30  0.420 ± 0.019  ns/op
>     MemorySegmentGetUnsafe.unsafe  avgt   30  0.329 ± 0.003  ns/op
> 
> Please kindly review, thanks very much.

This pull request has now been integrated.

Changeset: 1d117f65
Author:    Quan Anh Mai <qamai at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1d117f65f06456ae571aecc146542c2f79d402cf
Stats:     267 lines in 7 files changed: 224 ins; 17 del; 26 mod

8343394: Make MemorySessionImpl.state a stable field

Co-authored-by: Maurizio Cimadamore <mcimadamore at openjdk.org>
Reviewed-by: mcimadamore, jvernee

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

PR: https://git.openjdk.org/jdk/pull/21810


More information about the core-libs-dev mailing list