Mercurial > hg > truffle
changeset 20146:a927a3ccfd0d
fix canonicalization of ObjectEqualsNode to TypeCheckNode after fixing TypeCheckNode canonicalization
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 02 Apr 2015 19:23:19 +0200 |
parents | 80fda5775d0c |
children | 46bb6e576335 |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java |
diffstat | 1 files changed, 4 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Thu Apr 02 19:21:59 2015 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Thu Apr 02 19:23:19 2015 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.calc; -import com.oracle.graal.api.meta.Assumptions.AssumptionResult; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.calc.*; @@ -63,21 +62,10 @@ protected ValueNode canonicalizeSymmetricConstant(CanonicalizerTool tool, Constant constant, ValueNode nonConstant, boolean mirrored) { ResolvedJavaType type = tool.getConstantReflection().asJavaType(constant); if (type != null && nonConstant instanceof GetClassNode) { - if (type.isPrimitive()) { - return LogicConstantNode.forBoolean(false); + if (!type.isPrimitive() && (type.isConcrete() || type.isArray())) { + return TypeCheckNode.create(type, ((GetClassNode) nonConstant).getObject()); } - ResolvedJavaType exactType = type.asExactType(); - if (exactType == null) { - AssumptionResult<ResolvedJavaType> leafConcreteSubtype = type.findLeafConcreteSubtype(); - if (leafConcreteSubtype != null) { - graph().getAssumptions().record(leafConcreteSubtype); - exactType = leafConcreteSubtype.getResult(); - } - } - - if (type.equals(exactType)) { - return TypeCheckNode.create(exactType, ((GetClassNode) nonConstant).getObject()); - } + return LogicConstantNode.forBoolean(false); } return super.canonicalizeSymmetricConstant(tool, constant, nonConstant, mirrored); } @@ -119,7 +107,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. */