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

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Mar 3 19:34:56 CET 2008


Author: cfbolz
Date: Mon Mar  3 19:34:55 2008
New Revision: 52101

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
Log:
indirect call with void arguments


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	Mon Mar  3 19:34:55 2008
@@ -815,6 +815,8 @@
 
         emitted_args = []
         for v in op.args[1:-1]:
+            if v.concretetype == lltype.Void:
+                continue
             emitted_args.append(self.serialize_oparg("red", v))
         self.emit("red_residual_call")
         calldescindex = self.calldesc_position(op.args[0].concretetype)
@@ -1313,8 +1315,12 @@
         self.hannotator = hannotator
 
     def transform_graph(self, graph):
+        from pypy.translator.backendopt.constfold import constant_fold_graph
         self.graph = graph
         remove_same_as(graph)
+        # to get rid of the we_are_jitted constant
+        # XXX not sure this is right, leaving commented out for now
+        #constant_fold_graph(graph)
         self.insert_splits()
 
     def insert_splits(self):

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	Mon Mar  3 19:34:55 2008
@@ -1839,6 +1839,24 @@
             return f(space, x, y)
         res = self.interpret(main2, [5, 6], policy=StopAtXPolicy(g))
         assert res == 11
+
+    def test_indirect_call_voidargs(self):
+        class Void(object):
+            def _freeze_(self):
+                return True
+        void = Void()
+        def h1(n, v):
+            return n*2
+        def h2(n, v):
+            return n*4
+        l = [h1, h2]
+        def f(n, x):
+            h = l[n&1]
+            return h(n, void) + x
+
+        res = self.interpret(f, [7, 3])
+        assert res == f(7, 3)
+        self.check_insns(indirect_call=1, direct_call=1)
             
 
 class TestLLType(SimpleTests):


More information about the pypy-svn mailing list