use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class MemoryScheduleTest method getFinalSchedule.
@SuppressWarnings("try")
private ScheduleResult getFinalSchedule(final String snippet, final TestMode mode, final SchedulingStrategy schedulingStrategy) {
OptionValues options = new OptionValues(getInitialOptions(), OptScheduleOutOfLoops, schedulingStrategy == SchedulingStrategy.LATEST_OUT_OF_LOOPS, OptImplicitNullChecks, false);
final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO, options);
DebugContext debug = graph.getDebug();
try (DebugContext.Scope d = debug.scope("FloatingReadTest", graph)) {
HighTierContext context = getDefaultHighTierContext();
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
canonicalizer.apply(graph, context);
if (mode == TestMode.INLINED_WITHOUT_FRAMESTATES) {
new InliningPhase(canonicalizer).apply(graph, context);
}
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
if (mode == TestMode.WITHOUT_FRAMESTATES || mode == TestMode.INLINED_WITHOUT_FRAMESTATES) {
graph.clearAllStateAfter();
}
debug.dump(DebugContext.BASIC_LEVEL, graph, "after removal of framestates");
new FloatingReadPhase().apply(graph);
new RemoveValueProxyPhase().apply(graph);
MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo());
new GuardLoweringPhase().apply(graph, midContext);
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, midContext);
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.LOW_TIER).apply(graph, midContext);
SchedulePhase schedule = new SchedulePhase(schedulingStrategy);
schedule.apply(graph);
assertDeepEquals(1, graph.getNodes().filter(StartNode.class).count());
return graph.getLastSchedule();
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class NodePropertiesTest method testFieldStore.
@Test
public void testFieldStore() {
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("fieldStore"));
HighTierContext htc = getDefaultHighTierContext();
new CanonicalizerPhase().apply(g1, htc);
GraphCostPhase gc1 = new GraphCostPhase();
gc1.apply(g1, htc);
Assert.assertEquals(15, gc1.finalCycles, 25);
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class NodePropertiesTest method testFieldLoad.
@Test
public void testFieldLoad() {
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("fieldLoad"));
HighTierContext htc = getDefaultHighTierContext();
new CanonicalizerPhase().apply(g1, htc);
GraphCostPhase gc1 = new GraphCostPhase();
gc1.apply(g1, htc);
Assert.assertEquals(15, gc1.finalCycles, 25);
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class NodePropertiesTest method testArrayStore.
@Test
public void testArrayStore() {
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("arrayStoreTest"));
HighTierContext htc = getDefaultHighTierContext();
new CanonicalizerPhase().apply(g1, htc);
GraphCostPhase gc1 = new GraphCostPhase();
gc1.apply(g1, htc);
Assert.assertEquals(15, gc1.finalCycles, 25);
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class NodePropertiesTest method testDifferentLoopFaster.
@Test
public void testDifferentLoopFaster() {
HighTierContext htc = getDefaultHighTierContext();
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("testLoop01"));
StructuredGraph g2 = parseForCompile(getResolvedJavaMethod("testLoop03"));
prepareGraphForLoopFrequencies(g1, htc);
prepareGraphForLoopFrequencies(g2, htc);
assertFrequency(g1, ITERATIONS_LOOP_1);
assertFrequency(g2, ITERATIONS_LOOP_1);
GraphCostPhase gc1 = new GraphCostPhase();
GraphCostPhase gc2 = new GraphCostPhase();
gc1.apply(g1, htc);
gc2.apply(g2, htc);
g1.getDebug().log("Test testDifferentLoopFaster --> 1.Graph cycles:%f size:%f vs. 2.Graph cycles:%f size:%f\n", gc1.finalCycles, gc1.finalSize, gc2.finalCycles, gc2.finalSize);
Assert.assertTrue(gc2.finalCycles > gc1.finalCycles);
Assert.assertTrue(gc2.finalSize == gc1.finalSize);
}
Aggregations