117 testEarlyReadElimination(graph, 3, 3); |
117 testEarlyReadElimination(graph, 3, 3); |
118 } |
118 } |
119 |
119 |
120 public void testEarlyReadElimination(StructuredGraph graph, int reads, int writes) { |
120 public void testEarlyReadElimination(StructuredGraph graph, int reads, int writes) { |
121 CoreProviders context = getDefaultHighTierContext(); |
121 CoreProviders context = getDefaultHighTierContext(); |
122 CanonicalizerPhase canonicalizer = new CanonicalizerPhase(); |
122 CanonicalizerPhase canonicalizer = createCanonicalizerPhase(); |
123 canonicalizer.apply(graph, context); |
123 canonicalizer.apply(graph, context); |
124 new EarlyReadEliminationPhase(canonicalizer).apply(graph, context); |
124 new EarlyReadEliminationPhase(canonicalizer).apply(graph, context); |
125 Assert.assertEquals(3, graph.getNodes().filter(UnsafeAccessNode.class).count()); |
125 Assert.assertEquals(3, graph.getNodes().filter(UnsafeAccessNode.class).count()); |
126 // after lowering the same applies for reads and writes |
126 // after lowering the same applies for reads and writes |
127 new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); |
127 new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); |
132 } |
132 } |
133 |
133 |
134 public void testPartialEscapeReadElimination(StructuredGraph graph, int reads, int writes) { |
134 public void testPartialEscapeReadElimination(StructuredGraph graph, int reads, int writes) { |
135 OptionValues options = graph.getOptions(); |
135 OptionValues options = graph.getOptions(); |
136 CoreProviders context = getDefaultHighTierContext(); |
136 CoreProviders context = getDefaultHighTierContext(); |
137 CanonicalizerPhase canonicalizer = new CanonicalizerPhase(); |
137 CanonicalizerPhase canonicalizer = createCanonicalizerPhase(); |
138 canonicalizer.apply(graph, context); |
138 canonicalizer.apply(graph, context); |
139 new PartialEscapePhase(true, true, canonicalizer, null, options).apply(graph, context); |
139 new PartialEscapePhase(true, true, canonicalizer, null, options).apply(graph, context); |
140 Assert.assertEquals(3, graph.getNodes().filter(UnsafeAccessNode.class).count()); |
140 Assert.assertEquals(3, graph.getNodes().filter(UnsafeAccessNode.class).count()); |
141 // after lowering the same applies for reads and writes |
141 // after lowering the same applies for reads and writes |
142 new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); |
142 new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); |