[pypy-svn] r79107 - pypy/branch/jit-starargs/pypy/module/pypyjit/test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Nov 15 15:44:18 CET 2010


Author: cfbolz
Date: Mon Nov 15 15:44:17 2010
New Revision: 79107

Modified:
   pypy/branch/jit-starargs/pypy/module/pypyjit/test/test_pypy_c.py
Log:
also a test where the list is prebuilt. in this case we get some array copying,
but the Argument object is still not forced.


Modified: pypy/branch/jit-starargs/pypy/module/pypyjit/test/test_pypy_c.py
==============================================================================
--- pypy/branch/jit-starargs/pypy/module/pypyjit/test/test_pypy_c.py	(original)
+++ pypy/branch/jit-starargs/pypy/module/pypyjit/test/test_pypy_c.py	Mon Nov 15 15:44:17 2010
@@ -382,7 +382,7 @@
         # XXX a bit too many guards, but better than before
         assert len(op.get_opnames("guard")) <= 10
 
-    def test_stararg(self):
+    def test_stararg_virtual(self):
         self.run_source('''
             d = {}
 
@@ -419,6 +419,34 @@
             assert len(op.get_opnames("new")) == 0
             assert len(op.get_opnames("call_may_force")) == 0
 
+    def test_stararg(self):
+        self.run_source('''
+            d = {}
+
+            def g(*args):
+                return args[-1]
+            def h(*args):
+                return len(args)
+
+            def main(x):
+                s = 0
+                l = []
+                i = 0
+                while i < x:
+                    l.append(1)
+                    s += g(*l)
+                    i = h(*l)
+                return s
+        ''', 100000, ([100], 100),
+                     ([1000], 1000),
+                     ([2000], 2000),
+                     ([4000], 4000))
+        assert len(self.loops) == 1
+        ops = self.get_by_bytecode("CALL_FUNCTION_VAR")
+        for op in ops:
+            assert len(op.get_opnames("new_with_vtable")) == 0
+            assert len(op.get_opnames("call_may_force")) == 0
+
     def test_virtual_instance(self):
         self.run_source('''
             class A(object):



More information about the Pypy-commit mailing list