Mercurial > hg > graal-compiler
changeset 10708:41e9c8845826
Improve instanceof canonicalization
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 11 Jul 2013 14:47:52 +0200 |
parents | a643c88d164f |
children | 5888e1772ba1 |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Thu Jul 11 14:45:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Thu Jul 11 14:47:52 2013 +0200 @@ -61,8 +61,11 @@ assert object() != null : this; ObjectStamp stamp = object().objectStamp(); + if (object().objectStamp().alwaysNull()) { + return LogicConstantNode.contradiction(graph()); + } + ResolvedJavaType stampType = stamp.type(); - if (stamp.isExactType() || stampType != null) { boolean subType = type().isAssignableFrom(stampType); @@ -83,14 +86,15 @@ // also make the check fail. return LogicConstantNode.contradiction(graph()); } else { + boolean superType = stampType.isAssignableFrom(type()); + if (!superType && !stampType.isInterface() && !type().isInterface()) { + return LogicConstantNode.contradiction(graph()); + } // 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()) { - return LogicConstantNode.contradiction(graph()); - } return this; }