[pypy-svn] r32008 - in pypy/dist/pypy/jit/timeshifter: . test

pedronis at codespeak.net pedronis at codespeak.net
Tue Sep 5 14:47:45 CEST 2006


Author: pedronis
Date: Tue Sep  5 14:47:37 2006
New Revision: 32008

Modified:
   pypy/dist/pypy/jit/timeshifter/rtyper.py
   pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
Log:
(arre, pedronis)

bug fix and test for cast_pointer timeshifting.



Modified: pypy/dist/pypy/jit/timeshifter/rtyper.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rtyper.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/rtyper.py	Tue Sep  5 14:47:37 2006
@@ -217,7 +217,7 @@
 
     def translate_op_cast_pointer(self, hop):
         FROM_TYPE = originalconcretetype(hop.args_s[0])
-        v_argbox = hop.inputargs(self.getredrepr(FROM_TYPE))
+        [v_argbox] = hop.inputargs(self.getredrepr(FROM_TYPE))
         return v_argbox
 
     def translate_op_malloc(self, hop):

Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py	Tue Sep  5 14:47:37 2006
@@ -704,6 +704,24 @@
         assert res == 42
         self.check_insns({'int_lt': 1, 'int_mul': 1, 'int_sub': 1})
 
+
+    def test_red_subcontainer_cast(self):
+        S = lltype.GcStruct('S', ('n', lltype.Signed))
+        T = lltype.GcStruct('T', ('s', S), ('n', lltype.Float))
+        def ll_function(k):
+            t = lltype.malloc(T)
+            s = lltype.cast_pointer(lltype.Ptr(S), t)
+            s.n = k
+            if k < 0:
+                return -123
+            result = s.n * (k-1)
+            keepalive_until_here(t)
+            return result
+        res = self.timeshift(ll_function, [7], [], policy=P_NOVIRTUAL)
+        assert res == 42
+        self.check_insns({'int_lt': 1, 'int_mul': 1, 'int_sub': 1})
+
+
     def test_merge_structures(self):
         S = lltype.GcStruct('S', ('n', lltype.Signed))
         T = lltype.GcStruct('T', ('s', lltype.Ptr(S)), ('n', lltype.Signed))



More information about the Pypy-commit mailing list