Author: Armin Rigo <[email protected]>
Branch: stackroot-speedup-2
Changeset: r75713:3dc3cccf1b6f
Date: 2015-02-04 19:53 +0100
http://bitbucket.org/pypy/pypy/changeset/3dc3cccf1b6f/
Log: Simplify the condition: we can just ignore
'walk_roots(is_minor=False)' for the purpose of knowing how far the
next 'is_minor=True' needs to go until for sure it doesn't see any
young object
diff --git a/rpython/memory/gctransform/asmgcroot.py
b/rpython/memory/gctransform/asmgcroot.py
--- a/rpython/memory/gctransform/asmgcroot.py
+++ b/rpython/memory/gctransform/asmgcroot.py
@@ -482,9 +482,8 @@
# small hack: the JIT reserves THREADLOCAL_OFS's last bit for
# us. We use it to store an "already traced past this frame"
# flag.
- if self._with_jit:
- is_minor = self.gcdata._gc_collect_is_minor
- if self.mark_jit_frame_can_stop(callee, is_minor):
+ if self._with_jit and self.gcdata._gc_collect_is_minor:
+ if self.mark_jit_frame_can_stop(callee):
return False
location = self._shape_decompressor.next()
@@ -557,21 +556,17 @@
else: # kind == LOC_EBP_MINUS: at -N(%ebp)
return ebp_in_caller - offset
- def mark_jit_frame_can_stop(self, callee, is_minor):
+ def mark_jit_frame_can_stop(self, callee):
location = self._shape_decompressor.get_threadlocal_loc()
if location == LOC_NOWHERE:
return False
addr = self.getlocation(callee, llmemory.NULL, location)
#
x = addr.signed[0]
- if is_minor:
- if x & 1:
- return True # this JIT stack frame is already
marked!
- else:
- addr.signed[0] = x | 1 # otherwise, mark it but don't stop
- return False
+ if x & 1:
+ return True # this JIT stack frame is already marked!
else:
- addr.signed[0] = x & ~1 # 'is_minor' is False, remove the marks
+ addr.signed[0] = x | 1 # otherwise, mark it but don't stop
return False
diff --git a/rpython/rtyper/llinterp.py b/rpython/rtyper/llinterp.py
--- a/rpython/rtyper/llinterp.py
+++ b/rpython/rtyper/llinterp.py
@@ -153,15 +153,14 @@
for frame in reversed(self.frame_stack):
#log.findroots("graph", frame.graph.name)
frame.find_roots(roots)
- # If two consecutive calls are both done with 'is_minor=True',
- # we can stop after the first already-seen frame in the stack
- # (which we still need to trace, but not its callers)
+ # If a call is done with 'is_minor=True', we can stop after the
+ # first frame in the stack that was already seen by the previous
+ # call with 'is_minor=True'. (We still need to trace that frame,
+ # but not its callers.)
if is_minor:
if getattr(frame, '_find_roots_already_seen', False):
break
frame._find_roots_already_seen = True
- else:
- frame._find_roots_already_seen = False
return roots
def find_exception(self, exc):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit