# HG changeset patch # User twisti # Date 1381885453 25200 # Node ID 39308acea2f7182f8b77c98ecaecf42990ef6aa4 # Parent 43e0044612485e5913d8ded08dba1a4ff0ba79ab revert Unsafe.getObject hack to read uncompressed pointers diff -r 43e004461248 -r 39308acea2f7 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java Wed Oct 16 01:12:47 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java Tue Oct 15 18:04:13 2013 -0700 @@ -33,6 +33,11 @@ */ public class HotSpotMethodSubstitutionTest extends MethodSubstitutionTest { + /* + * We have to ignore this test for now because currently there is no way to read uncompressed + * pointers in a compressed world via JNI. + */ + @Ignore @Test public void testObjectSubstitutions() { test("getClass0"); @@ -54,6 +59,11 @@ return obj.hashCode(); } + /* + * We have to ignore this test for now because currently there is no way to read uncompressed + * pointers in a compressed world via JNI. + */ + @Ignore @Test public void testClassSubstitutions() { test("getModifiers"); @@ -112,6 +122,11 @@ return clazz.getComponentType(); } + /* + * We have to ignore this test for now because currently there is no way to read uncompressed + * pointers in a compressed world via JNI. + */ + @Ignore @Test public void testThreadSubstitutions() { test("currentThread"); diff -r 43e004461248 -r 39308acea2f7 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Wed Oct 16 01:12:47 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Tue Oct 15 18:04:13 2013 -0700 @@ -105,7 +105,7 @@ */ public static ResolvedJavaType fromMetaspaceKlass(long metaspaceKlass) { assert metaspaceKlass != 0; - Class javaClass = (Class) unsafe.getObject(null, metaspaceKlass + runtime().getConfig().classMirrorOffset); + Class javaClass = (Class) runtime().getCompilerToVM().readUnsafeUncompressedPointer(null, metaspaceKlass + runtime().getConfig().classMirrorOffset); assert javaClass != null; return fromClass(javaClass); } diff -r 43e004461248 -r 39308acea2f7 graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Wed Oct 16 01:12:47 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Tue Oct 15 18:04:13 2013 -0700 @@ -657,9 +657,7 @@ @Override @Operation(opcode = Opcode.READ) - public Object readObject(WordBase offset, LocationIdentity locationIdentity) { - return unsafe.getObject(null, add((Word) offset).unbox()); - } + public native Object readObject(WordBase offset, LocationIdentity locationIdentity); @Override @Operation(opcode = Opcode.READ) diff -r 43e004461248 -r 39308acea2f7 src/share/vm/prims/unsafe.cpp --- a/src/share/vm/prims/unsafe.cpp Wed Oct 16 01:12:47 2013 +0200 +++ b/src/share/vm/prims/unsafe.cpp Tue Oct 15 18:04:13 2013 -0700 @@ -173,9 +173,7 @@ #define GET_OOP_FIELD(obj, offset, v) \ oop p = JNIHandles::resolve(obj); \ oop v; \ - /* Uncompression is not performed to unsafeAccess with null object. \ - * This concerns accesses to the metaspace such as the classMirrorOffset in Graal which is not compressed.*/ \ - if (UseCompressedOops GRAAL_ONLY(&& p != NULL && offset >= oopDesc::header_size())) { \ + if (UseCompressedOops) { \ narrowOop n = *(narrowOop*)index_oop_from_field_offset_long(p, offset); \ v = oopDesc::decode_heap_oop(n); \ } else { \