diff graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java @ 9706:f44d7e24cebd

Fixes for the merge and inlining cleanups.
author Christian Haeubl <haeubl@ssw.jku.at>
date Tue, 14 May 2013 10:17:06 +0200
parents de7319e48e48
children 9530c8b1bd07
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Mon May 13 17:43:42 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Tue May 14 10:17:06 2013 +0200
@@ -89,25 +89,16 @@
         return inliningCount;
     }
 
-    public static void storeHighLevelStatistics(StructuredGraph graph) {
+    public static void storeStatisticsAfterInlining(StructuredGraph graph) {
         ResolvedJavaMethod method = graph.method();
         if (method != null) {
             CompiledMethodInfo info = compiledMethodInfo(method);
             double summedUpProbabilityOfRemainingInvokes = sumUpInvokeProbabilities(graph);
             info.setSummedUpProbabilityOfRemainingInvokes(summedUpProbabilityOfRemainingInvokes);
-            info.setHighLevelNodeCount(graph.getNodeCount());
         }
     }
 
-    public static void storeMidLevelStatistics(StructuredGraph graph) {
-        ResolvedJavaMethod method = graph.method();
-        if (method != null) {
-            CompiledMethodInfo info = compiledMethodInfo(graph.method());
-            info.setMidLevelNodeCount(graph.getNodeCount());
-        }
-    }
-
-    public static void storeLowLevelStatistics(StructuredGraph graph) {
+    public static void storeStatisticsAfterLowTier(StructuredGraph graph) {
         ResolvedJavaMethod method = graph.method();
         if (method != null) {
             CompiledMethodInfo info = compiledMethodInfo(graph.method());
@@ -185,7 +176,7 @@
         InlineInfo callee = calleeInfo.callee();
         try {
             List<Node> invokeUsages = callee.invoke().asNode().usages().snapshot();
-            callee.inline(runtime, callerAssumptions);
+            callee.inline(runtime, callerAssumptions, replacements);
             callerAssumptions.record(calleeInfo.assumptions());
             metricInliningRuns.increment();
             Debug.dump(callerGraph, "after %s", callee);
@@ -253,33 +244,31 @@
                     parseBytecodes(newGraph, assumptions);
                 }
 
-                if (GraalOptions.PropagateArgumentsDuringInlining) {
-                    boolean callerHasMoreInformationAboutArguments = false;
-                    NodeInputList<ValueNode> args = invoke.callTarget().arguments();
-                    for (LocalNode localNode : newGraph.getNodes(LocalNode.class).snapshot()) {
-                        ValueNode arg = args.get(localNode.index());
-                        if (arg.isConstant()) {
-                            Constant constant = arg.asConstant();
-                            newGraph.replaceFloating(localNode, ConstantNode.forConstant(constant, runtime, newGraph));
+                boolean callerHasMoreInformationAboutArguments = false;
+                NodeInputList<ValueNode> args = invoke.callTarget().arguments();
+                for (LocalNode localNode : newGraph.getNodes(LocalNode.class).snapshot()) {
+                    ValueNode arg = args.get(localNode.index());
+                    if (arg.isConstant()) {
+                        Constant constant = arg.asConstant();
+                        newGraph.replaceFloating(localNode, ConstantNode.forConstant(constant, runtime, newGraph));
+                        callerHasMoreInformationAboutArguments = true;
+                    } else {
+                        Stamp joinedStamp = localNode.stamp().join(arg.stamp());
+                        if (!joinedStamp.equals(localNode.stamp())) {
+                            localNode.setStamp(joinedStamp);
                             callerHasMoreInformationAboutArguments = true;
-                        } else {
-                            Stamp joinedStamp = localNode.stamp().join(arg.stamp());
-                            if (!joinedStamp.equals(localNode.stamp())) {
-                                localNode.setStamp(joinedStamp);
-                                callerHasMoreInformationAboutArguments = true;
-                            }
                         }
                     }
+                }
 
-                    if (!callerHasMoreInformationAboutArguments) {
-                        // TODO (chaeubl): if args are not more concrete, inlining should be avoided
-                        // in most cases or we could at least use the previous graph size + invoke
-                        // probability to check the inlining
-                    }
+                if (!callerHasMoreInformationAboutArguments) {
+                    // TODO (chaeubl): if args are not more concrete, inlining should be avoided
+                    // in most cases or we could at least use the previous graph size + invoke
+                    // probability to check the inlining
+                }
 
-                    if (GraalOptions.OptCanonicalizer) {
-                        new CanonicalizerPhase.Instance(runtime, assumptions).apply(newGraph);
-                    }
+                if (GraalOptions.OptCanonicalizer) {
+                    new CanonicalizerPhase.Instance(runtime, assumptions).apply(newGraph);
                 }
 
                 return newGraph;
@@ -387,22 +376,6 @@
             return true;
         }
 
-        protected static int previousHighLevelGraphSize(InlineInfo info) {
-            int size = 0;
-            for (int i = 0; i < info.numberOfMethods(); i++) {
-                size += compiledMethodInfo(info.methodAt(i)).highLevelNodeCount();
-            }
-            return size;
-        }
-
-        protected static int previousMidLevelGraphSize(InlineInfo info) {
-            int size = 0;
-            for (int i = 0; i < info.numberOfMethods(); i++) {
-                size += compiledMethodInfo(info.methodAt(i)).midLevelNodeCount();
-            }
-            return size;
-        }
-
         protected static int previousLowLevelGraphSize(InlineInfo info) {
             int size = 0;
             for (int i = 0; i < info.numberOfMethods(); i++) {
@@ -467,16 +440,6 @@
 
             double inliningBonus = getInliningBonus(info);
 
-            int highLevelGraphSize = previousHighLevelGraphSize(info);
-            if (GraalOptions.SmallCompiledHighLevelGraphSize > 0 && highLevelGraphSize > GraalOptions.SmallCompiledHighLevelGraphSize * inliningBonus) {
-                return InliningUtil.logNotInlinedMethod(info, "too large previous high-level graph: %d", highLevelGraphSize);
-            }
-
-            int midLevelGraphSize = previousMidLevelGraphSize(info);
-            if (GraalOptions.SmallCompiledMidLevelGraphSize > 0 && midLevelGraphSize > GraalOptions.SmallCompiledMidLevelGraphSize * inliningBonus) {
-                return InliningUtil.logNotInlinedMethod(info, "too large previous mid-level graph: %d", midLevelGraphSize);
-            }
-
             int lowLevelGraphSize = previousLowLevelGraphSize(info);
             if (GraalOptions.SmallCompiledLowLevelGraphSize > 0 && lowLevelGraphSize > GraalOptions.SmallCompiledLowLevelGraphSize * inliningBonus) {
                 return InliningUtil.logNotInlinedMethod(info, "too large previous low-level graph: %d", lowLevelGraphSize);
@@ -817,30 +780,12 @@
 
     private static class CompiledMethodInfo {
 
-        private int highLevelNodes;
-        private int midLevelNodes;
         private int lowLevelNodes;
         private double summedUpProbabilityOfRemainingInvokes;
 
         public CompiledMethodInfo() {
         }
 
-        public int highLevelNodeCount() {
-            return highLevelNodes;
-        }
-
-        public void setHighLevelNodeCount(int highLevelNodes) {
-            this.highLevelNodes = highLevelNodes;
-        }
-
-        public int midLevelNodeCount() {
-            return midLevelNodes;
-        }
-
-        public void setMidLevelNodeCount(int midLevelNodes) {
-            this.midLevelNodes = midLevelNodes;
-        }
-
         public int lowLevelNodeCount() {
             return lowLevelNodes;
         }