--- old/src/java.base/share/classes/sun/misc/Unsafe.java 2015-06-27 04:11:59.000000000 +0300 +++ new/src/java.base/share/classes/sun/misc/Unsafe.java 2015-06-27 04:11:59.000000000 +0300 @@ -1012,24 +1012,24 @@ */ public final long getLongUnaligned(Object o, long offset) { if ((offset & 7) == 0) { - return getLong(o, offset); + return getLong(o, offset << 1); } else if ((offset & 3) == 0) { - return makeLong(getInt(o, offset), - getInt(o, offset + 4)); + return makeLong(getInt(o, (offset + 0) << 1), + getInt(o, (offset + 4) << 1)); } else if ((offset & 1) == 0) { - return makeLong(getShort(o, offset), - getShort(o, offset + 2), - getShort(o, offset + 4), - getShort(o, offset + 6)); + return makeLong(getShort(o, (offset + 0) << 1), + getShort(o, (offset + 2) << 1), + getShort(o, (offset + 4) << 1), + getShort(o, (offset + 6) << 1)); } else { - return makeLong(getByte(o, offset), - getByte(o, offset + 1), - getByte(o, offset + 2), - getByte(o, offset + 3), - getByte(o, offset + 4), - getByte(o, offset + 5), - getByte(o, offset + 6), - getByte(o, offset + 7)); + return makeLong(getByte(o, (offset + 0) << 1), + getByte(o, (offset + 1) << 1), + getByte(o, (offset + 2) << 1), + getByte(o, (offset + 3) << 1), + getByte(o, (offset + 4) << 1), + getByte(o, (offset + 5) << 1), + getByte(o, (offset + 6) << 1), + getByte(o, (offset + 7) << 1)); } } /** @@ -1050,15 +1050,15 @@ /** @see #getLongUnaligned(Object, long) */ public final int getIntUnaligned(Object o, long offset) { if ((offset & 3) == 0) { - return getInt(o, offset); + return getInt(o, offset << 1); } else if ((offset & 1) == 0) { - return makeInt(getShort(o, offset), - getShort(o, offset + 2)); + return makeInt(getShort(o, (offset + 0) << 1), + getShort(o, (offset + 2) << 1)); } else { - return makeInt(getByte(o, offset), - getByte(o, offset + 1), - getByte(o, offset + 2), - getByte(o, offset + 3)); + return makeInt(getByte(o, (offset + 0) << 1), + getByte(o, (offset + 1) << 1), + getByte(o, (offset + 2) << 1), + getByte(o, (offset + 3) << 1)); } } /** @see #getLongUnaligned(Object, long, boolean) */ @@ -1069,10 +1069,10 @@ /** @see #getLongUnaligned(Object, long) */ public final short getShortUnaligned(Object o, long offset) { if ((offset & 1) == 0) { - return getShort(o, offset); + return getShort(o, offset << 1); } else { - return makeShort(getByte(o, offset), - getByte(o, offset + 1)); + return makeShort(getByte(o, (offset + 0) << 1), + getByte(o, (offset + 1) << 1)); } } /** @see #getLongUnaligned(Object, long, boolean) */ @@ -1119,7 +1119,7 @@ */ public final void putLongUnaligned(Object o, long offset, long x) { if ((offset & 7) == 0) { - putLong(o, offset, x); + putLong(o, offset << 1, x); } else if ((offset & 3) == 0) { putLongParts(o, offset, (int)(x >> 0), @@ -1160,7 +1160,7 @@ /** @see #putLongUnaligned(Object, long, long) */ public final void putIntUnaligned(Object o, long offset, int x) { if ((offset & 3) == 0) { - putInt(o, offset, x); + putInt(o, offset << 1, x); } else if ((offset & 1) == 0) { putIntParts(o, offset, (short)(x >> 0), @@ -1181,7 +1181,7 @@ /** @see #putLongUnaligned(Object, long, long) */ public final void putShortUnaligned(Object o, long offset, short x) { if ((offset & 1) == 0) { - putShort(o, offset, x); + putShort(o, offset << 1, x); } else { putShortParts(o, offset, (byte)(x >>> 0), @@ -1259,38 +1259,38 @@ // provided by their caller. The ordering in which these parts // are written is the native endianness of this platform. private void putLongParts(Object o, long offset, byte i0, byte i1, byte i2, byte i3, byte i4, byte i5, byte i6, byte i7) { - putByte(o, offset + 0, pick(i0, i7)); - putByte(o, offset + 1, pick(i1, i6)); - putByte(o, offset + 2, pick(i2, i5)); - putByte(o, offset + 3, pick(i3, i4)); - putByte(o, offset + 4, pick(i4, i3)); - putByte(o, offset + 5, pick(i5, i2)); - putByte(o, offset + 6, pick(i6, i1)); - putByte(o, offset + 7, pick(i7, i0)); + putByte(o, (offset + 0) << 1, pick(i0, i7)); + putByte(o, (offset + 1) << 1, pick(i1, i6)); + putByte(o, (offset + 2) << 1, pick(i2, i5)); + putByte(o, (offset + 3) << 1, pick(i3, i4)); + putByte(o, (offset + 4) << 1, pick(i4, i3)); + putByte(o, (offset + 5) << 1, pick(i5, i2)); + putByte(o, (offset + 6) << 1, pick(i6, i1)); + putByte(o, (offset + 7) << 1, pick(i7, i0)); } private void putLongParts(Object o, long offset, short i0, short i1, short i2, short i3) { - putShort(o, offset + 0, pick(i0, i3)); - putShort(o, offset + 2, pick(i1, i2)); - putShort(o, offset + 4, pick(i2, i1)); - putShort(o, offset + 6, pick(i3, i0)); + putShort(o, (offset + 0) << 1, pick(i0, i3)); + putShort(o, (offset + 2) << 1, pick(i1, i2)); + putShort(o, (offset + 4) << 1, pick(i2, i1)); + putShort(o, (offset + 6) << 1, pick(i3, i0)); } private void putLongParts(Object o, long offset, int i0, int i1) { - putInt(o, offset + 0, pick(i0, i1)); - putInt(o, offset + 4, pick(i1, i0)); + putInt(o, (offset + 0) << 1, pick(i0, i1)); + putInt(o, (offset + 4) << 1, pick(i1, i0)); } private void putIntParts(Object o, long offset, short i0, short i1) { - putShort(o, offset + 0, pick(i0, i1)); - putShort(o, offset + 2, pick(i1, i0)); + putShort(o, (offset + 0) << 1, pick(i0, i1)); + putShort(o, (offset + 2) << 1, pick(i1, i0)); } private void putIntParts(Object o, long offset, byte i0, byte i1, byte i2, byte i3) { - putByte(o, offset + 0, pick(i0, i3)); - putByte(o, offset + 1, pick(i1, i2)); - putByte(o, offset + 2, pick(i2, i1)); - putByte(o, offset + 3, pick(i3, i0)); + putByte(o, (offset + 0) << 1, pick(i0, i3)); + putByte(o, (offset + 1) << 1, pick(i1, i2)); + putByte(o, (offset + 2) << 1, pick(i2, i1)); + putByte(o, (offset + 3) << 1, pick(i3, i0)); } private void putShortParts(Object o, long offset, byte i0, byte i1) { - putByte(o, offset + 0, pick(i0, i1)); - putByte(o, offset + 1, pick(i1, i0)); + putByte(o, (offset + 0) << 1, pick(i0, i1)); + putByte(o, (offset + 1) << 1, pick(i1, i0)); } // Zero-extend an integer