# HG changeset patch # User Thomas Wuerthinger # Date 1423106208 -3600 # Node ID f41186c896cdfa5ec7ed14e0413711042772c74e # Parent bb25b153433c36dada50dce342e12f3fc21183ef More folding on creation for object equality node. diff -r bb25b153433c -r f41186c896cd graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Thu Feb 05 04:10:59 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Thu Feb 05 04:16:48 2015 +0100 @@ -44,6 +44,10 @@ if (result != null) { return result; } else { + result = findSynonym(x, y); + if (result != null) { + return result; + } return new ObjectEqualsNode(x, y); } } @@ -85,7 +89,7 @@ /* * One of the two objects has identity, the other doesn't. In code, this looks like * "Integer.valueOf(a) == new Integer(b)", which is always false. - * + * * In other words: an object created via valueOf can never be equal to one created * by new in the same compilation unit. */ diff -r bb25b153433c -r f41186c896cd graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/PointerEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/PointerEqualsNode.java Thu Feb 05 04:10:59 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/PointerEqualsNode.java Thu Feb 05 04:16:48 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,14 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { + LogicNode result = findSynonym(forX, forY); + if (result != null) { + return result; + } + return super.canonical(tool, forX, forY); + } + + public static LogicNode findSynonym(ValueNode forX, ValueNode forY) { if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) { return LogicConstantNode.tautology(); } else if (forX.stamp().alwaysDistinct(forY.stamp())) { @@ -48,8 +56,9 @@ return new IsNullNode(forY); } else if (((AbstractPointerStamp) forY.stamp()).alwaysNull()) { return new IsNullNode(forX); + } else { + return null; } - return super.canonical(tool, forX, forY); } @Override