[vector] RFR (XS): Missing memory barriers in LibraryCallKit::inline_vector_mem_operation()
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Wed Feb 20 22:10:23 UTC 2019
http://cr.openjdk.java.net/~vlivanov/panama/vector/membar/webrev.00/
Memory accesses with nullable base need memory barriers around them.
Otherwise, stale values can be see since C2 converts them to raw pointers.
In my case, it manifested as spurious default values (all-0s) from
Vector.defaultReinterpret():
<F> Vector<F> defaultReinterpret(Species<F> s) {
int blen = Math.max(s.bitSize(), this.species().bitSize()) /
Byte.SIZE;
ByteBuffer bb =
ByteBuffer.allocate(blen).order(ByteOrder.nativeOrder());
this.intoByteBuffer(bb, 0);
return s.fromByteBuffer(bb, 0);
}
Problematic access came from fromByteBuffer() where ByteBuffer.hb can be
null (for off-heap buffers):
public ByteMaxVector fromByteBuffer(ByteBuffer bb, int ix) {
...
return VectorIntrinsics.load(ByteMaxVector.class, byte.class,
LENGTH,
U.getReference(bb, BYTE_BUFFER_HB), ...
Best regards,
Vladimir Ivanov
More information about the panama-dev
mailing list