# HG changeset patch # User Doug Simon # Date 1364298372 -3600 # Node ID 7919bd029d12fa7e38d80b701d06eab1a7b1eaeb # Parent 7a9cb44489686a296b2a47617a72991a24f2f6cb removed use of CurrentThread from Thread method substitutions diff -r 7a9cb4448968 -r 7919bd029d12 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Tue Mar 26 12:42:11 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Tue Mar 26 12:46:12 2013 +0100 @@ -22,13 +22,10 @@ */ package com.oracle.graal.hotspot.replacements; -import static com.oracle.graal.graph.UnsafeAccess.*; import static com.oracle.graal.hotspot.replacements.HotSpotSnippetUtils.*; import com.oracle.graal.api.replacements.*; -import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.nodes.*; -import com.oracle.graal.replacements.Snippet.Fold; import com.oracle.graal.word.*; /** @@ -39,26 +36,15 @@ @MethodSubstitution public static Thread currentThread() { - return CurrentThread.get(); - } - - @Alias(declaringClass = Thread.class) private long eetop; - - @Fold - private static int eetopOffset() { - try { - return (int) unsafe.objectFieldOffset(Thread.class.getDeclaredField("eetop")); - } catch (Exception e) { - throw new GraalInternalError(e); - } + return (Thread) CurrentJavaThreadNode.get().readObject(threadObjectOffset(), FINAL_LOCATION); } @MethodSubstitution(isStatic = false) public static boolean isInterrupted(final Thread thisObject, boolean clearInterrupted) { - Thread thread = CurrentThread.get(); + Word javaThread = CurrentJavaThreadNode.get(); + Object thread = javaThread.readObject(threadObjectOffset(), FINAL_LOCATION); if (thisObject == thread) { - Word rawThread = loadWordFromObject(thread, eetopOffset()); - Word osThread = rawThread.readWord(osThreadOffset(), FINAL_LOCATION); + Word osThread = javaThread.readWord(osThreadOffset(), FINAL_LOCATION); boolean interrupted = osThread.readInt(osThreadInterruptedOffset(), UNKNOWN_LOCATION) != 0; if (!interrupted || !clearInterrupted) { return interrupted; diff -r 7a9cb4448968 -r 7919bd029d12 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 Tue Mar 26 12:42:11 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Tue Mar 26 12:46:12 2013 +0100 @@ -645,7 +645,9 @@ @Override @Operation(opcode = Opcode.READ) - public native Object readObject(WordBase offset, Object locationIdentity); + public Object readObject(WordBase offset, Object locationIdentity) { + return unsafe.getObject(null, add((Word) offset).unbox()); + } @Override @Operation(opcode = Opcode.READ)