[pypy-svn] r65910 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test

antocuni at codespeak.net antocuni at codespeak.net
Wed Jun 24 14:31:08 CEST 2009


Author: antocuni
Date: Wed Jun 24 14:31:08 2009
New Revision: 65910

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_send.py
Log:
don't pass void arguments to residual oosends


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py	Wed Jun 24 14:31:08 2009
@@ -1302,7 +1302,9 @@
         methdescr = self.codewriter.get_methdescr(SELFTYPE, methname, False)
         self.emit('residual_oosend_canraise')
         self.emit(self.get_position(methdescr))
-        self.emit_varargs(op.args[1:])
+        non_void_args = [arg for arg in op.args[1:]
+                         if arg.concretetype is not ootype.Void]
+        self.emit_varargs(non_void_args)
         self.register_var(op.result)
 
     def serialize_op_debug_assert(self, op):

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_send.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_send.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_send.py	Wed Jun 24 14:31:08 2009
@@ -491,6 +491,37 @@
         else:
             self.check_loops(call=1)
 
+
+    def test_residual_oosend_with_void(self):
+        myjitdriver = JitDriver(greens=[], reds = ['i', 'obj'])
+        class A:
+            def foo(self, other):
+                return 41
+            def _freeze_(self):
+                return True
+        def new(n):
+            if n:
+                return A()
+            else:
+                return None
+        pbc = A()
+        def fn(n, i):
+            res = 0
+            obj = new(n)
+            while i > 0:
+                myjitdriver.can_enter_jit(i=i, obj=obj)
+                myjitdriver.jit_merge_point(i=i, obj=obj)
+                res = obj.foo(pbc)
+                i-=1
+            return res
+        policy = StopAtXPolicy(new, A.foo.im_func)
+        res = self.meta_interp(fn, [1, 20], policy=policy)
+        assert res == 41
+        if self.type_system == 'ootype':
+            self.check_loops(oosend=1)
+        else:
+            self.check_loops(call=1)
+
 class TestOOtype(SendTests, OOJitMixin):
     pass
 



More information about the Pypy-commit mailing list