[foreign-memaccess+abi] RFR: 8278151: Heap segments should handle alignment constraints in a deterministic fashion [v2]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Thu Dec 2 15:08:38 UTC 2021
On Thu, 2 Dec 2021 14:55:48 GMT, Radoslaw Smogura <duke at openjdk.java.net> wrote:
>> src/java.base/share/classes/java/lang/invoke/X-VarHandleMemoryAccess.java.template line 119:
>>
>>> 117: long address = base + offset;
>>> 118: long maxAlignMask = bb.maxAlignMask();
>>> 119: if (skipAlignmentMaskCheck && maxAlignMask == 0) {
>>
>> I've got minor comment. I wonder if we can skip `skipAlignmentMaskCheck` parameter and just base on `maxAlignMask`
>
> Sorry, it was stupid question. Please ignore
No problem - this is quite tricky. In general, `skipAlignmentMaskCheck` still does _something_ when accessing native segments (as the max align mask is zero there), but in general you are morally correct in observing that it's less useful than it used to be. My hope is that with the right VM fixes, we can get rid of `skipAlignmentMaskCheck` completely, and simplify all this.
For the records, the difference between unaligned and aligned access is as follows:
Benchmark Mode Cnt Score Error Units
LoopOverNonConstant.segment_loop_instance avgt 30 0.229 ? 0.002 ms/op
LoopOverNonConstant.segment_loop_instance_aligned avgt 30 0.335 ? 0.001 ms/op
It's not terrible, but could of course be better.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/622
More information about the panama-dev
mailing list