comparison graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java @ 11959:23ccaa863eda

made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
author Doug Simon <doug.simon@oracle.com>
date Thu, 10 Oct 2013 16:14:55 +0200
parents 65cedae2647e
children 0fc653a9e019
comparison
equal deleted inserted replaced
11958:a0f5be106e67 11959:23ccaa863eda
59 @Test 59 @Test
60 public void testLock() { 60 public void testLock() {
61 test("testSynchronizedSnippet", new A(), new A()); 61 test("testSynchronizedSnippet", new A(), new A());
62 62
63 StructuredGraph graph = getGraph("testSynchronizedSnippet"); 63 StructuredGraph graph = getGraph("testSynchronizedSnippet");
64 new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); 64 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements));
65 new LockEliminationPhase().apply(graph); 65 new LockEliminationPhase().apply(graph);
66 assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); 66 assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count());
67 assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); 67 assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
68 } 68 }
69 69
77 @Test 77 @Test
78 public void testSynchronizedMethod() { 78 public void testSynchronizedMethod() {
79 test("testSynchronizedMethodSnippet", new A()); 79 test("testSynchronizedMethodSnippet", new A());
80 80
81 StructuredGraph graph = getGraph("testSynchronizedMethodSnippet"); 81 StructuredGraph graph = getGraph("testSynchronizedMethodSnippet");
82 new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime(), null, replacements)); 82 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getMetaAccess(), getCodeCache(), null, replacements));
83 new LockEliminationPhase().apply(graph); 83 new LockEliminationPhase().apply(graph);
84 assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); 84 assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count());
85 assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); 85 assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
86 } 86 }
87 87
88 private StructuredGraph getGraph(String snippet) { 88 private StructuredGraph getGraph(String snippet) {
89 Method method = getMethod(snippet); 89 Method method = getMethod(snippet);
90 StructuredGraph graph = parse(method); 90 StructuredGraph graph = parse(method);
91 PhasePlan phasePlan = getDefaultPhasePlan(); 91 PhasePlan phasePlan = getDefaultPhasePlan();
92 Assumptions assumptions = new Assumptions(true); 92 Assumptions assumptions = new Assumptions(true);
93 HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); 93 HighTierContext context = new HighTierContext(getMetaAccess(), getCodeCache(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL);
94 new CanonicalizerPhase(true).apply(graph, context); 94 new CanonicalizerPhase(true).apply(graph, context);
95 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); 95 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context);
96 new CanonicalizerPhase(true).apply(graph, context); 96 new CanonicalizerPhase(true).apply(graph, context);
97 new DeadCodeEliminationPhase().apply(graph); 97 new DeadCodeEliminationPhase().apply(graph);
98 new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); 98 new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context);