use of org.graalvm.compiler.nodes.StructuredGraph in project graal by oracle.
the class TypeSystemTest method testHelper.
private <T extends Node> void testHelper(String snippet, Class<T> clazz) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
DebugContext debug = graph.getDebug();
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph " + snippet);
Assert.assertFalse("shouldn't have nodes of type " + clazz, graph.getNodes().filter(clazz).iterator().hasNext());
}
use of org.graalvm.compiler.nodes.StructuredGraph in project graal by oracle.
the class UnbalancedMonitorsTest method checkForBailout.
private void checkForBailout(String name) throws ClassNotFoundException {
ResolvedJavaMethod method = getResolvedJavaMethod(LOADER.findClass(INNER_CLASS_NAME), name);
try {
OptionValues options = getInitialOptions();
StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options, null, method)).method(method).build();
Plugins plugins = new Plugins(new InvocationPlugins());
GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true);
OptimisticOptimizations optimisticOpts = OptimisticOptimizations.NONE;
GraphBuilderPhase.Instance graphBuilder = new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), null, null, graphBuilderConfig, optimisticOpts, null);
graphBuilder.apply(graph);
} catch (BailoutException e) {
if (e.getMessage().contains("unbalanced monitors")) {
return;
}
throw e;
}
assertTrue("should have bailed out", false);
}
use of org.graalvm.compiler.nodes.StructuredGraph in project graal by oracle.
the class UncheckedInterfaceProviderTest method test.
@Test
public void test() {
StructuredGraph graph = parseEager("snippet", StructuredGraph.AllowAssumptions.YES);
for (BlackholeNode b : graph.getNodes().filter(BlackholeNode.class)) {
Assert.assertThat(b.getValue(), is(instanceOf(UncheckedInterfaceProvider.class)));
Stamp uncheckedStamp = ((UncheckedInterfaceProvider) b.getValue()).uncheckedStamp();
String context = b.getValue().toString(Verbosity.Debugger);
Assert.assertNotNull(context, uncheckedStamp);
ResolvedJavaType uncheckedType = StampTool.typeOrNull(uncheckedStamp);
ResolvedJavaType type = StampTool.typeOrNull(b.getValue());
Assert.assertEquals(context, arrayDepth(type), arrayDepth(uncheckedType));
Assert.assertTrue(context + ": " + type, type == null || type.getElementalType().isJavaLangObject());
Assert.assertNotNull(context, uncheckedType);
Assert.assertTrue(context, uncheckedType.getElementalType().isInterface());
}
}
use of org.graalvm.compiler.nodes.StructuredGraph in project graal by oracle.
the class UnsafeReadEliminationTest method test02.
@Test
public void test02() {
StructuredGraph graph = parseEager("test1Snippet", AllowAssumptions.NO);
testPartialEscapeReadElimination(graph, 3, 2);
}
use of org.graalvm.compiler.nodes.StructuredGraph in project graal by oracle.
the class UnsafeReadEliminationTest method test01.
@Test
public void test01() {
StructuredGraph graph = parseEager("test1Snippet", AllowAssumptions.NO);
testEarlyReadElimination(graph, 3, 2);
}
Aggregations