Mercurial > hg > truffle
changeset 11212:3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
author | twisti |
---|---|
date | Mon, 05 Aug 2013 20:20:32 -0700 |
parents | dba746f54e6a |
children | 29bc764bfd9a 8f33568d693d 422b0e9b9aed |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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) {