[pypy-svn] r67730 - in pypy/trunk/pypy: jit/metainterp jit/metainterp/test rpython/ootypesystem

antocuni at codespeak.net antocuni at codespeak.net
Thu Sep 17 12:41:57 CEST 2009


Author: antocuni
Date: Thu Sep 17 12:41:54 2009
New Revision: 67730

Modified:
   pypy/trunk/pypy/jit/metainterp/test/test_basic.py
   pypy/trunk/pypy/jit/metainterp/warmspot.py
   pypy/trunk/pypy/rpython/ootypesystem/rlist.py
Log:
remove the oopspec from ll_known_maxlength2fixed. This makes test_listcomp
passing on ootype, although the produced loop looks inefficient both on lltype
and ootype



Modified: pypy/trunk/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_basic.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_basic.py	Thu Sep 17 12:41:54 2009
@@ -859,6 +859,21 @@
         res = self.interp_operations(f, [3, 5])
         assert res == 8
         self.check_history_(int_add=0, call=1)
+
+    def test_listcomp(self):
+        myjitdriver = JitDriver(greens = [], reds = ['x', 'y', 'lst'])
+        def f(x, y):
+            lst = [0, 0, 0]
+            while y > 0:
+                myjitdriver.can_enter_jit(x=x, y=y, lst=lst)
+                myjitdriver.jit_merge_point(x=x, y=y, lst=lst)
+                lst = [i+x for i in lst if i >=0]
+                y -= 1
+            return lst[0]
+        res = self.meta_interp(f, [6, 7], listcomp=True, backendopt=True, listops=True)
+        # XXX: the loop looks inefficient
+        assert res == 42
+        
       
 
 class TestOOtype(BasicTests, OOJitMixin):

Modified: pypy/trunk/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/warmspot.py	Thu Sep 17 12:41:54 2009
@@ -47,10 +47,15 @@
     translator.warmrunnerdesc = warmrunnerdesc    # for later debugging
 
 def ll_meta_interp(function, args, backendopt=False, type_system='lltype',
-                   **kwds):
+                   listcomp=False, **kwds):
+    if listcomp:
+        extraconfigopts = {'translation.list_comprehension_operations': True}
+    else:
+        extraconfigopts = {}
     interp, graph = get_interpreter(function, args,
                                     backendopt=False,  # will be done below
-                                    type_system=type_system)
+                                    type_system=type_system,
+                                    **extraconfigopts)
     clear_tcache()
     return jittify_and_run(interp, graph, args, backendopt=backendopt, **kwds)
 

Modified: pypy/trunk/pypy/rpython/ootypesystem/rlist.py
==============================================================================
--- pypy/trunk/pypy/rpython/ootypesystem/rlist.py	(original)
+++ pypy/trunk/pypy/rpython/ootypesystem/rlist.py	Thu Sep 17 12:41:54 2009
@@ -183,7 +183,6 @@
             item = olditems.ll_getitem_fast(i)
             newitems.ll_setitem_fast(i, item)
         return newitems
-ll_known_maxlength2fixed.oopspec = 'list.list2fixed(l)'
 
 def ll_known_maxlength2fixed_exact(ARRAY, l):
     return l.items



More information about the Pypy-commit mailing list