[foreign-memaccess+abi] RFR: Check for mixed access - remove mem barriers
Radoslaw Smogura
github.com+7535718+rsmogura at openjdk.java.net
Wed Jul 28 21:02:52 UTC 2021
On Sat, 24 Jul 2021 16:07:09 GMT, Radoslaw Smogura <github.com+7535718+rsmogura at openjdk.org> wrote:
> That's for previous PR, which I destroyed with bad merge from master.
>
> I wonder if this can look like this?
>
>
> Benchmark (size) Mode Cnt Score Error Units
> ByteBufferVectorAccess.directBuffers 1024 avgt 10 27.119 ? 0.186 ns/op
> ByteBufferVectorAccess.heapBuffers 1024 avgt 10 28.501 ? 0.118 ns/op
> ByteBufferVectorAccess.pollutedBuffers 1024 avgt 10 64.354 ? 27.778 ns/op
> Finished running test 'micro:ByteBufferVectorAccess'
>
>
> https://github.com/openjdk/panama-foreign/pull/566
For polluted case, i think: Scoped memory access have two paths for storing vectors, one producing byte[] result one raw, those are merged together to all mem. The load in loop takes this.
As a consequence loop can't be optimized at all (it effectively works like mem barrier), so even loop limit gets executed with every loop cycle. I think this is more generic JIT case - probably worth investigating as I guess similar case can be produced not only for vectors.
However normal cases works better.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/573
More information about the panama-dev
mailing list