Author: Remi Meier <remi.me...@gmail.com>
Branch: nogil-unsafe-2
Changeset: r90476:e1ade06bc0ab
Date: 2017-03-02 13:19 +0100
http://bitbucket.org/pypy/pypy/changeset/e1ade06bc0ab/

Log:    (arigo, remi) enter safepoint in more places and fix issue with non-
        empty nursery assert

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
@@ -800,6 +800,8 @@
     def collect(self, gen=2):
         """Do a minor (gen=0), start a major (gen=1), or do a full
         major (gen>=2) collection."""
+        rgil.enter_master_section()
+        rgil.master_request_safepoint()
         if gen < 0:
             self._minor_collection()   # dangerous! no major GC cycle progress
         elif gen <= 1:
@@ -809,6 +811,7 @@
         else:
             self.minor_and_major_collection()
         self.rrc_invoke_callback()
+        rgil.leave_master_section()
 
 
     def minor_collection_with_major_progress(self, extrasize=0):
@@ -983,8 +986,11 @@
         # then when the major collection finishes it will raise
         # MemoryError.
         if self.threshold_reached(raw_malloc_usage(totalsize)):
+            rgil.enter_master_section()
+            rgil.master_request_safepoint()
             self.minor_collection_with_major_progress(
                 raw_malloc_usage(totalsize) + self.nursery_size // 2)
+            rgil.leave_master_section()
         #
         # Check if the object would fit in the ArenaCollection.
         # Also, an object allocated from ArenaCollection must be old.
@@ -1829,6 +1835,7 @@
         # pointer.
         size_gc_header = self.gcheaderbuilder.size_gc_header
         nursery_barriers = self.AddressDeque()
+        nursery_barriers.append(self.nursery)
         if self.surviving_pinned_objects.non_empty():
             self.surviving_pinned_objects.sort()
             next_pinned_object = self.surviving_pinned_objects.pop()
@@ -1904,8 +1911,6 @@
         self.nursery_barriers = nursery_barriers
         self.surviving_pinned_objects.delete()
         #
-        self.set_nursery_free(self.nursery)
-        self.set_nursery_top(self.nursery_barriers.popleft())
         #
         # clear GCFLAG_PINNED_OBJECT_PARENT_KNOWN from all parents in the list.
         self.old_objects_pointing_to_pinned.foreach(
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to