[foreign-memaccess+abi] RFR: Performance improvement to unchecked segment ofNativeRestricted [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Jan 18 10:59:50 UTC 2021


On Sat, 16 Jan 2021 20:36:05 GMT, Radoslaw Smogura <github.com+7535718+rsmogura at openjdk.org> wrote:

>  could not find such optimization in case of global segment and long numbers.

The optimization happens on segment construction - if the segment size is < Integer.MAX_VALUE, the AbstractMemorySegment::defaultAccessMode method appends the SMALL flag to the set of segment flags. This flag is then consulted many times, typically before long addition/multiplications have to be performed.
> 
> From the other hand I have put together this PR and previous with Unsafe access, disabled alignment checks by settings alignment to 1, and global memory segment rocks. I added benchmark method to show performance of it.

Alignment check is an outstanding issue for the API - hotspot doesn't optimize those very well. See also:

https://mail.openjdk.java.net/pipermail/panama-dev/2021-January/011794.html

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

PR: https://git.openjdk.java.net/panama-foreign/pull/437


More information about the panama-dev mailing list