changeset 10645:a71fa3b8553b

Fix Truffle cache to handle macro nodes correctly.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 07 Jul 2013 21:01:31 +0200
parents 90a7a58bf54f
children e7c2a0aa1fff
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java
diffstat 1 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Sun Jul 07 21:01:05 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Sun Jul 07 21:01:31 2013 +0200
@@ -216,25 +216,25 @@
         if (invoke.callTarget() instanceof MethodCallTargetNode) {
             final MethodCallTargetNode methodCallTargetNode = (MethodCallTargetNode) invoke.callTarget();
             if ((methodCallTargetNode.invokeKind() == InvokeKind.Special || methodCallTargetNode.invokeKind() == InvokeKind.Static) &&
-                            !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers())) {
-                if (methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) != null) {
-                    // Do not inline explode loop methods, they need canonicalization and forced
-                    // unrolling.
-                    return invoke.asNode();
-                }
-                StructuredGraph inlinedGraph = Debug.scope("ExpandInvoke", methodCallTargetNode.targetMethod(), new Callable<StructuredGraph>() {
+                            !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers()) && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null) {
+                Class<? extends FixedWithNextNode> macroSubstitution = replacements.getMacroSubstitution(methodCallTargetNode.targetMethod());
+                if (macroSubstitution != null) {
+                    return InliningUtil.inlineMacroNode(invoke, methodCallTargetNode.targetMethod(), methodCallTargetNode.graph(), macroSubstitution);
+                } else {
+                    StructuredGraph inlinedGraph = Debug.scope("ExpandInvoke", methodCallTargetNode.targetMethod(), new Callable<StructuredGraph>() {
 
-                    public StructuredGraph call() {
-                        StructuredGraph inlineGraph = replacements.getMethodSubstitution(methodCallTargetNode.targetMethod());
-                        if (inlineGraph == null) {
-                            inlineGraph = parseGraph(methodCallTargetNode.targetMethod());
+                        public StructuredGraph call() {
+                            StructuredGraph inlineGraph = replacements.getMethodSubstitution(methodCallTargetNode.targetMethod());
+                            if (inlineGraph == null) {
+                                inlineGraph = parseGraph(methodCallTargetNode.targetMethod());
+                            }
+                            return inlineGraph;
                         }
-                        return inlineGraph;
-                    }
-                });
-                FixedNode fixedNode = (FixedNode) invoke.predecessor();
-                InliningUtil.inline(invoke, inlinedGraph, true);
-                return fixedNode;
+                    });
+                    FixedNode fixedNode = (FixedNode) invoke.predecessor();
+                    InliningUtil.inline(invoke, inlinedGraph, true);
+                    return fixedNode;
+                }
             }
         }
         return invoke.asNode();