# HG changeset patch # User Doug Simon # Date 1384950803 -3600 # Node ID 9b0ab9e2fd6b6eccd610614743f498fc197309f2 # Parent e3d1e4f635e93e70565005608b8836df8ef27662 pass thread register into LoadExceptionObjectSnippet instead of getting it from the host provider diff -r e3d1e4f635e9 -r 9b0ab9e2fd6b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java Wed Nov 20 13:28:12 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java Wed Nov 20 13:33:23 2013 +0100 @@ -512,7 +512,7 @@ newObjectSnippets.lower((NewMultiArrayNode) n); } } else if (n instanceof LoadExceptionObjectNode) { - exceptionObjectSnippets.lower((LoadExceptionObjectNode) n); + exceptionObjectSnippets.lower((LoadExceptionObjectNode) n, registers); } else if (n instanceof IntegerDivNode || n instanceof IntegerRemNode || n instanceof UnsignedDivNode || n instanceof UnsignedRemNode) { // Nothing to do for division nodes. The HotSpot signal handler catches divisions by // zero and the MIN_VALUE / -1 cases. diff -r e3d1e4f635e9 -r 9b0ab9e2fd6b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Wed Nov 20 13:28:12 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Wed Nov 20 13:33:23 2013 +0100 @@ -34,6 +34,7 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.replacements.*; +import com.oracle.graal.replacements.Snippet.*; import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates; import com.oracle.graal.replacements.SnippetTemplate.Arguments; import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo; @@ -51,8 +52,8 @@ private static final boolean USE_C_RUNTIME = Boolean.getBoolean("graal.loadExceptionObject.useCRuntime"); @Snippet - public static Object loadException() { - Word thread = thread(); + public static Object loadException(@ConstantParameter Register threadRegister) { + Word thread = registerAsWord(threadRegister); Object exception = readExceptionOop(thread); writeExceptionOop(thread, null); writeExceptionPc(thread, Word.zero()); @@ -67,10 +68,9 @@ super(providers, target); } - public void lower(LoadExceptionObjectNode loadExceptionObject) { + public void lower(LoadExceptionObjectNode loadExceptionObject, HotSpotRegistersProvider registers) { if (USE_C_RUNTIME) { StructuredGraph graph = loadExceptionObject.graph(); - HotSpotRegistersProvider registers = ((HotSpotProviders) providers).getRegisters(); ReadRegisterNode thread = graph.add(new ReadRegisterNode(registers.getThreadRegister(), true, false)); graph.addBeforeFixed(loadExceptionObject, thread); ForeignCallNode loadExceptionC = graph.add(new ForeignCallNode(providers.getForeignCalls(), LOAD_AND_CLEAR_EXCEPTION, thread)); @@ -78,6 +78,7 @@ graph.replaceFixedWithFixed(loadExceptionObject, loadExceptionC); } else { Arguments args = new Arguments(loadException, loadExceptionObject.graph().getGuardsStage()); + args.addConst("threadRegister", registers.getThreadRegister()); template(args).instantiate(providers.getMetaAccess(), loadExceptionObject, DEFAULT_REPLACER, args); } }