changeset 8477:abf5a4554bae

made CurrentJavaThreadNode.get() interpretable
author Doug Simon <doug.simon@oracle.com>
date Tue, 26 Mar 2013 12:48:44 +0100
parents 4316ad0fa3ee
children e9dad49ce336
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java	Tue Mar 26 12:46:33 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java	Tue Mar 26 12:48:44 2013 +0100
@@ -22,7 +22,10 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
+
 import com.oracle.graal.api.code.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
@@ -44,6 +47,16 @@
         gen.setResult(this, rawThread.asValue(this.kind()));
     }
 
+    private static int eetopOffset() {
+        try {
+            return (int) UnsafeAccess.unsafe.objectFieldOffset(Thread.class.getDeclaredField("eetop"));
+        } catch (Exception e) {
+            throw new GraalInternalError(e);
+        }
+    }
+
     @NodeIntrinsic
-    public static native Word get();
+    public static Word get() {
+        return Word.box(unsafeReadWord(Thread.currentThread(), eetopOffset()));
+    }
 }