# HG changeset patch # User Doug Simon # Date 1373662325 -7200 # Node ID f1904749e4fe80683190d0ba8f937b140253d1cd # Parent 2a4ad6ab345eb59c4b6296246caf1ad3d8704c74 re-enabled new lowering of checkcast with addition of a null-check guard where the profile has nullSeen=FALSE diff -r 2a4ad6ab345e -r f1904749e4fe graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- 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);