Search in sources :

Example 1 with AllowAssumptions

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));
}
Also used : LeafType(jdk.vm.ci.meta.Assumptions.LeafType) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) AllowAssumptions(org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions) Assumptions(jdk.vm.ci.meta.Assumptions) NoFinalizableSubclass(jdk.vm.ci.meta.Assumptions.NoFinalizableSubclass) RegisterFinalizerNode(org.graalvm.compiler.nodes.java.RegisterFinalizerNode) Assumption(jdk.vm.ci.meta.Assumptions.Assumption)

Aggregations

Assumptions (jdk.vm.ci.meta.Assumptions)1 Assumption (jdk.vm.ci.meta.Assumptions.Assumption)1 LeafType (jdk.vm.ci.meta.Assumptions.LeafType)1 NoFinalizableSubclass (jdk.vm.ci.meta.Assumptions.NoFinalizableSubclass)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 AllowAssumptions (org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions)1 RegisterFinalizerNode (org.graalvm.compiler.nodes.java.RegisterFinalizerNode)1