[foreign-memaccess+abi] RFR: 8311594: Avoid GlobalSession liveness check [v2]
Jorn Vernee
jvernee at openjdk.org
Mon Jul 10 15:09:56 UTC 2023
> This patch overrides `checkValidStateRaw` in GlobalSession, to do nothing. The current `checkValidStateRaw` in MemorySessionImpl checks the owner thread, and liveness, which are both not needed for the global session.
>
> Since the state field is mutable, I found that the JIT can not fold away the liveness check. This has a very marginal effect on performance, but since the fix is also very non-intrusive, I think it's okay to do.
>
> I've added 2 new benchmarks that I've used to measure the difference. One measures the performance of MS::copy, and the other measures MS::get. Both use a special `ALL` segment which spans `0` to `Long.MAX_VALUE`, which means that the target address can be used as an offset when doing the accesses. This helps the bounds checks being eliminated, and makes the result of overriding `checkValidStateRaw` in GlobalSession easier to see.
>
> Here are some of the interesting numbers:
>
> Before:
>
>
> Benchmark Mode Cnt Score Error Units
> MemorySegmentCopyALL.panama_ALL_to_ALL avgt 30 7.788 ± 0.029 ns/op
> MemorySegmentCopyALL.unsafe_array_to_addr avgt 30 7.543 ± 0.018 ns/op
>
> Benchmark Mode Cnt Score Error Units
> MemorySegmentGet.segment_ALL_unaligned avgt 30 0.486 ± 0.002 ns/op
> MemorySegmentGet.unsafe avgt 30 0.398 ± 0.003 ns/op
>
>
> After:
>
>
> Benchmark Mode Cnt Score Error Units
> MemorySegmentCopyALL.panama_ALL_to_ALL avgt 30 7.571 ± 0.017 ns/op
> MemorySegmentCopyALL.unsafe_array_to_addr avgt 30 7.550 ± 0.019 ns/op
>
> Benchmark Mode Cnt Score Error Units
> MemorySegmentGet.segment_ALL_unaligned avgt 30 0.409 ± 0.002 ns/op
> MemorySegmentGet.unsafe avgt 30 0.397 ± 0.003 ns/op
Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
Add global session polluted benchmark
-------------
Changes:
- all: https://git.openjdk.org/panama-foreign/pull/844/files
- new: https://git.openjdk.org/panama-foreign/pull/844/files/7943fd33..f366dc34
Webrevs:
- full: https://webrevs.openjdk.org/?repo=panama-foreign&pr=844&range=01
- incr: https://webrevs.openjdk.org/?repo=panama-foreign&pr=844&range=00-01
Stats: 6 lines in 1 file changed: 3 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/panama-foreign/pull/844.diff
Fetch: git fetch https://git.openjdk.org/panama-foreign.git pull/844/head:pull/844
PR: https://git.openjdk.org/panama-foreign/pull/844
More information about the panama-dev
mailing list