[pypy-svn] r55241 - in pypy/branch/oo-jit/pypy/jit: rainbow/test timeshifter

antocuni at codespeak.net antocuni at codespeak.net
Mon May 26 12:42:54 CEST 2008


Author: antocuni
Date: Mon May 26 12:42:52 2008
New Revision: 55241

Modified:
   pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py
   pypy/branch/oo-jit/pypy/jit/timeshifter/oop.py
Log:
if oop_newlist gets an oopdesc that can be either for a fixed or non
fixed size list, the annotator complains that do_call doesn't receive
enough arguments.  It's right, but I think this code is never called
in that case. Not sure if it's needed or not, but at least now the
test passes.



Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py	Mon May 26 12:42:52 2008
@@ -602,6 +602,26 @@
         assert res == ll_function()
         self.check_insns({})
 
+    def test_force_fixed_vlist(self):
+        def a(flag):
+            lst = [0, 0, 0]
+            if flag:
+                lst[0] = 20
+            return lst[0]
+
+        def b(flag):
+            lst = [0]
+            if flag:
+                lst.append(22)
+            return lst[-1]
+        
+        def ll_function():
+            from pypy.rlib.nonconst import NonConstant
+            flag = NonConstant(True)
+            return a(flag) + b(flag)
+        res = self.timeshift_from_portal(ll_function, ll_function, [])
+        assert res == 42
+        self.check_insns({})
 
 
 class TestPortalOOType(BaseTestPortal):

Modified: pypy/branch/oo-jit/pypy/jit/timeshifter/oop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/timeshifter/oop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/timeshifter/oop.py	Mon May 26 12:42:52 2008
@@ -243,10 +243,7 @@
 class NewOopSpecDesc(AbstractOopSpecDesc):
     def _setup_oopdesc(self, RGenOp, TYPE):
         self.SELFTYPE = TYPE
-        self.ARGS = []
         self.RESULT = TYPE
-        self.OOPARGTYPES = []
-        self.residualargsources = []
         self.typename = TYPE.oopspec_name
         self.method = 'oop_new%s' % self.typename
         self.is_method = False
@@ -258,9 +255,15 @@
         if isinstance(TYPE, ootype.Array):
             def allocate(length):
                 return ootype.oonewarray(TYPE, length)
+            self.ARGS = [ootype.Signed]
+            self.OOPARGTYPES = [ootype.Signed]
+            self.residualargsources = [0]
             self.fnptr = self.rtyper.annotate_helper_fn(allocate,
                                                         [ootype.Signed])
         else:
+            self.ARGS = []
+            self.OOPARGTYPES = []
+            self.residualargsources = []
             def allocate():
                 return ootype.new(TYPE)
             self.fnptr = self.rtyper.annotate_helper_fn(allocate, [])



More information about the Pypy-commit mailing list