Author: Armin Rigo <[email protected]>
Branch: stackroot-speedup
Changeset: r51911:ecd5a39e368a
Date: 2012-01-28 16:42 +0100
http://bitbucket.org/pypy/pypy/changeset/ecd5a39e368a/
Log: (fijal, arigo)
Pass the flag "is_minor" around.
diff --git a/pypy/rpython/memory/gc/base.py b/pypy/rpython/memory/gc/base.py
--- a/pypy/rpython/memory/gc/base.py
+++ b/pypy/rpython/memory/gc/base.py
@@ -299,7 +299,8 @@
# list of last generation roots
callback2, attrname = _convert_callback_formats(callback) # :-/
setattr(self, attrname, arg)
- self.root_walker.walk_roots(callback2, callback2, callback2)
+ self.root_walker.walk_roots(callback2, callback2, callback2,
+ is_minor=False)
self.run_finalizers.foreach(callback, arg)
enumerate_all_roots._annspecialcase_ = 'specialize:arg(1)'
diff --git a/pypy/rpython/memory/gc/generation.py
b/pypy/rpython/memory/gc/generation.py
--- a/pypy/rpython/memory/gc/generation.py
+++ b/pypy/rpython/memory/gc/generation.py
@@ -318,7 +318,8 @@
self.root_walker.walk_roots(
SemiSpaceGC._collect_root, # stack roots
SemiSpaceGC._collect_root, # static in prebuilt non-gc structures
- None) # we don't need the static in prebuilt gc objects
+ None, # we don't need the static in prebuilt gc objects
+ is_minor=False)
def collect_last_generation_roots(self):
stack = self.last_generation_root_objects
@@ -414,7 +415,8 @@
self.root_walker.walk_roots(
GenerationGC._collect_root_in_nursery, # stack roots
GenerationGC._collect_root_in_nursery, # static in prebuilt non-gc
- None) # static in prebuilt gc
+ None, # static in prebuilt gc
+ is_minor=True)
def _collect_root_in_nursery(self, root):
obj = root.address[0]
diff --git a/pypy/rpython/memory/gc/hybrid.py b/pypy/rpython/memory/gc/hybrid.py
--- a/pypy/rpython/memory/gc/hybrid.py
+++ b/pypy/rpython/memory/gc/hybrid.py
@@ -305,7 +305,8 @@
self.root_walker.walk_roots(
SemiSpaceGC._collect_root, # stack roots
SemiSpaceGC._collect_root, # static in prebuilt non-gc structs
- SemiSpaceGC._collect_root) # static in prebuilt gc objects
+ SemiSpaceGC._collect_root, # static in prebuilt gc objects
+ is_minor=False)
def surviving(self, obj):
# To use during a collection. The objects that survive are the
diff --git a/pypy/rpython/memory/gc/markcompact.py
b/pypy/rpython/memory/gc/markcompact.py
--- a/pypy/rpython/memory/gc/markcompact.py
+++ b/pypy/rpython/memory/gc/markcompact.py
@@ -367,7 +367,8 @@
self.root_walker.walk_roots(
MarkCompactGC._mark_root, # stack roots
MarkCompactGC._mark_root, # static in prebuilt non-gc structures
- MarkCompactGC._mark_root) # static in prebuilt gc objects
+ MarkCompactGC._mark_root, # static in prebuilt gc objects
+ is_minor=False)
if (self.objects_with_finalizers.non_empty() or
self.run_finalizers.non_empty()):
self.trace_from_objects_with_finalizers()
@@ -461,7 +462,8 @@
self.root_walker.walk_roots(
MarkCompactGC._update_ref, # stack roots
MarkCompactGC._update_ref, # static in prebuilt non-gc structures
- MarkCompactGC._update_ref) # static in prebuilt gc objects
+ MarkCompactGC._update_ref, # static in prebuilt gc objects
+ is_minor=False)
self.walk_marked_objects(MarkCompactGC.trace_and_update_ref)
def walk_marked_objects(self, callback):
diff --git a/pypy/rpython/memory/gc/marksweep.py
b/pypy/rpython/memory/gc/marksweep.py
--- a/pypy/rpython/memory/gc/marksweep.py
+++ b/pypy/rpython/memory/gc/marksweep.py
@@ -253,7 +253,8 @@
self.root_walker.walk_roots(
MarkSweepGC._mark_root, # stack roots
MarkSweepGC._mark_root, # static in prebuilt non-gc structures
- MarkSweepGC._mark_root) # static in prebuilt gc objects
+ MarkSweepGC._mark_root, # static in prebuilt gc objects
+ is_minor=False)
# from this point onwards, no more mallocs should be possible
old_malloced = self.bytes_malloced
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
@@ -1303,7 +1303,8 @@
self.root_walker.walk_roots(
MiniMarkGC._trace_drag_out1, # stack roots
MiniMarkGC._trace_drag_out1, # static in prebuilt non-gc
- None) # static in prebuilt gc
+ None, # static in prebuilt gc
+ is_minor=True)
debug_stop("gc-minor-walkroots")
def collect_cardrefs_to_nursery(self):
@@ -1711,7 +1712,8 @@
self.root_walker.walk_roots(
MiniMarkGC._collect_ref_stk, # stack roots
MiniMarkGC._collect_ref_stk, # static in prebuilt non-gc structures
- None) # we don't need the static in all prebuilt gc objects
+ None, # we don't need the static in all prebuilt gc objects
+ is_minor=False)
#
# If we are in an inner collection caused by a call to a finalizer,
# the 'run_finalizers' objects also need to be kept alive.
diff --git a/pypy/rpython/memory/gc/semispace.py
b/pypy/rpython/memory/gc/semispace.py
--- a/pypy/rpython/memory/gc/semispace.py
+++ b/pypy/rpython/memory/gc/semispace.py
@@ -350,7 +350,8 @@
self.root_walker.walk_roots(
SemiSpaceGC._collect_root, # stack roots
SemiSpaceGC._collect_root, # static in prebuilt non-gc structures
- SemiSpaceGC._collect_root) # static in prebuilt gc objects
+ SemiSpaceGC._collect_root, # static in prebuilt gc objects
+ is_minor=False)
def _collect_root(self, root):
root.address[0] = self.copy(root.address[0])
diff --git a/pypy/rpython/memory/gctransform/framework.py
b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -1355,7 +1355,8 @@
def walk_roots(self, collect_stack_root,
collect_static_in_prebuilt_nongc,
- collect_static_in_prebuilt_gc):
+ collect_static_in_prebuilt_gc,
+ is_minor):
gcdata = self.gcdata
gc = self.gc
if collect_static_in_prebuilt_nongc:
@@ -1375,7 +1376,8 @@
collect_static_in_prebuilt_gc(gc, result)
addr += sizeofaddr
if collect_stack_root:
- self.walk_stack_roots(collect_stack_root) # abstract
+ self.walk_stack_roots(collect_stack_root, # abstract
+ is_minor=is_minor)
def need_stacklet_support(self):
raise Exception("%s does not support stacklets" % (
diff --git a/pypy/rpython/memory/gctransform/shadowstack.py
b/pypy/rpython/memory/gctransform/shadowstack.py
--- a/pypy/rpython/memory/gctransform/shadowstack.py
+++ b/pypy/rpython/memory/gctransform/shadowstack.py
@@ -94,10 +94,11 @@
self.shadow_stack_pool.initial_setup()
BaseRootWalker.setup_root_walker(self)
- def walk_stack_roots(self, collect_stack_root):
+ def walk_stack_roots(self, collect_stack_root, is_minor):
gcdata = self.gcdata
self.rootstackhook(collect_stack_root,
- gcdata.root_stack_base, gcdata.root_stack_top)
+ gcdata.root_stack_base, gcdata.root_stack_top,
+ is_minor=is_minor)
def need_thread_support(self, gctransformer, getfn):
from pypy.module.thread import ll_thread # xxx fish
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit