Mercurial > hg > graal-compiler
changeset 8475:7919bd029d12
removed use of CurrentThread from Thread method substitutions
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 26 Mar 2013 12:46:12 +0100 |
parents | 7a9cb4448968 |
children | 4316ad0fa3ee |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java |
diffstat | 2 files changed, 7 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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)