[pypy-svn] r51963 - in pypy/branch/jit-refactoring/pypy/jit/rainbow: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Feb 29 18:04:32 CET 2008


Author: cfbolz
Date: Fri Feb 29 18:04:31 2008
New Revision: 51963

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
Log:
support debug_assert


Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py	Fri Feb 29 18:04:31 2008
@@ -669,7 +669,11 @@
         return result
 
     def serialize_op_debug_assert(self, op):
-        pass
+        v = op.args[0]
+        srcopname, srcargs = self.trace_back_bool_var(self.current_block, v)
+        if srcopname in ('ptr_iszero', 'ptr_nonzero'):
+            arg = self.serialize_oparg("red", srcargs[0])
+            self.emit("learn_nonzeroness", arg, srcopname == "ptr_nonzero")
 
     def serialize_op_direct_call(self, op):
         kind, withexc = self.guess_call_kind(op)

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py	Fri Feb 29 18:04:31 2008
@@ -403,6 +403,10 @@
         return rtimeshift.genptreq(self.jitstate, ptrbox1,
                                    ptrbox2, True)
 
+    @arguments("red", "bool")
+    def opimpl_learn_nonzeroness(self, ptrbox, nonzero):
+        rtimeshift.learn_nonzeroness(self.jitstate, ptrbox, nonzero)
+
     @arguments()
     def opimpl_red_return(self):
         rtimeshift.save_return(self.jitstate)

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py	Fri Feb 29 18:04:31 2008
@@ -14,6 +14,7 @@
 from pypy.rpython.module.support import LLSupport
 from pypy.annotation import model as annmodel
 from pypy.objspace.flow.model import summary, Variable
+from pypy.rlib.debug import ll_assert
 from pypy.rlib.jit import hint
 from pypy.rlib.objectmodel import keepalive_until_here
 from pypy import conftest
@@ -1299,7 +1300,6 @@
         self.check_insns(int_mul=1, int_add=0)
 
     def test_debug_assert_ptr_nonzero(self):
-        py.test.skip("not working yet")
         S = lltype.GcStruct('s', ('x', lltype.Signed))
         def h():
             s = lltype.malloc(S)



More information about the Pypy-commit mailing list