JDK-8215483 : Off heap memory accesses should be vectorized
Type:Enhancement
Component:hotspot
Sub-Component:compiler
Affected Version:11,12,13
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2018-12-17
Updated:2019-08-15
Resolved:2019-02-05
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
void floss(ByteBuffer b, int n) {
for (int i = 0; i < SIZE; i++) {
b.putInt(i<<2, n);
}
}
for
ByteBuffer buf = ByteBuffer.allocateDirect(SIZE * 4);
is not vectorized but should be.
Comments
Fix request (11u):
Requesting this backport to keep parity with Oracle 11.0.5. Patch applies cleanly. Will be tested @SAP.
24-06-2019
http://cr.openjdk.java.net/~roland/8215483/webrev.00/
Given, in the general case, we have no guarantee on the buffer
alignment, this can only work for architectures that support misaligned
vector accesses. I change Matcher::misaligned_vectors_ok() so it always
reports what the backend is capable of. I'm not sure about ppc: the
comment says misaligned vectors are unsupported but the code uses the
same pattern that x86 or aarch64 use.
My understanding is that the current logic of SWPointer::SWPointer()
doesn't properly handle the case where base and adr differ: there's no
check for whether adr is loop invariant and the code that performs loop
alignment ignores adr. It also seems very rare that adr differs from
base for on heap accesses. Instead of handling this case, my change
makes superword bailout if adr != base unless it's an off heap access
and base == top.
For an off heap access, then SuperWord::align_initial_loop_index() tries
to align the loop the best it can.