Commits

Carl Friedrich Bolz committed e16936f

test and fix: NonNull is not more general than NULL (!!!)
fixes the test, but another bug is still around

Comments (0)

Files changed (3)

rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py

         assert isgeneral(OptValue(ConstPtr(fooref)),
                          OptValue(ConstPtr(fooref)))
 
+        value1 = OptValue(BoxPtr())
+        value1.make_nonnull(None)
+        value2 = OptValue(ConstPtr(LLtypeMixin.nullptr))
+        assert not isgeneral(value1, value2)
+
     def test_field_matching_generalization(self):
         const1 = NotVirtualStateInfo(OptValue(ConstInt(1)))
         const2 = NotVirtualStateInfo(OptValue(ConstInt(2)))

rpython/jit/metainterp/optimizeopt/virtualstate.py

         elif self.level == LEVEL_KNOWNCLASS:
             if not self.known_class.same_constant(other.known_class):
                 return False
+        elif self.level == LEVEL_NONNULL:
+            if other.constbox and not other.constbox.nonnull():
+                return False
+
         if not self.intbound.contains_bound(other.intbound):
             return False
         if self.lenbound and other.lenbound:

rpython/jit/metainterp/test/test_loop.py

         assert self.meta_interp(h, [25]) == 7 * 25 * (7 + 8 + 2 + 3)
 
     def test_two_bridged_loops_classes(self):
-        py.test.skip("fix me :-((((")
         myjitdriver = JitDriver(greens = ['pos'], reds = ['i', 'n', 'x', 's'])
         class A(object):
             pass