# HG changeset patch # User Lukas Stadler # Date 1396266356 -7200 # Node ID 8ebeb60167ee2dfabcda9d230240719f853eafad # Parent 5accc969c8c7038201b94077c1ce1cadbab8983f compare constants in graphs in GraalCompilerTest.assertEquals diff -r 5accc969c8c7 -r 8ebeb60167ee graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Mon Mar 31 13:45:40 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Mon Mar 31 13:45:56 2014 +0200 @@ -338,6 +338,6 @@ new DeadCodeEliminationPhase().apply(referenceGraph); new CanonicalizerPhase(true).apply(referenceGraph, context); - assertEquals(referenceGraph, graph, excludeVirtual); + assertEquals(referenceGraph, graph, excludeVirtual, true); } } diff -r 5accc969c8c7 -r 8ebeb60167ee graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Mar 31 13:45:40 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Mar 31 13:45:56 2014 +0200 @@ -142,7 +142,7 @@ } protected void assertEquals(StructuredGraph expected, StructuredGraph graph) { - assertEquals(expected, graph, false); + assertEquals(expected, graph, false, true); } protected int countUnusedConstants(StructuredGraph graph) { @@ -165,9 +165,9 @@ return graph.getNodeCount() - countUnusedConstants(graph); } - protected void assertEquals(StructuredGraph expected, StructuredGraph graph, boolean excludeVirtual) { - String expectedString = getCanonicalGraphString(expected, excludeVirtual); - String actualString = getCanonicalGraphString(graph, excludeVirtual); + protected void assertEquals(StructuredGraph expected, StructuredGraph graph, boolean excludeVirtual, boolean checkConstants) { + String expectedString = getCanonicalGraphString(expected, excludeVirtual, checkConstants); + String actualString = getCanonicalGraphString(graph, excludeVirtual, checkConstants); String mismatchString = "mismatch in graphs:\n========= expected =========\n" + expectedString + "\n\n========= actual =========\n" + actualString; if (!excludeVirtual && getNodeCountExcludingUnusedConstants(expected) != getNodeCountExcludingUnusedConstants(graph)) { @@ -183,7 +183,7 @@ } protected void assertConstantReturn(StructuredGraph graph, int value) { - String graphString = getCanonicalGraphString(graph, false); + String graphString = getCanonicalGraphString(graph, false, true); Assert.assertEquals("unexpected number of ReturnNodes: " + graphString, graph.getNodes(ReturnNode.class).count(), 1); ValueNode result = graph.getNodes(ReturnNode.class).first().result(); Assert.assertTrue("unexpected ReturnNode result node: " + graphString, result.isConstant()); @@ -191,7 +191,7 @@ Assert.assertEquals("unexpected ReturnNode result: " + graphString, result.asConstant().asInt(), value); } - protected static String getCanonicalGraphString(StructuredGraph graph, boolean excludeVirtual) { + protected static String getCanonicalGraphString(StructuredGraph graph, boolean excludeVirtual, boolean checkConstants) { SchedulePhase schedule = new SchedulePhase(); schedule.apply(graph); @@ -219,7 +219,7 @@ id = nextId++; canonicalId.set(node, id); } - String name = node instanceof ConstantNode ? node.toString(Verbosity.Name) : node.getClass().getSimpleName(); + String name = node instanceof ConstantNode && checkConstants ? node.toString(Verbosity.Name) : node.getClass().getSimpleName(); result.append(" " + id + "|" + name + (excludeVirtual ? "\n" : " (" + node.usages().count() + ")\n")); } } diff -r 5accc969c8c7 -r 8ebeb60167ee graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Mon Mar 31 13:45:40 2014 +0200 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Mon Mar 31 13:45:56 2014 +0200 @@ -67,7 +67,7 @@ InstalledCode result = truffleCompiler.compileMethodHelper(actual, assumptions, root.toString(), getSpeculationLog()); StructuredGraph expected = parseForComparison(methodName); removeFrameStates(actual); - Assert.assertEquals(getCanonicalGraphString(expected, true), getCanonicalGraphString(actual, true)); + Assert.assertEquals(getCanonicalGraphString(expected, true, true), getCanonicalGraphString(actual, true, true)); return result; }