< prev index next >

src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template

Print this page
rev 57244 : [mq]: 8234049_v3

*** 22,31 **** --- 22,33 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package java.lang.invoke; + import jdk.internal.access.JavaNioAccess; + import jdk.internal.access.SharedSecrets; import jdk.internal.misc.Unsafe; import jdk.internal.util.Preconditions; import jdk.internal.vm.annotation.ForceInline; import java.nio.ByteBuffer;
*** 36,45 **** --- 38,49 ---- #warn final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { + static JavaNioAccess nioAccess = SharedSecrets.getJavaNioAccess(); + static final int ALIGN = $BoxType$.BYTES - 1; #if[floatingPoint] @ForceInline static $rawType$ convEndian(boolean big, $type$ v) {
*** 527,544 **** return accessMode.at.accessModeType(ByteBuffer.class, $type$.class, int.class); } @ForceInline static int index(ByteBuffer bb, int index) { return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); } @ForceInline static int indexRO(ByteBuffer bb, int index) { if (UNSAFE.getBoolean(bb, BYTE_BUFFER_IS_READ_ONLY)) throw new ReadOnlyBufferException(); ! return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); } @ForceInline static long address(ByteBuffer bb, int index) { long address = ((long) index) + UNSAFE.getLong(bb, BUFFER_ADDRESS); --- 531,549 ---- return accessMode.at.accessModeType(ByteBuffer.class, $type$.class, int.class); } @ForceInline static int index(ByteBuffer bb, int index) { + nioAccess.checkSegment(bb); return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); } @ForceInline static int indexRO(ByteBuffer bb, int index) { if (UNSAFE.getBoolean(bb, BYTE_BUFFER_IS_READ_ONLY)) throw new ReadOnlyBufferException(); ! return index(bb, index); } @ForceInline static long address(ByteBuffer bb, int index) { long address = ((long) index) + UNSAFE.getLong(bb, BUFFER_ADDRESS);
< prev index next >