changeset 10740:bdd7c8e2293e

Merge
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Fri, 12 Jul 2013 23:26:01 +0200
parents cdbfff4547be f1904749e4fe
children 00a9dbcbe431 45dc193567c2
files
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 21:48:09 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Fri Jul 12 23:26:01 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);