Author: Armin Rigo <ar...@tunes.org>
Branch: array-overallocation-in-nursery
Changeset: r67812:d0b26d48adbf
Date: 2013-11-03 13:24 +0100
http://bitbucket.org/pypy/pypy/changeset/d0b26d48adbf/

Log:    Apply the diff of incminimark.py to minimark.py.

diff --git a/rpython/memory/gc/minimark.py b/rpython/memory/gc/minimark.py
--- a/rpython/memory/gc/minimark.py
+++ b/rpython/memory/gc/minimark.py
@@ -1355,8 +1355,8 @@
             # Get the number of card marker bytes in the header.
             typeid = self.get_type_id(obj)
             offset_to_length = self.varsize_offset_to_length(typeid)
-            length = (obj + offset_to_length).signed[0]
-            bytes = self.card_marking_bytes_for_length(length)
+            allocated_length = (obj + offset_to_length).signed[0]
+            bytes = self.card_marking_bytes_for_length(allocated_length)
             p = llarena.getfakearenaaddress(obj - size_gc_header)
             #
             # If the object doesn't have GCFLAG_TRACK_YOUNG_PTRS, then it
@@ -1374,6 +1374,9 @@
             else:
                 # Walk the bytes encoding the card marker bits, and for
                 # each bit set, call trace_and_drag_out_of_nursery_partial().
+                offset_to_used_length = self.varsize_offset_to_used_length(
+                    typeid)
+                used_length = (obj + offset_to_used_length).signed[0]
                 interval_start = 0
                 while bytes > 0:
                     p -= 1
@@ -1386,10 +1389,10 @@
                         interval_stop = interval_start + self.card_page_indices
                         #
                         if cardbyte & 1:
-                            if interval_stop > length:
-                                interval_stop = length
-                                ll_assert(cardbyte <= 1 and bytes == 0,
-                                          "premature end of object")
+                            if interval_stop > used_length:
+                                interval_stop = used_length
+                                if interval_stop <= interval_start:
+                                    break
                             self.trace_and_drag_out_of_nursery_partial(
                                 obj, interval_start, interval_stop)
                         #
@@ -1463,7 +1466,7 @@
             # tid == -42, containing all flags), and it doesn't have the
             # HAS_SHADOW flag either.  We must move it out of the nursery,
             # into a new nonmovable location.
-            totalsize = size_gc_header + self.get_size(obj)
+            totalsize = size_gc_header + self.shrink_and_get_size(obj)
             newhdr = self._malloc_out_of_nursery(totalsize)
             #
         elif self.is_forwarded(obj):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to