Java Code Examples for sun.misc.Unsafe#ARRAY_SHORT_BASE_OFFSET
The following examples show how to use
sun.misc.Unsafe#ARRAY_SHORT_BASE_OFFSET .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderBuffer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 2
Source File: RenderBuffer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 3
Source File: RenderBuffer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 4
Source File: RenderBuffer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 5
Source File: RenderBuffer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 6
Source File: RenderBuffer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 7
Source File: RenderBuffer.java From hottub with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 8
Source File: RenderBuffer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 9
Source File: RenderBuffer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 10
Source File: RenderBuffer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 11
Source File: RenderBuffer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 12
Source File: RenderBuffer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public RenderBuffer put(short[] x, int offset, int length) { // assert (position() % SIZEOF_SHORT == 0); if (length > COPY_FROM_ARRAY_THRESHOLD) { long offsetInBytes = offset * SIZEOF_SHORT + Unsafe.ARRAY_SHORT_BASE_OFFSET; long lengthInBytes = length * SIZEOF_SHORT; unsafe.copyMemory(x, offsetInBytes, null, curAddress, lengthInBytes); position(position() + lengthInBytes); } else { int end = offset + length; for (int i = offset; i < end; i++) { putShort(x[i]); } } return this; }
Example 13
Source File: VirtualArrayNode.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static int entryIndexForOffset(long constantOffset, JavaKind expectedEntryKind, ResolvedJavaType componentType, int length) { int baseOffset; int indexScale; switch (componentType.getJavaKind()) { case Boolean: baseOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET; indexScale = Unsafe.ARRAY_BOOLEAN_INDEX_SCALE; break; case Byte: baseOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET; indexScale = Unsafe.ARRAY_BYTE_INDEX_SCALE; break; case Short: baseOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET; indexScale = Unsafe.ARRAY_SHORT_INDEX_SCALE; break; case Char: baseOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET; indexScale = Unsafe.ARRAY_CHAR_INDEX_SCALE; break; case Int: baseOffset = Unsafe.ARRAY_INT_BASE_OFFSET; indexScale = Unsafe.ARRAY_INT_INDEX_SCALE; break; case Long: baseOffset = Unsafe.ARRAY_LONG_BASE_OFFSET; indexScale = Unsafe.ARRAY_LONG_INDEX_SCALE; break; case Float: baseOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET; indexScale = Unsafe.ARRAY_FLOAT_INDEX_SCALE; break; case Double: baseOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET; indexScale = Unsafe.ARRAY_DOUBLE_INDEX_SCALE; break; case Object: baseOffset = Unsafe.ARRAY_OBJECT_BASE_OFFSET; indexScale = Unsafe.ARRAY_OBJECT_INDEX_SCALE; break; default: return -1; } long offset; if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN && componentType.isPrimitive()) { // On big endian, we do just get expect the type be right aligned in this memory slot offset = constantOffset - (componentType.getJavaKind().getByteCount() - Math.min(componentType.getJavaKind().getByteCount(), 4 + expectedEntryKind.getByteCount())); } else { offset = constantOffset; } long index = offset - baseOffset; if (index % indexScale != 0) { return -1; } long elementIndex = index / indexScale; if (elementIndex < 0 || elementIndex >= length) { return -1; } return (int) elementIndex; }