Author: Maciej Fijalkowski <[email protected]>
Branch: gc-minimark-pinning
Changeset: r54340:049d60b7295d
Date: 2012-04-13 17:29 +0200
http://bitbucket.org/pypy/pypy/changeset/049d60b7295d/

Log:    use pinning, easy (?)

diff --git a/pypy/rpython/lltypesystem/rffi.py 
b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -714,6 +714,7 @@
         string is already nonmovable.  Must be followed by a
         free_nonmovingbuffer call.
         """
+        rgc.pin(data)
         if rgc.can_move(data):
             count = len(data)
             buf = lltype.malloc(TYPEP.TO, count, flavor='raw')
@@ -743,7 +744,9 @@
             offsetof(STRTYPE, 'chars') + itemoffsetof(STRTYPE.chars, 0)
         followed_2nd_path = (buf == cast(TYPEP, data_start))
         keepalive_until_here(data)
-        if not followed_2nd_path:
+        if followed_2nd_path:
+            rgc.unpin(data)
+        else:
             lltype.free(buf, flavor='raw')
     free_nonmovingbuffer._annenforceargs_ = [strtype, None]
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to