# HG changeset patch # User Lukas Stadler # Date 1365441300 -7200 # Node ID 1b2635aa6a1d4e97b7ba41d02eb34b27eba57246 # Parent fc972f34c1d5b8ca37c33b2fdd436d3ebafcfab2 PEA: handle identity-less objects in IntegerEqualsNode diff -r fc972f34c1d5 -r 1b2635aa6a1d 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 Mon Apr 08 19:14:32 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Mon Apr 08 19:15:00 2013 +0200 @@ -81,8 +81,28 @@ // one of them is virtual: they can never be the same objects tool.replaceWithValue(LogicConstantNode.contradiction(graph())); } else if (xVirtual && yVirtual) { - // both are virtual: check if they refer to the same object - tool.replaceWithValue(LogicConstantNode.forBoolean(stateX == stateY, graph())); + boolean xIdentity = stateX.getVirtualObject().hasIdentity(); + boolean yIdentity = stateY.getVirtualObject().hasIdentity(); + if (xIdentity ^ yIdentity) { + tool.replaceWithValue(LogicConstantNode.contradiction(graph())); + } else if (!xIdentity && !yIdentity) { + // both are virtual without identity: check contents + assert stateX.getVirtualObject().entryCount() == 1 && stateY.getVirtualObject().entryCount() == 1; + assert stateX.getVirtualObject().type() == stateY.getVirtualObject().type(); + assert stateX.getVirtualObject().entryKind(0) == Kind.Int || stateX.getVirtualObject().entryKind(0) == Kind.Long; + final IntegerEqualsNode equals = new IntegerEqualsNode(stateX.getEntry(0), stateY.getEntry(0)); + tool.customAction(new Runnable() { + + @Override + public void run() { + graph().add(equals); + } + }); + tool.replaceWithValue(equals); + } else { + // both are virtual with identity: check if they refer to the same object + tool.replaceWithValue(LogicConstantNode.forBoolean(stateX == stateY, graph())); + } } } }