# HG changeset patch # User Bernhard Urban # Date 1366358970 -7200 # Node ID 78017d2c8beaaf1410b212303ba4e9032a48de0b # Parent cdd10396f2ad04d923627f0cfbc4de2876af90e2 InstanceOfNode: remove duplicated code diff -r cdd10396f2ad -r 78017d2c8bea graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Fri Apr 19 14:06:22 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Fri Apr 19 10:09:30 2013 +0200 @@ -63,7 +63,7 @@ ObjectStamp stamp = object().objectStamp(); ResolvedJavaType stampType = stamp.type(); - if (stamp.isExactType()) { + if (stamp.isExactType() || stampType != null) { boolean subType = type().isAssignableFrom(stampType); if (subType) { @@ -77,27 +77,15 @@ return graph().unique(new IsNullNode(object())); } } else { - // since this type check failed for an exact type we know that it can never succeed - // at run time. - // we also don't care about null values, since they will also make the check fail. - return LogicConstantNode.contradiction(graph()); - } - } else if (stampType != null) { - boolean subType = type().isAssignableFrom(stampType); - - if (subType) { - if (stamp.nonNull()) { - // the instanceOf matches, so return true - return LogicConstantNode.tautology(graph()); + if (stamp.isExactType()) { + // since this type check failed for an exact type we know that it can never + // succeed at run time. we also don't care about null values, since they will + // also make the check fail. + return LogicConstantNode.contradiction(graph()); } else { - // the instanceof matches if the object is non-null, so return true depending on - // the null-ness. - negateUsages(); - return graph().unique(new IsNullNode(object())); + // since the subtype comparison was only performed on a declared type we don't + // really know if it might be true at run time... } - } else { - // since the subtype comparison was only performed on a declared type we don't - // really know if it might be true at run time... } } if (object().objectStamp().alwaysNull()) {