[pypy-commit] pypy gc-trace-faster: Attempt to reduce calls to trace_and_drag_out_of_nursery_partial. Not as effective as hoped, but still gives some improvement.

justinpeel noreply at buildbot.pypy.org
Tue Sep 6 17:39:40 CEST 2011


Author: Justin Peel <notmuchtotell at gmail.com>
Branch: gc-trace-faster
Changeset: r47105:2f505084ea21
Date: 2011-09-06 09:38 -0600
http://bitbucket.org/pypy/pypy/changeset/2f505084ea21/

Log:	Attempt to reduce calls to trace_and_drag_out_of_nursery_partial.
	Not as effective as hoped, but still gives some improvement.

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
@@ -1334,8 +1334,47 @@
                 while bytes > 0:
                     p -= 1
                     cardbyte = ord(p.char[0])
+                    bytes -= 1
+                    if cardbyte == 0:
+                        # keep moving along while there are unmarked bytes
+                        if bytes == 0:
+                            break
+                        p -= 1
+                        cardbyte = ord(p.char[0])
+                        bytes -= 1
+                        counter = 1
+                        while bytes > 0 and cardbyte == 0:
+                            p -= 1
+                            cardbyte = ord(p.char[0])
+                            bytes -= 1
+                            counter += 1
+                        interval_start = interval_start + counter*8*self.card_page_indices
+                    if cardbyte == 255 and bytes > 0:
+                        # keep moving until we find a byte that isn't fully marked
+                        p.char[0] = '\x00'
+                        counter = 1
+                        p -= 1
+                        cardbyte = ord(p.char[0])
+                        bytes -= 1
+                        while bytes > 0 and cardbyte == 255:
+                            p.char[0] = '\x00'
+                            p -= 1
+                            cardbyte = ord(p.char[0])
+                            bytes -= 1
+                            counter += 1
+                        interval_stop = interval_start + counter*8*self.card_page_indices
+                        if interval_stop > length:
+                            interval_stop = length
+                            ll_assert(bytes == 0,
+                                "premature end of object")
+                        if bool(self.young_rawmalloced_objects):
+                            self.trace_and_drag_out_of_nursery_partial_young_raw(
+                                obj, interval_start, interval_stop)
+                        else:
+                            self.trace_and_drag_out_of_nursery_partial(
+                                obj, interval_start, interval_stop)
+                        interval_start = interval_stop
                     p.char[0] = '\x00'           # reset the bits
-                    bytes -= 1
                     next_byte_start = interval_start + 8*self.card_page_indices
                     #
                     while cardbyte != 0:


More information about the pypy-commit mailing list