< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EATestBase.java

Print this page

        

*** 150,166 **** for (ReturnNode returnNode : returnNodes) { Assert.assertTrue(returnNode.result().toString(), returnNode.result().isConstant()); Assert.assertEquals(expectedConstantResult, returnNode.result().asConstant()); } } ! int newInstanceCount = graph.getNodes().filter(isA(NewInstanceNode.class).or(NewArrayNode.class).or(AllocatedObjectNode.class)).count(); Assert.assertEquals("Expected allocation count does not match", expectedAllocationCount, newInstanceCount); if (expectedAllocationCount == 0) { Assert.assertTrue("Unexpected CommitAllocationNode", graph.getNodes().filter(CommitAllocationNode.class).isEmpty()); } } @SuppressWarnings("try") protected void prepareGraph(String snippet, boolean iterativeEscapeAnalysis) { ResolvedJavaMethod method = getResolvedJavaMethod(snippet); DebugContext debug = getDebugContext(); try (DebugContext.Scope s = debug.scope(getClass(), method, getCodeCache())) { --- 150,170 ---- for (ReturnNode returnNode : returnNodes) { Assert.assertTrue(returnNode.result().toString(), returnNode.result().isConstant()); Assert.assertEquals(expectedConstantResult, returnNode.result().asConstant()); } } ! int newInstanceCount = getAllocationCount(); Assert.assertEquals("Expected allocation count does not match", expectedAllocationCount, newInstanceCount); if (expectedAllocationCount == 0) { Assert.assertTrue("Unexpected CommitAllocationNode", graph.getNodes().filter(CommitAllocationNode.class).isEmpty()); } } + protected int getAllocationCount() { + return graph.getNodes().filter(isA(NewInstanceNode.class).or(NewArrayNode.class).or(AllocatedObjectNode.class)).count(); + } + @SuppressWarnings("try") protected void prepareGraph(String snippet, boolean iterativeEscapeAnalysis) { ResolvedJavaMethod method = getResolvedJavaMethod(snippet); DebugContext debug = getDebugContext(); try (DebugContext.Scope s = debug.scope(getClass(), method, getCodeCache())) {
< prev index next >