RFR(S): 8215483: Off heap memory accesses should be vectorized

Roland Westrelin rwestrel at redhat.com
Tue Dec 18 14:39:31 UTC 2018


http://cr.openjdk.java.net/~roland/8215483/webrev.00/

The goal of this change is to vectorize loops like:

void floss(ByteBuffer b, int n) { 
    for (int i = 0; i < SIZE; i++) { 
        b.putInt(i<<2, n); 
    } 
}

for buffers allocated with:

ByteBuffer buf = ByteBuffer.allocateDirect(SIZE * 4);

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.

Roland.


More information about the hotspot-compiler-dev mailing list