changeset 15440:10274c654f75

[flow-sensitive] no-precision-loss check in downcast
author Miguel Garcia <miguel.m.garcia@oracle.com>
date Tue, 29 Apr 2014 16:53:35 +0200
parents 62f455eba8c5
children 97e0f9ec5752
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/BaseReduction.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/CheckCastReduction.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java
diffstat 3 files changed, 3 insertions(+), 4 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 16:16:27 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/BaseReduction.java	Tue Apr 29 16:53:35 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 16:16:27 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/CheckCastReduction.java	Tue Apr 29 16:53:35 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 16:16:27 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java	Tue Apr 29 16:53:35 2014 +0200
@@ -586,6 +586,8 @@
             result = downcastedUtil(object, w);
         }
 
+        assert !BaseReduction.precisionLoss(object, result);
+
         return result;
     }