use of org.graalvm.compiler.phases.common.LockEliminationPhase in project graal by oracle.
the class LockEliminationTest method testUnrolledSync.
@Test
public void testUnrolledSync() {
StructuredGraph graph = getGraph("testUnrolledSyncSnippet");
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
canonicalizer.apply(graph, new PhaseContext(getProviders()));
HighTierContext context = getDefaultHighTierContext();
new LoopFullUnrollPhase(canonicalizer, new DefaultLoopPolicies()).apply(graph, context);
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.common.LockEliminationPhase in project graal by oracle.
the class LockEliminationTest method getGraph.
private StructuredGraph getGraph(String snippet) {
ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
StructuredGraph graph = parseEager(method, AllowAssumptions.YES);
HighTierContext context = getDefaultHighTierContext();
new CanonicalizerPhase().apply(graph, context);
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
new CanonicalizerPhase().apply(graph, context);
new DeadCodeEliminationPhase().apply(graph);
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
new LockEliminationPhase().apply(graph);
return graph;
}
use of org.graalvm.compiler.phases.common.LockEliminationPhase 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.common.LockEliminationPhase 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());
}
Aggregations