[pypy-svn] pypy gc-minimark-largeobj: Trying to have large objects (more than a few KBs) also start as

arigo commits-noreply at bitbucket.org
Thu Dec 30 17:32:17 CET 2010


Author: Armin Rigo <arigo at tunes.org>
Branch: gc-minimark-largeobj
Changeset: r40282:5d46791b3541
Date: 2010-12-29 13:18 +0100
http://bitbucket.org/pypy/pypy/changeset/5d46791b3541/

Log:	Trying to have large objects (more than a few KBs) also start as
	young objects. Step 1: remove the difference between large_object
	and large_object_gcptrs.

diff --git a/pypy/rpython/memory/gc/minimark.py b/pypy/rpython/memory/gc/minimark.py
--- a/pypy/rpython/memory/gc/minimark.py
+++ b/pypy/rpython/memory/gc/minimark.py
@@ -177,14 +177,9 @@
         "card_page_indices": 128,
 
         # Objects whose total size is at least 'large_object' bytes are
-        # allocated out of the nursery immediately.  If the object
-        # has GC pointers in its varsized part, we use instead the
-        # higher limit 'large_object_gcptrs'.  The idea is that
-        # separately allocated objects are allocated immediately "old"
-        # and it's not good to have too many pointers from old to young
+        # allocated out of the nursery immediately, but still as young
         # objects.
-        "large_object": 1600*WORD,
-        "large_object_gcptrs": 8250*WORD,
+        "large_object": 2048*WORD,
         }
 
     def __init__(self, config,
@@ -197,7 +192,6 @@
                  growth_rate_max=2.5,   # for tests
                  card_page_indices=0,
                  large_object=8*WORD,
-                 large_object_gcptrs=10*WORD,
                  ArenaCollectionClass=None,
                  **kwds):
         MovingGCBase.__init__(self, config, **kwds)
@@ -219,12 +213,9 @@
             while (1 << self.card_page_shift) < self.card_page_indices:
                 self.card_page_shift += 1
         #
-        # 'large_object' and 'large_object_gcptrs' limit how big objects
-        # can be in the nursery, so they give a lower bound on the allowed
-        # size of the nursery.
+        # 'large_object' limit how big objects can be in the nursery, so
+        # it gives a lower bound on the allowed size of the nursery.
         self.nonlarge_max = large_object - 1
-        self.nonlarge_gcptrs_max = large_object_gcptrs - 1
-        assert self.nonlarge_max <= self.nonlarge_gcptrs_max
         #
         self.nursery      = NULL
         self.nursery_free = NULL
@@ -291,7 +282,7 @@
         else:
             #
             defaultsize = self.nursery_size
-            minsize = 2 * (self.nonlarge_gcptrs_max + 1)
+            minsize = 2 * (self.nonlarge_max + 1)
             self.nursery_size = minsize
             self.allocate_nursery()
             #
@@ -345,7 +336,7 @@
 
 
     def _nursery_memory_size(self):
-        extra = self.nonlarge_gcptrs_max + 1
+        extra = self.nonlarge_max + 1
         return self.nursery_size + extra
 
     def _alloc_nursery(self):
@@ -489,16 +480,11 @@
         # below 'nonlarge_max'.  All the following logic is usually
         # constant-folded because self.nonlarge_max, size and itemsize
         # are all constants (the arguments are constant due to
-        # inlining) and self.has_gcptr_in_varsize() is constant-folded.
-        if self.has_gcptr_in_varsize(typeid):
-            nonlarge_max = self.nonlarge_gcptrs_max
+        # inlining).
+        if not raw_malloc_usage(itemsize):
+            too_many_items = raw_malloc_usage(nonvarsize) > self.nonlarge_max
         else:
-            nonlarge_max = self.nonlarge_max
-
-        if not raw_malloc_usage(itemsize):
-            too_many_items = raw_malloc_usage(nonvarsize) > nonlarge_max
-        else:
-            maxlength = nonlarge_max - raw_malloc_usage(nonvarsize)
+            maxlength = self.nonlarge_max - raw_malloc_usage(nonvarsize)
             maxlength = maxlength // raw_malloc_usage(itemsize)
             too_many_items = length > maxlength
 
@@ -623,7 +609,7 @@
             # Check if we need to introduce the card marker bits area.
             if (self.card_page_indices <= 0  # <- this check is constant-folded
                 or not self.has_gcptr_in_varsize(typeid) or
-                raw_malloc_usage(totalsize) <= self.nonlarge_gcptrs_max):
+                raw_malloc_usage(totalsize) <= self.nonlarge_max):
                 #
                 # In these cases, we don't want a card marker bits area.
                 # This case also includes all fixed-size objects.


More information about the Pypy-commit mailing list