[pypy-commit] pypy default: Ooops. The gc-incminimark-pinning branch introduced a call to

arigo noreply at buildbot.pypy.org
Sun Nov 9 21:19:02 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r74419:40953f097e0e
Date: 2014-11-09 21:18 +0100
http://bitbucket.org/pypy/pypy/changeset/40953f097e0e/

Log:	Ooops. The gc-incminimark-pinning branch introduced a call to
	collect_and_reserve() from *every* malloc, rather than only when the
	nursery is full (which is comparatively very rare). Fix. I suspect
	this explains the 6% slow-down on a few benchmarks.

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
@@ -593,7 +593,10 @@
             #
             # Get the memory from the nursery.  If there is not enough space
             # there, do a collect first.
-            result = self.collect_and_reserve(rawtotalsize)
+            result = self.nursery_free
+            self.nursery_free = new_free = result + totalsize
+            if new_free > self.nursery_top:
+                result = self.collect_and_reserve(totalsize)
             #
             # Build the object.
             llarena.arena_reserve(result, totalsize)
@@ -649,7 +652,10 @@
             #
             # Get the memory from the nursery.  If there is not enough space
             # there, do a collect first.
-            result = self.collect_and_reserve(raw_malloc_usage(totalsize))
+            result = self.nursery_free
+            self.nursery_free = new_free = result + totalsize
+            if new_free > self.nursery_top:
+                result = self.collect_and_reserve(totalsize)
             #
             # Build the object.
             llarena.arena_reserve(result, totalsize)
@@ -682,13 +688,11 @@
         and finally reserve 'totalsize' bytes at the start of the
         now-empty nursery.
         """
-        if self.nursery_free + totalsize <= self.nursery_top:
-            result = self.nursery_free
-            self.nursery_free = result + totalsize
-            return result
 
         minor_collection_count = 0
         while True:
+            self.nursery_free = llmemory.NULL      # debug: don't use me
+
             if self.nursery_barriers.non_empty():
                 size_gc_header = self.gcheaderbuilder.size_gc_header
                 pinned_obj_size = size_gc_header + self.get_size(


More information about the pypy-commit mailing list