[foreign-memaccess+abi] Integrated: 8313005: Ensure native access check can fold away
Jorn Vernee
jvernee at openjdk.org
Tue Jul 25 21:35:11 UTC 2023
On Tue, 25 Jul 2023 18:13:12 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> This patch helps to ensure that native access checks done by restricted methods can completely fold away (see JBS for details).
>
> This is accomplished by:
> 1. Marking the `module` field of `java.lang.Class` `@Stable`
> 2. Using a constant `JavaLangAccess` instance.
>
> I've also added 2 new benchmarks that show the improvement (in two separate classes so that the benchmark methods in each class are comparable to each other in terms of numbers).
>
> Numbers on my machine are as follows:
>
> Before:
>
> Benchmark Mode Cnt Score Error Units
> MemorySegmentGetUnsafe.panama avgt 30 0.817 ± 0.002 ns/op
> MemorySegmentGetUnsafe.unsafe avgt 30 0.400 ± 0.003 ns/op
>
> MemorySegmentCopyUnsafe.panama avgt 30 8.145 ± 0.016 ns/op
> MemorySegmentCopyUnsafe.unsafe avgt 30 7.744 ± 0.012 ns/op
>
>
> After:
>
> Benchmark Mode Cnt Score Error Units
> MemorySegmentGetUnsafe.panama avgt 30 0.411 ± 0.002 ns/op
> MemorySegmentGetUnsafe.unsafe avgt 30 0.404 ± 0.003 ns/op
>
> MemorySegmentCopyUnsafe.panama avgt 30 7.737 ± 0.013 ns/op
> MemorySegmentCopyUnsafe.unsafe avgt 30 7.728 ± 0.011 ns/op
This pull request has now been integrated.
Changeset: d8195d37
Author: Jorn Vernee <jvernee at openjdk.org>
URL: https://git.openjdk.org/panama-foreign/commit/d8195d37ae475dfeac61528d25d5d5393049524e
Stats: 176 lines in 4 files changed: 175 ins; 0 del; 1 mod
8313005: Ensure native access check can fold away
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.org/panama-foreign/pull/851
More information about the panama-dev
mailing list