# HG changeset patch # User twisti # Date 1375759232 25200 # Node ID 3718acd022dbd0f91ca7738bf2504f511b4cfea5 # Parent dba746f54e6aea688f287a633c7ef808ef60cb3e fix HotSpotMethodData to read the correct values on little and big endian diff -r dba746f54e6a -r 3718acd022db graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Mon Aug 05 23:46:06 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Mon Aug 05 20:20:32 2013 -0700 @@ -124,9 +124,14 @@ return unsafe.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF; } + /** + * Since the values are stored in cells (platform words) this method uses + * {@link HotSpotGraalRuntime#unsafeReadWord} to read the right value on both little and big + * endian machines. + */ private long readUnsignedInt(int position, int offsetInBytes) { long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); - return unsafe.getInt(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL; + return unsafeReadWord(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL; } private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) { @@ -134,9 +139,14 @@ return truncateLongToInt(value); } + /** + * Since the values are stored in cells (platform words) this method uses + * {@link HotSpotGraalRuntime#unsafeReadWord} to read the right value on both little and big + * endian machines. + */ private int readInt(int position, int offsetInBytes) { long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); - return unsafe.getInt(metaspaceMethodData + fullOffsetInBytes); + return (int) unsafeReadWord(metaspaceMethodData + fullOffsetInBytes); } private long readWord(int position, int offsetInBytes) {