[pypy-svn] r25918 - in pypy/dist/pypy/rpython: . lltypesystem ootypesystem

antocuni at codespeak.net antocuni at codespeak.net
Tue Apr 18 00:22:46 CEST 2006


Author: antocuni
Date: Tue Apr 18 00:22:40 2006
New Revision: 25918

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rlist.py
   pypy/dist/pypy/rpython/ootypesystem/ootype.py
   pypy/dist/pypy/rpython/rlist.py
Log:
Added _ll_resize to the ADT/_GENERIC_METHODS list interface.



Modified: pypy/dist/pypy/rpython/lltypesystem/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rlist.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rlist.py	Tue Apr 18 00:22:40 2006
@@ -177,6 +177,7 @@
                                           "ll_setitem_fast": ll_setitem_fast,
                                           "_ll_resize_ge": _ll_list_resize_ge,
                                           "_ll_resize_le": _ll_list_resize_le,
+                                          "_ll_resize": _ll_list_resize,
                                       })
                              )
 
@@ -206,8 +207,6 @@
                                      "ITEM": ITEM,
                                      "ll_getitem_fast": ll_fixed_getitem_fast,
                                      "ll_setitem_fast": ll_fixed_setitem_fast,
-                                     "_ll_resize_ge": _ll_list_resize_ge,
-                                     "_ll_resize_le": _ll_list_resize_le,
                                 })
 
             self.LIST.become(ITEMARRAY)

Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py	Tue Apr 18 00:22:40 2006
@@ -208,6 +208,7 @@
             "ll_setitem_fast": Meth([Signed, self.ITEMTYPE_T], Void),
             "_ll_resize_ge": Meth([Signed], Void),
             "_ll_resize_le": Meth([Signed], Void),
+            "_ll_resize": Meth([Signed], Void),
             "append": Meth([self.ITEMTYPE_T], Void),            
             "extend": Meth([self.SELFTYPE_T], Void),
             "remove_range": Meth([Signed, Signed], Void), # remove_range(start, count)
@@ -558,6 +559,14 @@
             del self._list[length:]
         assert len(self._list) <= length
 
+    def _ll_resize(self, length):
+        # NOT_RPYTHON
+        if length > len(self._list):
+            self._ll_resize_ge(length)
+        elif length < len(self._list):
+            self._ll_resize_le(length)
+        assert len(self._list) == length
+
     def append(self, item):
         # NOT_RPYTHON
         assert typeOf(item) == self._TYPE._ITEMTYPE
@@ -669,3 +678,4 @@
 
 
 ROOT = Instance('Root', None, _is_root=True)
+

Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Tue Apr 18 00:22:40 2006
@@ -709,8 +709,8 @@
         factor = 0
     resultlen = length * factor
     res = l
-    #_ll_list_resize(res, resultlen)
-    res._ll_resize_ge(resultlen)
+    res._ll_resize(resultlen)
+    #res._ll_resize_ge(resultlen)
     j = length
     while j < resultlen:
         i = 0



More information about the Pypy-commit mailing list