[pypy-commit] pypy gc-minimark-pinning: use pinning, easy (?)

fijal noreply at buildbot.pypy.org
Fri Apr 13 18:22:01 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
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]
 


More information about the pypy-commit mailing list