Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r47614:31fc3ff3e626
Date: 2011-09-26 17:50 -0400
http://bitbucket.org/pypy/pypy/changeset/31fc3ff3e626/
Log: allow conditionally unrolling another rlist function, which shows up
when calling `list()` at app level.
diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py
b/pypy/module/pypyjit/test_pypy_c/test_containers.py
--- a/pypy/module/pypyjit/test_pypy_c/test_containers.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py
@@ -49,3 +49,24 @@
p33 = call(ConstClass(ll_get_value__dicttablePtr_Signed), p18,
i28, descr=...)
...
""")
+
+ def test_list(self):
+ def main(n):
+ i = 0
+ while i < n:
+ z = list(())
+ z.append(1)
+ i += z[-1] / len(z)
+ return i
+
+ log = self.run(main, [1000])
+ assert log.result == main(1000)
+ loop, = log.loops_by_filename(self.filepath)
+ assert loop.match("""
+ i7 = int_lt(i5, i6)
+ guard_true(i7, descr=...)
+ guard_not_invalidated(descr=...)
+ i9 = int_add(i5, 1)
+ --TICK--
+ jump(..., descr=...)
+ """)
\ No newline at end of file
diff --git a/pypy/rpython/rlist.py b/pypy/rpython/rlist.py
--- a/pypy/rpython/rlist.py
+++ b/pypy/rpython/rlist.py
@@ -11,7 +11,7 @@
from pypy.rlib.debug import ll_assert
from pypy.rlib.rarithmetic import ovfcheck, widen, r_uint, intmask
from pypy.rpython.annlowlevel import ADTInterface
-from pypy.rlib import rgc
+from pypy.rlib import rgc, jit
ADTIFixedList = ADTInterface(None, {
'll_newlist': (['SELF', Signed ], 'self'),
@@ -912,6 +912,8 @@
return l
# no oopspec -- the function is inlined by the JIT
[email protected]_inside_iff(lambda l, start: jit.isconstant(start) and
jit.isvirtual(l))
[email protected]('list.delslice_startonly(l, start)')
def ll_listdelslice_startonly(l, start):
ll_assert(start >= 0, "del l[start:] with unexpectedly negative start")
ll_assert(start <= l.ll_length(), "del l[start:] with start > len(l)")
@@ -923,7 +925,6 @@
l.ll_setitem_fast(j, null)
j -= 1
l._ll_resize_le(newlength)
-ll_listdelslice_startonly.oopspec = 'list.delslice_startonly(l, start)'
def ll_listdelslice_startstop(l, start, stop):
length = l.ll_length()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit