Mercurial > hg > truffle
changeset 10730:f1904749e4fe
re-enabled new lowering of checkcast with addition of a null-check guard where the profile has nullSeen=FALSE
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 12 Jul 2013 22:52:05 +0200 |
parents | 2a4ad6ab345e |
children | bdd7c8e2293e |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Fri Jul 12 19:09:52 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Fri Jul 12 22:52:05 2013 +0200 @@ -25,7 +25,9 @@ import static com.oracle.graal.api.code.DeoptimizationAction.*; import static com.oracle.graal.api.meta.DeoptimizationReason.*; +import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.meta.ProfilingInfo.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; @@ -68,7 +70,7 @@ // TODO (ds) remove once performance regression in compiler.sunflow (and other benchmarks) // caused by new lowering is fixed - private static final boolean useNewLowering = Boolean.getBoolean("graal.checkcast.useNewLowering"); + private static final boolean useNewLowering = true; // Boolean.getBoolean("graal.checkcast.useNewLowering"); /** * Lowers a {@link CheckCastNode} to a {@link GuardingPiNode}. That is: @@ -109,7 +111,14 @@ } else if (object.stamp().nonNull()) { condition = typeTest; } else { - condition = graph().unique(new LogicDisjunctionNode(graph().unique(new IsNullNode(object)), typeTest)); + if (profile != null && profile.getNullSeen() == TriState.FALSE) { + FixedGuardNode nullGuard = graph().add(new FixedGuardNode(graph().unique(new IsNullNode(object)), UnreachedCode, DeoptimizationAction.InvalidateReprofile, true)); + graph().addBeforeFixed(this, nullGuard); + condition = typeTest; + stamp = stamp.join(StampFactory.objectNonNull()); + } else { + condition = graph().unique(new LogicDisjunctionNode(graph().unique(new IsNullNode(object)), typeTest)); + } } GuardingPiNode checkedObject = graph().add(new GuardingPiNode(object, condition, false, forStoreCheck ? ArrayStoreException : ClassCastException, InvalidateReprofile, stamp)); graph().replaceFixedWithFixed(this, checkedObject);