[pypy-commit] pypy nogil-unsafe-2: (remi previously, arigo) Fix: we must not grab the next object's location from the nursery without having the GIL

arigo pypy.commits at gmail.com
Sat Mar 4 11:04:57 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: nogil-unsafe-2
Changeset: r90537:8efb35415f7d
Date: 2017-03-04 17:04 +0100
http://bitbucket.org/pypy/pypy/changeset/8efb35415f7d/

Log:	(remi previously, arigo) Fix: we must not grab the next object's
	location from the nursery without having the GIL

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -930,15 +930,17 @@
                               "Calling minor_collection() twice is not "
                               "enough. Too many pinned objects?")
                     self._minor_collection()
+                continue
             #
             # Tried to do something about nursery_free overflowing
             # nursery_top before this point. Try to reserve totalsize now.
             # If this succeeds break out of loop.
+            rgil.leave_master_section()
             result = self.get_nursery_free()
             if result + totalsize <= self.get_nursery_top():
                 self.set_nursery_free(result + totalsize)
                 break
-            #
+            rgil.enter_master_section()
         #
         if self.debug_tiny_nursery >= 0:   # for debugging
             if (self.get_nursery_top() - self.get_nursery_free() >
@@ -946,7 +948,6 @@
                 self.set_nursery_free(self.get_nursery_top() -
                                       self.debug_tiny_nursery)
         #
-        rgil.leave_master_section()
         # rthread.release_NOAUTO(self.wb_slowpath_lock)
         return result
     collect_and_reserve._dont_inline_ = True


More information about the pypy-commit mailing list