use of org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions in project graal by oracle.
the class FinalizableSubclassTest method checkForRegisterFinalizeNode.
private void checkForRegisterFinalizeNode(Class<?> cl, boolean shouldContainFinalizer, AllowAssumptions allowAssumptions) {
StructuredGraph graph = parseAndProcess(cl, allowAssumptions);
Assert.assertTrue(graph.getNodes().filter(RegisterFinalizerNode.class).count() == (shouldContainFinalizer ? 1 : 0));
int noFinalizerAssumption = 0;
Assumptions assumptions = graph.getAssumptions();
if (assumptions != null) {
for (Assumption a : assumptions) {
if (a instanceof NoFinalizableSubclass) {
noFinalizerAssumption++;
} else if (a instanceof LeafType) {
// Need to also allow leaf type assumption instead of no finalizable subclass
// assumption.
noFinalizerAssumption++;
}
}
}
Assert.assertTrue(noFinalizerAssumption == (shouldContainFinalizer ? 0 : 1));
}
Aggregations