[pypy-svn] r22183 - in pypy/dist/pypy/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Jan 14 23:29:13 CET 2006
Author: arigo
Date: Sat Jan 14 23:29:11 2006
New Revision: 22183
Modified:
pypy/dist/pypy/rpython/rlist.py
pypy/dist/pypy/rpython/test/test_rlist.py
Log:
Bug fix, more precise test. A few more oopspec tags.
Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py (original)
+++ pypy/dist/pypy/rpython/rlist.py Sat Jan 14 23:29:11 2006
@@ -174,6 +174,7 @@
argtypes = [bk.immutablevalue(dum_nocheck), LISTPTR, Signed, ITEM]
fnptr = list_repr.rtyper.annotate_helper_fn(ll_setitem_nonneg, argtypes)
self.c_setitem_nonneg = inputconst(typeOf(fnptr), fnptr)
+ self.c_dum_nocheck = inputconst(Void, dum_nocheck)
def build(self, llop, items_v):
"""Make the operations that would build a list containing the
@@ -186,8 +187,9 @@
v_result = llop.genop('direct_call', [self.c_newlist, c_list, c_len],
resulttype = self.LISTPTR)
for i, v in enumerate(items_v):
- llop.genop('direct_call', [self.c_setitem_nonneg, v_result,
- inputconst(Signed, i), v])
+ llop.genop('direct_call', [self.c_setitem_nonneg,
+ self.c_dum_nocheck,
+ v_result, inputconst(Signed, i), v])
return v_result
class ListRepr(BaseListRepr):
@@ -645,6 +647,7 @@
if func is dum_checkidx and (index >= l.ll_length()):
raise IndexError
l.ll_items()[index] = newitem
+ll_setitem_nonneg.oopspec = 'list.setitem(l, index, newitem)'
def ll_setitem(func, l, index, newitem):
length = l.ll_length()
@@ -653,6 +656,7 @@
if func is dum_checkidx and (index < 0 or index >= length):
raise IndexError
l.ll_items()[index] = newitem
+ll_setitem.oopspec = 'list.setitem(l, index, newitem)'
def ll_delitem_nonneg(func, l, index):
length = l.length
@@ -964,6 +968,7 @@
items[i] = item
i += 1
return l
+ll_alloc_and_set.oopspec = 'newlist(count, item)'
def rtype_alloc_and_set(hop):
r_list = hop.r_result
Modified: pypy/dist/pypy/rpython/test/test_rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rlist.py (original)
+++ pypy/dist/pypy/rpython/test/test_rlist.py Sat Jan 14 23:29:11 2006
@@ -915,6 +915,7 @@
vr = LIST.list_builder(llop, [v0, v1])
assert len(llop) == 3
assert llop[0].opname == 'direct_call'
+ assert len(llop[0].args) == 3
assert llop[0].args[1].concretetype == Void
assert llop[0].args[1].value == LIST
assert llop[0].args[2].concretetype == Signed
@@ -922,8 +923,10 @@
assert llop[0].result is vr
for op, i, vi in [(llop[1], 0, v0), (llop[2], 1, v1)]:
assert op.opname == 'direct_call'
- assert op.args[-3] is vr
- assert op.args[-2].concretetype == Signed
- assert op.args[-2].value == i
- assert op.args[-1] is vi
+ assert len(op.args) == 5
+ assert op.args[1].value is dum_nocheck
+ assert op.args[2] is vr
+ assert op.args[3].concretetype == Signed
+ assert op.args[3].value == i
+ assert op.args[4] is vi
assert op.result.concretetype is Void
More information about the Pypy-commit
mailing list