[pypy-commit] pypy stm-gc-2: (untested) add a way to walk all roots, for major collections
arigo
noreply at buildbot.pypy.org
Mon Apr 8 17:09:10 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc-2
Changeset: r63142:b88de4215050
Date: 2013-04-08 14:28 +0200
http://bitbucket.org/pypy/pypy/changeset/b88de4215050/
Log: (untested) add a way to walk all roots, for major collections
diff --git a/rpython/memory/gc/stmtls.py b/rpython/memory/gc/stmtls.py
--- a/rpython/memory/gc/stmtls.py
+++ b/rpython/memory/gc/stmtls.py
@@ -36,6 +36,11 @@
self.null_address_dict = self.gc.null_address_dict
self.AddressStack = self.gc.AddressStack
self.AddressDict = self.gc.AddressDict
+ if we_are_translated():
+ self.adr_of_stack_base = llop.gc_adr_of_root_stack_base(
+ llmemory.Address)
+ self.adr_of_stack_top = llop.gc_adr_of_root_stack_top(
+ llmemory.Address)
#
# --- current position, or NULL when mallocs are forbidden
self.nursery_free = NULL
diff --git a/rpython/memory/gctransform/stmframework.py b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -119,6 +119,7 @@
if addr.signed[0] == END_MARKER:
break
callback(arg, addr)
+ return addr
self.rootstackhook = walk_stack_root
rsd = gctransformer.root_stack_depth
@@ -188,3 +189,19 @@
if gc.points_to_valid_gc_object(result):
collect_nongc_root(arg, result)
addr += sizeofaddr
+
+ @specialize.argtype(2)
+ def walk_all_stack_roots(self, collect_stack_root, arg):
+ # assume that we have the ll_global_lock here
+ stmtls = self.gc.linked_list_stmtls
+ while stmtls is not None:
+ # for every stmtls:
+ root_stack_base = stmtls.adr_of_stack_base.address[0]
+ root_stack_top = stmtls.adr_of_stack_top.address[0]
+ # we walk all segments of the shadow stack, each of them
+ # with an END_MARKER at the bottom, until we reach the
+ # marker that is at root_stack_base.
+ while root_stack_top != root_stack_base:
+ root_stack_top = self.rootstackhook(collect_stack_root, arg,
+ root_stack_top)
+ stmtls = stmtls.linked_list_next
More information about the pypy-commit
mailing list