Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: gc_no_cleanup_nursery
Changeset: r73599:c12587039b65
Date: 2014-09-17 19:13 -0600
http://bitbucket.org/pypy/pypy/changeset/c12587039b65/

Log:    implement setarrayitem unrolling for constant length just-allocated
        arrays

diff --git a/rpython/jit/backend/llsupport/rewrite.py 
b/rpython/jit/backend/llsupport/rewrite.py
--- a/rpython/jit/backend/llsupport/rewrite.py
+++ b/rpython/jit/backend/llsupport/rewrite.py
@@ -186,6 +186,15 @@
         v_arr_plus_ofs = BoxInt()
         v_totalsize = BoxInt()
         gcdescr = self.gc_ll_descr
+        if isinstance(v_arrsize, ConstInt) and v_arrsize.getint() < 10:
+            # clear it item by item
+            ops = []
+            for i in range(v_arrsize.getint()):
+                ops.append(ResOperation(rop.SETARRAYITEM_GC,
+                                        [v_arr, ConstInt(i)], None,
+                                        descr=arraydescr))
+            self.newops += ops
+            return
         ops = [
             ResOperation(rop.INT_ADD, [v_arr, ConstInt(ofs)], v_arr_plus_ofs),
         ]
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to