use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class ImplicitNullCheckTest method test.
@SuppressWarnings("try")
private void test(final String snippet) {
DebugContext debug = getDebugContext();
try (DebugContext.Scope s = debug.scope("FloatingReadTest", new DebugDumpScope(snippet))) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES, debug);
PhaseContext context = new PhaseContext(getProviders());
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
new FloatingReadPhase().apply(graph);
MidTierContext midTierContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo());
new GuardLoweringPhase().apply(graph, midTierContext);
Assert.assertEquals(0, graph.getNodes(DeoptimizeNode.TYPE).count());
Assert.assertTrue(graph.getNodes().filter(ReadNode.class).first().canNullCheck());
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class PhiCreationTests method test3.
@Test
public void test3() {
StructuredGraph graph = parseEager("test3Snippet", AllowAssumptions.YES);
DebugContext debug = graph.getDebug();
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
Assert.assertFalse(graph.getNodes().filter(ValuePhiNode.class).iterator().hasNext());
}
use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class PushThroughIfTest method test.
private void test(String snippet, String reference) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
DebugContext debug = graph.getDebug();
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) {
fs.replaceAtUsages(null);
GraphUtil.killWithUnusedFloatingInputs(fs);
}
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES);
for (FrameState fs : referenceGraph.getNodes(FrameState.TYPE).snapshot()) {
fs.replaceAtUsages(null);
GraphUtil.killWithUnusedFloatingInputs(fs);
}
new CanonicalizerPhase().apply(referenceGraph, new PhaseContext(getProviders()));
assertEquals(referenceGraph, graph);
}
use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class ReadAfterCheckCastTest method test.
@SuppressWarnings("try")
private void test(final String snippet) {
DebugContext debug = getDebugContext();
try (DebugContext.Scope s = debug.scope("ReadAfterCheckCastTest", new DebugDumpScope(snippet))) {
// check shape of graph, with lots of assumptions. will probably fail if graph
// structure changes significantly
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
PhaseContext context = new PhaseContext(getProviders());
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
new FloatingReadPhase().apply(graph);
canonicalizer.apply(graph, context);
debug.dump(DebugContext.BASIC_LEVEL, graph, "After lowering");
for (FloatingReadNode node : graph.getNodes(ParameterNode.TYPE).first().usages().filter(FloatingReadNode.class)) {
// Checking that the parameter a is not directly used for the access to field
// x10 (because x10 must be guarded by the checkcast).
Assert.assertTrue(node.getLocationIdentity().isImmutable());
}
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class TraceLinearScanRegisterAllocationPhase method allocateRegisters.
@SuppressWarnings("try")
private static void allocateRegisters(TraceLinearScan allocator) {
DebugContext debug = allocator.getDebug();
try (Indent indent = debug.logAndIndent("allocate registers")) {
FixedInterval precoloredIntervals = allocator.createFixedUnhandledList();
TraceInterval notPrecoloredIntervals = allocator.createUnhandledListByFrom(TraceLinearScanPhase.IS_VARIABLE_INTERVAL);
// allocate cpu registers
TraceLinearScanWalker lsw = new TraceLinearScanWalker(allocator, precoloredIntervals, notPrecoloredIntervals);
lsw.walk();
lsw.finishAllocation();
}
}
Aggregations