[pypy-svn] r52742 - pypy/dist/pypy/rpython/lltypesystem

fijal at codespeak.net fijal at codespeak.net
Wed Mar 19 20:54:45 CET 2008


Author: fijal
Date: Wed Mar 19 20:54:43 2008
New Revision: 52742

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rlist.py
Log:
Use raw_memcopy only for lists of primitives.


Modified: pypy/dist/pypy/rpython/lltypesystem/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rlist.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rlist.py	Wed Mar 19 20:54:43 2008
@@ -310,12 +310,16 @@
     else:
         p = new_allocated - 1
     ITEM = typeOf(l).TO.ITEM
-    source = cast_ptr_to_adr(items) + itemoffsetof(typeOf(l.items).TO, 0)
-    dest = cast_ptr_to_adr(newitems) + itemoffsetof(typeOf(l.items).TO, 0)
-    s = p + 1
-    raw_memcopy(source, dest, sizeof(ITEM) * s)
     if isinstance(ITEM, Ptr):
-        raw_memclear(source, sizeof(ITEM) * s)
+        while p >= 0:
+            newitems[p] = items[p]
+            items[p] = nullptr(ITEM.TO)
+            p -= 1
+    else:
+        source = cast_ptr_to_adr(items) + itemoffsetof(typeOf(l.items).TO, 0)
+        dest = cast_ptr_to_adr(newitems) + itemoffsetof(typeOf(l.items).TO, 0)
+        s = p + 1
+        raw_memcopy(source, dest, sizeof(ITEM) * s)
     l.length = newsize
     l.items = newitems
 _ll_list_resize_really._annenforceargs_ = (None, int)



More information about the Pypy-commit mailing list