55 */
56 public static class NoFinalizerEverAAAA {
57 }
58
59 public static class NoFinalizerYetAAAA {
60 }
61
62 public static final class WithFinalizerAAAA extends NoFinalizerYetAAAA {
63
64 @Override
65 protected void finalize() throws Throwable {
66 super.finalize();
67 }
68 }
69
70 private StructuredGraph parseAndProcess(Class<?> cl, AllowAssumptions allowAssumptions) {
71 Constructor<?>[] constructors = cl.getConstructors();
72 Assert.assertTrue(constructors.length == 1);
73 final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(constructors[0]);
74 OptionValues options = getInitialOptions();
75 StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options), allowAssumptions).method(javaMethod).build();
76
77 GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(getDefaultGraphBuilderPlugins());
78 new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), getProviders().getConstantFieldProvider(), conf,
79 OptimisticOptimizations.ALL, null).apply(graph);
80 HighTierContext context = new HighTierContext(getProviders(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
81 new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
82 new CanonicalizerPhase().apply(graph, context);
83 return graph;
84 }
85
86 private void checkForRegisterFinalizeNode(Class<?> cl, boolean shouldContainFinalizer, AllowAssumptions allowAssumptions) {
87 StructuredGraph graph = parseAndProcess(cl, allowAssumptions);
88 Assert.assertTrue(graph.getNodes().filter(RegisterFinalizerNode.class).count() == (shouldContainFinalizer ? 1 : 0));
89 int noFinalizerAssumption = 0;
90 Assumptions assumptions = graph.getAssumptions();
91 if (assumptions != null) {
92 for (Assumption a : assumptions) {
93 if (a instanceof NoFinalizableSubclass) {
94 noFinalizerAssumption++;
95 } else if (a instanceof LeafType) {
|
55 */
56 public static class NoFinalizerEverAAAA {
57 }
58
59 public static class NoFinalizerYetAAAA {
60 }
61
62 public static final class WithFinalizerAAAA extends NoFinalizerYetAAAA {
63
64 @Override
65 protected void finalize() throws Throwable {
66 super.finalize();
67 }
68 }
69
70 private StructuredGraph parseAndProcess(Class<?> cl, AllowAssumptions allowAssumptions) {
71 Constructor<?>[] constructors = cl.getConstructors();
72 Assert.assertTrue(constructors.length == 1);
73 final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(constructors[0]);
74 OptionValues options = getInitialOptions();
75 StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options, null, javaMethod), allowAssumptions).method(javaMethod).build();
76
77 GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(getDefaultGraphBuilderPlugins());
78 new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), getProviders().getConstantFieldProvider(), conf,
79 OptimisticOptimizations.ALL, null).apply(graph);
80 HighTierContext context = new HighTierContext(getProviders(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
81 new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
82 new CanonicalizerPhase().apply(graph, context);
83 return graph;
84 }
85
86 private void checkForRegisterFinalizeNode(Class<?> cl, boolean shouldContainFinalizer, AllowAssumptions allowAssumptions) {
87 StructuredGraph graph = parseAndProcess(cl, allowAssumptions);
88 Assert.assertTrue(graph.getNodes().filter(RegisterFinalizerNode.class).count() == (shouldContainFinalizer ? 1 : 0));
89 int noFinalizerAssumption = 0;
90 Assumptions assumptions = graph.getAssumptions();
91 if (assumptions != null) {
92 for (Assumption a : assumptions) {
93 if (a instanceof NoFinalizableSubclass) {
94 noFinalizerAssumption++;
95 } else if (a instanceof LeafType) {
|