# HG changeset patch # User Doug Simon # Date 1364247438 -3600 # Node ID eb0282efad36c57593b82a24f148248fa4085b32 # Parent c7a2a937233f22463a22b266d23dacec48e60a2c rewrote Thread.isInterrupted() substitution to use @Alias mechanism diff -r c7a2a937233f -r eb0282efad36 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 Mon Mar 25 22:35:42 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Mon Mar 25 22:37:18 2013 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot.replacements; import static com.oracle.graal.hotspot.replacements.HotSpotSnippetUtils.*; +import static com.oracle.graal.nodes.extended.UnsafeCastNode.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.hotspot.nodes.*; @@ -39,13 +40,17 @@ return CurrentThread.get(); } + @Alias(declaringClass = Thread.class) private long eetop; + @MethodSubstitution(isStatic = false) - private static boolean isInterrupted(final Thread thisObject, boolean clearInterrupted) { - Word rawThread = HotSpotCurrentRawThreadNode.get(); - Thread thread = (Thread) rawThread.readObject(threadObjectOffset(), FINAL_LOCATION); + public static boolean isInterrupted(final Thread thisObject, boolean clearInterrupted) { + Thread thread = CurrentThread.get(); if (thisObject == thread) { + ThreadSubstitutions threadAlias = unsafeCast(thread, ThreadSubstitutions.class, false, true); + Word rawThread = Word.unsigned(threadAlias.eetop); Word osThread = rawThread.readWord(osThreadOffset(), FINAL_LOCATION); - boolean interrupted = osThread.readInt(osThreadInterruptedOffset(), UNKNOWN_LOCATION) != 0; + int int0 = osThread.readInt(osThreadInterruptedOffset(), UNKNOWN_LOCATION); + boolean interrupted = int0 != 0; if (!interrupted || !clearInterrupted) { return interrupted; }