[pypy-commit] pypy stackroot-speedup: (fijal, arigo)
arigo
noreply at buildbot.pypy.org
Sat Jan 28 20:44:10 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stackroot-speedup
Changeset: r51933:40fbdea76ec1
Date: 2012-01-28 20:32 +0100
http://bitbucket.org/pypy/pypy/changeset/40fbdea76ec1/
Log: (fijal, arigo)
Also replace MARKER_FRAME with a pair of markers: during minor
collection, MARKER_FRAME is replaced by MARKER_FRAME_TRACED and a
previous MARKER_FRAME_TRACED causes the tracing to stop after the
corresponding jit frame.
diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -394,7 +394,8 @@
This is the class supporting --gcrootfinder=shadowstack.
"""
is_shadow_stack = True
- MARKER_FRAME = 8 # this marker now *follows* the frame addr
+ MARKER_FRAME = 8 # this marker now *follows* the frame addr
+ MARKER_FRAME_TRACED = 32
# The "shadowstack" is a portable way in which the GC finds the
# roots that live in the stack. Normally it is just a list of
@@ -407,6 +408,9 @@
# to a list of where the GC pointers are in the frame (this is the
# purpose of the present class).
#
+ # MARKER_FRAME is replaced with MARKER_FRAME_TRACED after the first
+ # time the GC traces the shadowstack.
+ #
# Note that across CALL_MAY_FORCE or CALL_ASSEMBLER, we can also go
# from the force_index to a ResumeGuardForcedDescr instance, which
# is used if the virtualizable or the virtualrefs need to be forced
@@ -464,7 +468,11 @@
prev.address[0] = rffi.cast(llmemory.Address,
shadowstack.MARKER_TRACED)
continue
+ if value == self.MARKER_FRAME_TRACED:
+ break
if value == self.MARKER_FRAME:
+ prev.address[0] = rffi.cast(llmemory.Address,
+ self.MARKER_FRAME_TRACED)
break
if gc.points_to_valid_gc_object(prev):
return prev
@@ -475,7 +483,13 @@
# go into JIT-frame-exploring mode.
prev -= llmemory.sizeof(llmemory.Address)
frame_addr = prev.signed[0]
- iself.saved_prev = prev
+ if value == self.MARKER_FRAME or not is_minor:
+ iself.saved_prev = prev # normal case
+ else:
+ # MARKER_FRAME_TRACED in a minor collection:
+ # <hack> this value in saved_prev will cause this
+ # function to stop after the current jit frame
+ iself.saved_prev = range_lowest
iself.frame_addr = frame_addr
addr = llmemory.cast_int_to_adr(frame_addr +
self.force_index_ofs)
More information about the pypy-commit
mailing list