# HG changeset patch # User Doug Simon # Date 1364294784 -3600 # Node ID f9aee27a6ff01df6c27a9ad42f153b53aecf4b10 # Parent 95e21e0353635e76469671f634a8e0f93a3d12dc removed use of @Alias in Thread.isInterrupted() substitution diff -r 95e21e035363 -r f9aee27a6ff0 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:38:05 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Tue Mar 26 11:46:24 2013 +0100 @@ -22,11 +22,13 @@ */ package com.oracle.graal.hotspot.replacements; +import static com.oracle.graal.graph.UnsafeAccess.*; 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.graph.*; import com.oracle.graal.hotspot.nodes.*; +import com.oracle.graal.replacements.Snippet.Fold; import com.oracle.graal.word.*; /** @@ -42,12 +44,20 @@ @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); + } + } + @MethodSubstitution(isStatic = false) 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 rawThread = loadWordFromObject(thread, eetopOffset()); Word osThread = rawThread.readWord(osThreadOffset(), FINAL_LOCATION); int int0 = osThread.readInt(osThreadInterruptedOffset(), UNKNOWN_LOCATION); boolean interrupted = int0 != 0;