RFR: 8343394: Make MemorySessionImpl.state a stable field [v4]

Quan Anh Mai qamai at openjdk.org
Fri Nov 1 02:44:15 UTC 2024


> 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.

Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:

  wait for the close operation to complete on acquire failures

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21810/files
  - new: https://git.openjdk.org/jdk/pull/21810/files/ab787c94..29047718

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21810&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21810&range=02-03

  Stats: 14 lines in 2 files changed: 10 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/21810.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21810/head:pull/21810

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


More information about the core-libs-dev mailing list