[pypy-commit] pypy stm-gc: Fixes.
arigo
noreply at buildbot.pypy.org
Tue Apr 17 10:31:39 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r54449:a33aa4134c22
Date: 2012-04-16 22:25 +0200
http://bitbucket.org/pypy/pypy/changeset/a33aa4134c22/
Log: Fixes.
diff --git a/pypy/rpython/memory/gc/stmtls.py b/pypy/rpython/memory/gc/stmtls.py
--- a/pypy/rpython/memory/gc/stmtls.py
+++ b/pypy/rpython/memory/gc/stmtls.py
@@ -128,6 +128,8 @@
# transaction is aborted, the latter might never be called.
# Be ready here to clean up any state.
self._cleanup_state()
+ if self is not self.gc.main_thread_tls:
+ self.gc.root_walker.clear_current_stack_roots()
if self.nursery_free:
clear_size = self.nursery_free - self.nursery_start
else:
@@ -284,7 +286,7 @@
def collect_roots_from_stack(self):
self.gc.root_walker.walk_current_stack_roots(
- StmGCTLS._trace_drag_out1, self)
+ StmGCTLS._trace_drag_out_if_not_global1, self)
def trace_and_drag_out_of_nursery(self, obj):
# This is called to fix the references inside 'obj', to ensure that
@@ -294,8 +296,8 @@
# objects.
self.gc.trace(obj, self._trace_drag_out, None)
- def _trace_drag_out1(self, root):
- self._trace_drag_out(root, None)
+ def _trace_drag_out_if_not_global1(self, root):
+ self._trace_drag_out_if_not_global(root, None)
def _trace_drag_out_if_not_global(self, root, ignored):
# like _trace_drag_out(), but ignores references to GLOBAL objects.
@@ -313,6 +315,7 @@
"""
obj = root.address[0]
hdr = self.gc.header(obj)
+ ll_assert(hdr.tid & GCFLAG_GLOBAL == 0, "unexpected GLOBAL obj")
#
# If 'obj' is not in the nursery, we set GCFLAG_VISITED
if not self.is_in_nursery(obj):
diff --git a/pypy/rpython/memory/gc/test/test_stmgc.py b/pypy/rpython/memory/gc/test/test_stmgc.py
--- a/pypy/rpython/memory/gc/test/test_stmgc.py
+++ b/pypy/rpython/memory/gc/test/test_stmgc.py
@@ -135,6 +135,8 @@
class FakeRootWalker:
def walk_current_stack_roots(self, *args):
pass # no stack roots in this test file
+ def clear_current_stack_roots(self):
+ pass
class StmGCTests:
diff --git a/pypy/rpython/memory/gctransform/stmframework.py b/pypy/rpython/memory/gctransform/stmframework.py
--- a/pypy/rpython/memory/gctransform/stmframework.py
+++ b/pypy/rpython/memory/gctransform/stmframework.py
@@ -169,3 +169,9 @@
self.rootstackhook(collect_stack_root, arg,
stackgcdata.root_stack_base,
stackgcdata.root_stack_top)
+
+ def clear_current_stack_roots(self):
+ """Used when we start a transaction: there might be garbage left
+ behind by the previous aborted transaction."""
+ stackgcdata = self.stackgcdata
+ stackgcdata.root_stack_top = stackgcdata.root_stack_base
More information about the pypy-commit
mailing list