< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/inlining/NestedLoopEffectsPhaseComplexityTest.java

Print this page




 129     private StructuredGraph prepareGraph(String snippet, int inliningCount) {
 130         ResolvedJavaMethod callerMethod = getResolvedJavaMethod(snippet);
 131         StructuredGraph callerGraph = parseEager(callerMethod, AllowAssumptions.YES);
 132         PhaseSuite<HighTierContext> graphBuilderSuite = getDefaultGraphBuilderSuite();
 133         HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
 134         CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
 135         Invoke next = callerGraph.getNodes(MethodCallTargetNode.TYPE).first().invoke();
 136         StructuredGraph calleeGraph = parseBytecodes(next.callTarget().targetMethod(), context, canonicalizer);
 137         ResolvedJavaMethod calleeMethod = next.callTarget().targetMethod();
 138         for (int i = 0; i < inliningCount; i++) {
 139             next = callerGraph.getNodes(MethodCallTargetNode.TYPE).first().invoke();
 140             EconomicSet<Node> canonicalizeNodes = InliningUtil.inlineForCanonicalization(next, calleeGraph, false, calleeMethod);
 141             canonicalizer.applyIncremental(callerGraph, context, canonicalizeNodes);
 142             callerGraph.getDebug().dump(DebugContext.DETAILED_LEVEL, callerGraph, "After inlining %s into %s iteration %d", calleeMethod, callerMethod, i);
 143         }
 144         return callerGraph;
 145     }
 146 
 147     private StructuredGraph parseBytecodes(ResolvedJavaMethod method, HighTierContext context, CanonicalizerPhase canonicalizer) {
 148         OptionValues options = getInitialOptions();
 149         StructuredGraph newGraph = new StructuredGraph.Builder(options, getDebugContext(options), AllowAssumptions.NO).method(method).build();
 150         context.getGraphBuilderSuite().apply(newGraph, context);
 151         new DeadCodeEliminationPhase(Optional).apply(newGraph);
 152         canonicalizer.apply(newGraph, context);
 153         return newGraph;
 154     }
 155 
 156 }


 129     private StructuredGraph prepareGraph(String snippet, int inliningCount) {
 130         ResolvedJavaMethod callerMethod = getResolvedJavaMethod(snippet);
 131         StructuredGraph callerGraph = parseEager(callerMethod, AllowAssumptions.YES);
 132         PhaseSuite<HighTierContext> graphBuilderSuite = getDefaultGraphBuilderSuite();
 133         HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
 134         CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
 135         Invoke next = callerGraph.getNodes(MethodCallTargetNode.TYPE).first().invoke();
 136         StructuredGraph calleeGraph = parseBytecodes(next.callTarget().targetMethod(), context, canonicalizer);
 137         ResolvedJavaMethod calleeMethod = next.callTarget().targetMethod();
 138         for (int i = 0; i < inliningCount; i++) {
 139             next = callerGraph.getNodes(MethodCallTargetNode.TYPE).first().invoke();
 140             EconomicSet<Node> canonicalizeNodes = InliningUtil.inlineForCanonicalization(next, calleeGraph, false, calleeMethod);
 141             canonicalizer.applyIncremental(callerGraph, context, canonicalizeNodes);
 142             callerGraph.getDebug().dump(DebugContext.DETAILED_LEVEL, callerGraph, "After inlining %s into %s iteration %d", calleeMethod, callerMethod, i);
 143         }
 144         return callerGraph;
 145     }
 146 
 147     private StructuredGraph parseBytecodes(ResolvedJavaMethod method, HighTierContext context, CanonicalizerPhase canonicalizer) {
 148         OptionValues options = getInitialOptions();
 149         StructuredGraph newGraph = new StructuredGraph.Builder(options, getDebugContext(options, null, method), AllowAssumptions.NO).method(method).build();
 150         context.getGraphBuilderSuite().apply(newGraph, context);
 151         new DeadCodeEliminationPhase(Optional).apply(newGraph);
 152         canonicalizer.apply(newGraph, context);
 153         return newGraph;
 154     }
 155 
 156 }
< prev index next >