use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class InliningTest method getGraph.
@SuppressWarnings("try")
private StructuredGraph getGraph(final String snippet, final boolean eagerInfopointMode) {
DebugContext debug = getDebugContext();
try (DebugContext.Scope s = debug.scope("InliningTest", new DebugDumpScope(snippet, true))) {
ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
Builder builder = builder(method, AllowAssumptions.YES, debug);
StructuredGraph graph = eagerInfopointMode ? parse(builder, getDebugGraphBuilderSuite()) : parse(builder, getEagerGraphBuilderSuite());
try (DebugContext.Scope s2 = debug.scope("Inlining", graph)) {
PhaseSuite<HighTierContext> graphBuilderSuite = eagerInfopointMode ? getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withFullInfopoints(true)) : getDefaultGraphBuilderSuite();
HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
new CanonicalizerPhase().apply(graph, context);
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
new CanonicalizerPhase().apply(graph, context);
new DeadCodeEliminationPhase().apply(graph);
return graph;
}
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class NestedLoopEffectsPhaseComplexityTest method prepareGraph.
private StructuredGraph prepareGraph(String snippet, int inliningCount) {
ResolvedJavaMethod callerMethod = getResolvedJavaMethod(snippet);
StructuredGraph callerGraph = parseEager(callerMethod, AllowAssumptions.YES);
PhaseSuite<HighTierContext> graphBuilderSuite = getDefaultGraphBuilderSuite();
HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
Invoke next = callerGraph.getNodes(MethodCallTargetNode.TYPE).first().invoke();
StructuredGraph calleeGraph = parseBytecodes(next.callTarget().targetMethod(), context, canonicalizer);
ResolvedJavaMethod calleeMethod = next.callTarget().targetMethod();
for (int i = 0; i < inliningCount; i++) {
next = callerGraph.getNodes(MethodCallTargetNode.TYPE).first().invoke();
EconomicSet<Node> canonicalizeNodes = InliningUtil.inlineForCanonicalization(next, calleeGraph, false, calleeMethod);
canonicalizer.applyIncremental(callerGraph, context, canonicalizeNodes);
callerGraph.getDebug().dump(DebugContext.DETAILED_LEVEL, callerGraph, "After inlining %s into %s iteration %d", calleeMethod, callerMethod, i);
}
return callerGraph;
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class NestedLoopEffectsPhaseComplexityTest method testAndTime.
private void testAndTime(String snippet) {
for (int i = InliningCountLowerBound; i < InliningCountUpperBound; i++) {
StructuredGraph g1 = prepareGraph(snippet, i);
StructuredGraph g2 = (StructuredGraph) g1.copy(g1.getDebug());
ResolvedJavaMethod method = g1.method();
long elapsedRE = runAndTimePhase(g1, new EarlyReadEliminationPhase(new CanonicalizerPhase()));
long elapsedPEA = runAndTimePhase(g2, new PartialEscapePhase(true, new CanonicalizerPhase(), g1.getOptions()));
if (LOG_PHASE_TIMINGS) {
TTY.printf("Needed %dms to run early partial escape analysis on a graph with %d nested loops compiling method %s\n", elapsedPEA, i, method);
}
if (LOG_PHASE_TIMINGS) {
TTY.printf("Needed %dms to run early read elimination on a graph with %d nested loops compiling method %s\n", elapsedRE, i, method);
}
}
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class StableArrayReadFoldingTest method testKillWithDifferentTypeUnaligned.
@Test
public void testKillWithDifferentTypeUnaligned() {
Assume.assumeTrue("Only test unaligned access on AMD64", getTarget().arch instanceof AMD64);
ResolvedJavaMethod method = getResolvedJavaMethod("killWithDifferentTypeUnaligned");
testAgainstExpected(method, new Result(true, null), null);
}
use of jdk.vm.ci.meta.ResolvedJavaMethod in project graal by oracle.
the class StableArrayReadFoldingTest method testKillWithSameTypeUnaligned.
@Test
public void testKillWithSameTypeUnaligned() {
Assume.assumeTrue("Only test unaligned access on AMD64", getTarget().arch instanceof AMD64);
ResolvedJavaMethod method = getResolvedJavaMethod("killWithSameTypeUnaligned");
testAgainstExpected(method, new Result(true, null), null);
}
Aggregations