def __init__(self, gctransformer): BaseRootWalker.__init__(self, gctransformer) # NB. 'self' is frozen, but we can use self.gcdata to store state gcdata = self.gcdata gcdata.can_look_at_partial_stack = True def incr_stack(n): top = gcdata.root_stack_top gcdata.root_stack_top = top + n * sizeofaddr return top self.incr_stack = incr_stack def decr_stack(n): top = gcdata.root_stack_top - n * sizeofaddr gcdata.root_stack_top = top return top self.decr_stack = decr_stack self.invoke_collect_stack_root = specialize.call_location()( lambda arg0, arg1, arg2, addr: arg0(self.gc, addr)) self.shadow_stack_pool = ShadowStackPool(gcdata) rsd = gctransformer.root_stack_depth if rsd is not None: self.shadow_stack_pool.root_stack_depth = rsd
def __init__(self, gctransformer): BaseRootWalker.__init__(self, gctransformer) # NB. 'self' is frozen, but we can use self.gcdata to store state gcdata = self.gcdata def incr_stack(n): top = gcdata.root_stack_top gcdata.root_stack_top = top + n*sizeofaddr return top self.incr_stack = incr_stack def decr_stack(n): top = gcdata.root_stack_top - n*sizeofaddr gcdata.root_stack_top = top return top self.decr_stack = decr_stack root_iterator = get_root_iterator(gctransformer) def walk_stack_root(callback, start, end): root_iterator.setcontext(NonConstant(llmemory.NULL)) gc = self.gc addr = end while True: addr = root_iterator.nextleft(gc, start, addr) if addr == llmemory.NULL: return callback(gc, addr) self.rootstackhook = walk_stack_root self.shadow_stack_pool = ShadowStackPool(gcdata) rsd = gctransformer.root_stack_depth if rsd is not None: self.shadow_stack_pool.root_stack_depth = rsd
def __init__(self, gctransformer): BaseRootWalker.__init__(self, gctransformer) # NB. 'self' is frozen, but we can use self.gcdata to store state gcdata = self.gcdata def incr_stack(n): top = gcdata.root_stack_top gcdata.root_stack_top = top + n * sizeofaddr return top self.incr_stack = incr_stack def decr_stack(n): top = gcdata.root_stack_top - n * sizeofaddr gcdata.root_stack_top = top return top self.decr_stack = decr_stack def walk_stack_root(callback, start, end): gc = self.gc addr = end while addr != start: addr -= sizeofaddr if gc.points_to_valid_gc_object(addr): callback(gc, addr) self.rootstackhook = walk_stack_root self.shadow_stack_pool = ShadowStackPool(gcdata) rsd = gctransformer.root_stack_depth if rsd is not None: self.shadow_stack_pool.root_stack_depth = rsd
def __init__(self, gctransformer): BaseRootWalker.__init__(self, gctransformer) # NB. 'self' is frozen, but we can use self.gcdata to store state gcdata = self.gcdata def incr_stack(n): top = gcdata.root_stack_top gcdata.root_stack_top = top + n*sizeofaddr return top self.incr_stack = incr_stack def decr_stack(n): top = gcdata.root_stack_top - n*sizeofaddr gcdata.root_stack_top = top return top self.decr_stack = decr_stack def walk_stack_root(callback, start, end): gc = self.gc addr = end while addr != start: addr -= sizeofaddr if gc.points_to_valid_gc_object(addr): callback(gc, addr) self.rootstackhook = walk_stack_root self.shadow_stack_pool = ShadowStackPool(gcdata) rsd = gctransformer.root_stack_depth if rsd is not None: self.shadow_stack_pool.root_stack_depth = rsd
def __init__(self, gctransformer): BaseRootWalker.__init__(self, gctransformer) def _asm_callback(): self.walk_stack_from() self._asm_callback = _asm_callback self._shape_decompressor = ShapeDecompressor() self._with_jit = hasattr(gctransformer.translator, '_jit2gc') if self._with_jit: jit2gc = gctransformer.translator._jit2gc self.frame_tid = jit2gc['frame_tid'] self.gctransformer = gctransformer # # unless overridden in need_thread_support(): self.belongs_to_current_thread = lambda framedata: True
def setup_root_walker(self): self.shadow_stack_pool.initial_setup() BaseRootWalker.setup_root_walker(self)