changeset 15446:2f684eda1938

Merge
author Miguel Garcia <miguel.m.garcia@oracle.com>
date Tue, 29 Apr 2014 19:30:38 +0200
parents bda013e0d8bb (diff) 10023073e858 (current diff)
children 951647e16782 3774b6f4319b b3fbf52f34be
files
diffstat 5 files changed, 27 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/BaseReduction.java	Tue Apr 29 18:35:10 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/BaseReduction.java	Tue Apr 29 19:30:38 2014 +0200
@@ -208,7 +208,7 @@
      * </p>
      *
      */
-    protected static boolean precisionLoss(ValueNode input, ValueNode output) {
+    public static boolean precisionLoss(ValueNode input, ValueNode output) {
         ObjectStamp inputStamp = (ObjectStamp) input.stamp();
         ObjectStamp outputStamp = (ObjectStamp) output.stamp();
         if (FlowUtil.isMorePrecise(inputStamp.type(), outputStamp.type())) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/CheckCastReduction.java	Tue Apr 29 18:35:10 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/CheckCastReduction.java	Tue Apr 29 19:30:38 2014 +0200
@@ -299,9 +299,6 @@
         ObjectStamp subjectStamp = (ObjectStamp) subject.stamp();
         ResolvedJavaType subjectType = subjectStamp.type();
 
-        // TODO move this check to downcast()
-        assert !precisionLoss(checkCast.object(), subject);
-
         /*
          * At this point, two sources of (partial) information: the witness and the stamp of
          * subject. The latter might be more precise than the witness (eg, subject might be
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java	Tue Apr 29 18:35:10 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java	Tue Apr 29 19:30:38 2014 +0200
@@ -547,7 +547,7 @@
             return object;
         }
         if (StampTool.isObjectAlwaysNull(object.stamp())) {
-            return nonTrivialNull(object);
+            return object;
         }
 
         // ------------------------------------------
@@ -586,6 +586,8 @@
             result = downcastedUtil(object, w);
         }
 
+        assert !BaseReduction.precisionLoss(object, result);
+
         return result;
     }
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java	Tue Apr 29 18:35:10 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java	Tue Apr 29 19:30:38 2014 +0200
@@ -26,6 +26,7 @@
 import com.oracle.graal.graph.Node;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.FloatingNode;
+import com.oracle.graal.nodes.calc.IsNullNode;
 import com.oracle.graal.nodes.extended.LoadHubNode;
 import com.oracle.graal.nodes.extended.NullCheckNode;
 import com.oracle.graal.nodes.java.*;
@@ -37,6 +38,7 @@
 
 import java.lang.reflect.Modifier;
 
+import static com.oracle.graal.api.meta.DeoptimizationAction.InvalidateReprofile;
 import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 
 /**
@@ -134,7 +136,7 @@
     }
 
     private static boolean isAliveWithoutUsages(FloatingNode node) {
-        return node.isAlive() && node.usages().isEmpty();
+        return node.isAlive() && FlowUtil.lacksUsages(node);
     }
 
     private void registerControlSplit(Node pred, BeginNode begin) {
@@ -195,18 +197,13 @@
                 // `begin` denotes the default case of the TypeSwitchNode
                 return;
             }
-            // preferable would be trackExact, but not there yet
-            state.addNullness(false, loadHub.object(), begin);
             if (state.knownNotToConform(loadHub.object(), type)) {
                 postponedDeopts.addDeoptAfter(begin, UnreachedCode);
                 state.impossiblePath();
                 return;
             }
-            if (type.isInterface()) {
-                state.trackNN(loadHub.object(), begin);
-            } else {
-                state.trackIO(loadHub.object(), type, begin);
-            }
+            // it's unwarranted to assume loadHub.object() to be non-null
+            // it also seems unwarranted state.trackCC(loadHub.object(), type, begin);
         }
     }
 
@@ -437,6 +434,8 @@
      * <ul>
      * <li>is known to be null, an unconditional deopt is added.</li>
      * <li>is known to be non-null, the NullCheckNode is removed.</li>
+     * <li>otherwise, the NullCheckNode is lowered to a FixedGuardNode which then allows using it as
+     * anchor for state-tracking.</li>
      * </ul>
      *
      * <p>
@@ -459,7 +458,17 @@
             graph.removeFixed(ncn);
             return;
         }
-        // TODO ANCHOR NEEDED: state.trackNN(object, ncn);
+        /*
+         * Lower the NullCheckNode to a FixedGuardNode which then allows using it as anchor for
+         * state-tracking. TODO the assumption here is that the code emitted for the resulting
+         * FixedGuardNode is as efficient as for NullCheckNode.
+         */
+        IsNullNode isNN = graph.unique(new IsNullNode(object));
+        reasoner.added.add(isNN);
+        FixedGuardNode nullCheck = graph.add(new FixedGuardNode(isNN, UnreachedCode, InvalidateReprofile, true));
+        graph.replaceFixedWithFixed(ncn, nullCheck);
+
+        state.trackNN(object, nullCheck);
     }
 
     /**
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/State.java	Tue Apr 29 18:35:10 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/State.java	Tue Apr 29 19:30:38 2014 +0200
@@ -275,9 +275,11 @@
             return true;
         }
 
-        for (State state : withReachableStates) {
-            versionNr = Math.max(versionNr, state.versionNr) + 1;
-            isUnreachable &= state.isUnreachable;
+        for (State other : withReachableStates) {
+            versionNr = Math.max(versionNr, other.versionNr) + 1;
+            if (!other.isUnreachable) {
+                isUnreachable = false;
+            }
         }
 
         if (isUnreachable) {
@@ -685,16 +687,6 @@
             } else {
                 trackIO(object, instanceOf.type(), anchor);
             }
-        } else {
-            if (knownToConform(object, instanceOf.type())) {
-                impossiblePath(); // TODO this used to be a bug
-                return;
-            }
-            if (instanceOf.type().isInterface()) {
-                if (!knownNotToConform(object, instanceOf.type())) {
-                    addFactPrimordial(instanceOf, falseFacts, anchor);
-                }
-            }
         }
     }