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

pedronis at codespeak.net pedronis at codespeak.net
Tue Feb 21 00:32:18 CET 2006


Author: pedronis
Date: Tue Feb 21 00:32:15 2006
New Revision: 23533

Modified:
   pypy/dist/pypy/jit/hinttimeshift.py
   pypy/dist/pypy/jit/test/test_hint_timeshift.py
Log:
use the .annotation() helper directly. Test for a so far not covered path.



Modified: pypy/dist/pypy/jit/hinttimeshift.py
==============================================================================
--- pypy/dist/pypy/jit/hinttimeshift.py	(original)
+++ pypy/dist/pypy/jit/hinttimeshift.py	Tue Feb 21 00:32:15 2006
@@ -93,7 +93,7 @@
                 v_value = llops.genmixlevelhelpercall(rtimeshift.ll_getvalue,
                     [self.s_RedBox, s_TYPE],
                     [v_box, c_TYPE],
-                    annmodel.lltype_to_annotation(r.lowleveltype))
+                    r.annotation())
                                                 
                 reenter_vars.append(v_value)
 
@@ -187,10 +187,9 @@
         return newblock
 
     def make_const_box(self, llops, r_green, v_value):
-        s_value = annmodel.lltype_to_annotation(r_green.lowleveltype)
         v_box = llops.genmixlevelhelpercall(
             rtimeshift.ConstRedBox.ll_fromvalue,
-            [s_value], [v_value], self.s_RedBox)
+            [r_green.annotation()], [v_value], self.s_RedBox)
         return v_box
         
                                                          

Modified: pypy/dist/pypy/jit/test/test_hint_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_hint_timeshift.py	(original)
+++ pypy/dist/pypy/jit/test/test_hint_timeshift.py	Tue Feb 21 00:32:15 2006
@@ -214,6 +214,19 @@
     assert res == 66
     assert insns == {}
 
+def test_green_across_split():
+    def ll_function(x, y):
+        hint(x, concrete=True)
+        if y > 2:
+            z = x - y
+        else:
+            z = x + y
+        return z
+    insns, res = timeshift(ll_function, [70, 4], [0])
+    assert res == 66
+    assert insns['int_add'] == 1
+    assert insns['int_add'] == 1
+
 def test_arith_plus_minus():
     def ll_plus_minus(encoded_insn, nb_insn, x, y):
         acc = x



More information about the Pypy-commit mailing list