[pypy-commit] pypy stmgc-c8: Theoretical fix. In practice, I think it cannot really occur that a

arigo noreply at buildbot.pypy.org
Thu Jun 25 22:58:09 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c8
Changeset: r78315:60f39963e5a8
Date: 2015-06-25 22:47 +0200
http://bitbucket.org/pypy/pypy/changeset/60f39963e5a8/

Log:	Theoretical fix. In practice, I think it cannot really occur that a
	block contains a canmallocgc operation anywhere else than near the
	end, because it should be followed by the exception check.

diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -53,7 +53,8 @@
                     LL_OPERATIONS[op.opname].canmallocgc)
 
 def propagate_no_write_barrier_needed(result, block, mallocvars,
-                                      collect_analyzer, entrymap):
+                                      collect_analyzer, entrymap,
+                                      startindex=0):
     # We definitely know that no write barrier is needed in the 'block'
     # for any of the variables in 'mallocvars'.  Propagate this information
     # forward.  Note that "definitely know" implies that we just did either
@@ -61,6 +62,8 @@
     # that we just did a full write barrier (not just for card marking).
     if 1:       # keep indentation
         for i, op in enumerate(block.operations):
+            if i < startindex:
+                continue
             if op.opname in ("cast_pointer", "same_as"):
                 if op.args[0] in mallocvars:
                     mallocvars[op.result] = True
@@ -1340,11 +1343,13 @@
                 # this helper to propagate this knowledge forward and
                 # avoid to repeat the write barrier.
                 if self.curr_block is not None:   # for tests
+                    assert self.curr_block.operations[hop.index] is hop.spaceop
                     propagate_no_write_barrier_needed(self.clean_sets,
                                                       self.curr_block,
                                                       {v_struct: True},
                                                       self.collect_analyzer,
-                                                      self._entrymap)
+                                                      self._entrymap,
+                                                      hop.index + 1)
         hop.rename('bare_' + opname)
 
     def transform_getfield_typeptr(self, hop):


More information about the pypy-commit mailing list