[foreign-memaccess+abi] RFR: Check for mixed access - remove mem barriers
Paul Sandoz
psandoz at openjdk.java.net
Mon Jul 26 16:31:02 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
That's a neat trick, but it will not work if the heap buffer is read only. But you could extract the array (or base) using unsafe access.
It would be preferable if we can tunnel this through the intrinsic, rather than branching on buffer state. VarHandle buffer/segment accessors uniformly go through unsafe for heap and direct. So in theory it should be possible for intrinsic vector access to achieve the same degree of functionality as intrinsic unsafe access.
(Note that for any integration we need to push first to the `panama-vector/vectorIntrinsics` branch)
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/573
More information about the panama-dev
mailing list