use of org.graalvm.compiler.phases.tiers.PhaseContext in project graal by oracle.
the class LockEliminationTest method testLock.
@Test
public void testLock() {
test("testSynchronizedSnippet", new A(), new A());
StructuredGraph graph = getGraph("testSynchronizedSnippet");
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new LockEliminationPhase().apply(graph);
assertDeepEquals(1, graph.getNodes().filter(RawMonitorEnterNode.class).count());
assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
}
use of org.graalvm.compiler.phases.tiers.PhaseContext in project graal by oracle.
the class LockEliminationTest method testSynchronizedMethod.
@Test
public void testSynchronizedMethod() {
test("testSynchronizedMethodSnippet", new A());
StructuredGraph graph = getGraph("testSynchronizedMethodSnippet");
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new LockEliminationPhase().apply(graph);
assertDeepEquals(1, graph.getNodes().filter(RawMonitorEnterNode.class).count());
assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
}
use of org.graalvm.compiler.phases.tiers.PhaseContext in project graal by oracle.
the class LoopUnswitchTest method test.
@SuppressWarnings("try")
private void test(String snippet, String referenceSnippet) {
DebugContext debug = getDebugContext();
final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
final StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.NO);
new LoopUnswitchingPhase(new DefaultLoopPolicies()).apply(graph);
// Framestates create comparison problems
graph.clearAllStateAfter();
referenceGraph.clearAllStateAfter();
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new CanonicalizerPhase().apply(referenceGraph, new PhaseContext(getProviders()));
try (DebugContext.Scope s = debug.scope("Test", new DebugDumpScope("Test:" + snippet))) {
assertEquals(referenceGraph, graph);
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of org.graalvm.compiler.phases.tiers.PhaseContext in project graal by oracle.
the class ArraysSubstitutionsTest method testVirtualNotEqual.
@Test
public void testVirtualNotEqual() {
StructuredGraph graph = parseEager("testVirtualNotEqualSnippet", AllowAssumptions.NO);
HighTierContext context = getDefaultHighTierContext();
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new PartialEscapePhase(false, new CanonicalizerPhase(), graph.getOptions()).apply(graph, context);
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
Assert.assertTrue(graph.getNodes(ReturnNode.TYPE).first().result().asJavaConstant().asLong() == 0);
}
use of org.graalvm.compiler.phases.tiers.PhaseContext in project graal by oracle.
the class ArraysSubstitutionsTest method testVirtualEqual.
@Test
public void testVirtualEqual() {
StructuredGraph graph = parseEager("testVirtualEqualSnippet", AllowAssumptions.NO);
HighTierContext context = new HighTierContext(getProviders(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new PartialEscapePhase(false, new CanonicalizerPhase(), graph.getOptions()).apply(graph, context);
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
Assert.assertTrue(graph.getNodes(ReturnNode.TYPE).first().result().asJavaConstant().asLong() == 1);
}
Aggregations