[pypy-svn] r26201 - pypy/dist/pypy/rpython/ootypesystem
antocuni at codespeak.net
antocuni at codespeak.net
Sun Apr 23 20:38:50 CEST 2006
Author: antocuni
Date: Sun Apr 23 20:38:44 2006
New Revision: 26201
Modified:
pypy/dist/pypy/rpython/ootypesystem/ootype.py
pypy/dist/pypy/rpython/ootypesystem/rlist.py
Log:
Added ll_newlist to rlist.py
Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py Sun Apr 23 20:38:44 2006
@@ -257,9 +257,8 @@
# this is the equivalent of the lltypesystem ll_newlist that is
# marked as typeMethod.
def ll_newlist(self, length):
- lst = new(self)
- lst._ll_resize_ge(length)
- return lst
+ from pypy.rpython.ootypesystem import rlist
+ return rlist.ll_newlist(self, length)
# NB: We are expecting Lists of the same ITEMTYPE to compare/hash
# equal. We don't redefine __eq__/__hash__ since the implementations
Modified: pypy/dist/pypy/rpython/ootypesystem/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rlist.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/rlist.py Sun Apr 23 20:38:44 2006
@@ -75,12 +75,6 @@
def newlist(llops, r_list, items_v):
c_list = inputconst(ootype.Void, r_list.lowleveltype)
v_result = llops.genop("new", [c_list], resulttype=r_list.lowleveltype)
-## c_append = inputconst(ootype.Void, "append")
-## # This is very inefficient for a large amount of initial items ...
-## for v_item in items_v:
-## llops.genop("oosend", [c_append, v_result, v_item],
-## resulttype=ootype.Void)
-
c_resize = inputconst(ootype.Void, "_ll_resize")
c_length = inputconst(ootype.Signed, len(items_v))
llops.genop("oosend", [c_resize, v_result, c_length], resulttype=ootype.Void)
@@ -91,6 +85,10 @@
llops.genop("oosend", [c_setitem, v_result, ci, v_item], resulttype=ootype.Void)
return v_result
+def ll_newlist(LIST, length):
+ lst = ootype.new(LIST)
+ lst._ll_resize(length)
+ return lst
# ____________________________________________________________
More information about the Pypy-commit
mailing list