use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class FinalizableSubclassTest method parseAndProcess.
private StructuredGraph parseAndProcess(Class<?> cl, AllowAssumptions allowAssumptions) {
Constructor<?>[] constructors = cl.getConstructors();
Assert.assertTrue(constructors.length == 1);
final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(constructors[0]);
OptionValues options = getInitialOptions();
StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options, null, javaMethod), allowAssumptions).method(javaMethod).build();
GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(getDefaultGraphBuilderPlugins());
new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), getProviders().getConstantFieldProvider(), conf, OptimisticOptimizations.ALL, null).apply(graph);
HighTierContext context = new HighTierContext(getProviders(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
new CanonicalizerPhase().apply(graph, context);
return graph;
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class InvokeExceptionTest method test.
private void test(String snippet) {
StructuredGraph graph = parseProfiled(snippet, AllowAssumptions.NO);
Map<Invoke, Double> hints = new HashMap<>();
for (Invoke invoke : graph.getInvokes()) {
hints.put(invoke, 1000d);
}
HighTierContext context = getDefaultHighTierContext();
new InliningPhase(hints, new CanonicalizerPhase()).apply(graph, context);
new CanonicalizerPhase().apply(graph, context);
new DeadCodeEliminationPhase().apply(graph);
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class InvokeHintsTest method test.
private void test(String snippet) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
Map<Invoke, Double> hints = new HashMap<>();
for (Invoke invoke : graph.getInvokes()) {
hints.put(invoke, 1000d);
}
HighTierContext context = getDefaultHighTierContext();
new InliningPhase(hints, new CanonicalizerPhase()).apply(graph, context);
new CanonicalizerPhase().apply(graph, context);
new DeadCodeEliminationPhase().apply(graph);
StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.NO);
assertEquals(referenceGraph, graph);
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class PointerTest method assertNumWordCasts.
private void assertNumWordCasts(String snippetName, int expectedWordCasts) {
HighTierContext context = new HighTierContext(getProviders(), null, OptimisticOptimizations.ALL);
StructuredGraph graph = parseEager(snippetName, AllowAssumptions.YES);
new CanonicalizerPhase().apply(graph, context);
Assert.assertEquals(expectedWordCasts, graph.getNodes().filter(WordCastNode.class).count());
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class ReplacementsParseTest method testGraph.
@SuppressWarnings("try")
private void testGraph(String name) {
StructuredGraph graph = parseEager(name, StructuredGraph.AllowAssumptions.YES);
try (DebugContext.Scope s0 = graph.getDebug().scope(name, graph)) {
for (OpaqueNode node : graph.getNodes().filter(OpaqueNode.class)) {
node.replaceAndDelete(node.getValue());
}
HighTierContext context = getDefaultHighTierContext();
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
new FloatingReadPhase().apply(graph);
canonicalizer.apply(graph, context);
new DeadCodeEliminationPhase().apply(graph);
new GuardLoweringPhase().apply(graph, getDefaultMidTierContext());
new FrameStateAssignmentPhase().apply(graph);
} catch (Throwable e) {
throw graph.getDebug().handle(e);
}
}
Aggregations