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

arigo at codespeak.net arigo at codespeak.net
Thu Jun 4 10:48:28 CEST 2009


Author: arigo
Date: Thu Jun  4 10:48:27 2009
New Revision: 65573

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/codewriter.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_slist.py
Log:
Arrays of voids: not supported


Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/codewriter.py	Thu Jun  4 10:48:27 2009
@@ -1034,6 +1034,12 @@
         if not isinstance(deref(LIST), (lltype.GcArray, ootype.Array)):
             return False # resizable lists
         ARRAY = deref(LIST)
+        if isinstance(ARRAY, ootype.Array):
+            if ARRAY.ITEM == lltype.Void:
+                return False   # arrays of voids: not supported
+        else:
+            if ARRAY.OF == lltype.Void:
+                return False   # arrays of voids: not supported
         arraydescr = self.cpu.arraydescrof(ARRAY)
         #
         if oopspec_name == 'newlist':

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_slist.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_slist.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_slist.py	Thu Jun  4 10:48:27 2009
@@ -97,6 +97,19 @@
         assert res == 42
         py.test.skip("not virtualized away so far")
 
+    def test_list_of_voids(self):
+        myjitdriver = JitDriver(greens = [], reds = ['n', 'lst'])
+        def f(n):
+            lst = [None]
+            while n > 0:
+                myjitdriver.can_enter_jit(n=n, lst=lst)
+                myjitdriver.jit_merge_point(n=n, lst=lst)
+                lst = [None, None]
+                n -= 1
+            return len(lst)
+        res = self.meta_interp(f, [21], listops=True)
+        assert res == 2
+
 class TestOOtype(ListTests, OOJitMixin):
    pass
 



More information about the Pypy-commit mailing list