Ejemplo n.º 1
0
    def __init__(self, gctransformer):
        BaseRootWalker.__init__(self, gctransformer)

        def _asm_callback(initialframedata):
            self.walk_stack_from(initialframedata)
        self._asm_callback = _asm_callback
        self._shape_decompressor = ShapeDecompressor()
Ejemplo n.º 2
0
    def __init__(self, gctransformer):
        BaseRootWalker.__init__(self, gctransformer)
        self.rootstacksize = sizeofaddr * gctransformer.root_stack_depth
        # 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

        self.rootstackhook = gctransformer.root_stack_jit_hook
        if self.rootstackhook is None:
            def collect_stack_root(callback, gc, addr):
                if gc.points_to_valid_gc_object(addr):
                    callback(gc, addr)
                return sizeofaddr
            self.rootstackhook = collect_stack_root
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    def __init__(self, gctransformer):
        BaseRootWalker.__init__(self, gctransformer)

        def _asm_callback(initialframedata):
            self.walk_stack_from(initialframedata)

        self._asm_callback = _asm_callback
        self._shape_decompressor = ShapeDecompressor()
Ejemplo n.º 5
0
    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

        translator = gctransformer.translator
        if (hasattr(translator, '_jit2gc')
                and 'root_iterator' in translator._jit2gc):
            root_iterator = translator._jit2gc['root_iterator']

            def jit_walk_stack_root(callback, addr, end):
                root_iterator.context = NonConstant(llmemory.NULL)
                gc = self.gc
                while True:
                    addr = root_iterator.next(gc, addr, end)
                    if addr == llmemory.NULL:
                        return
                    callback(gc, addr)
                    addr += sizeofaddr

            self.rootstackhook = jit_walk_stack_root
        else:

            def default_walk_stack_root(callback, addr, end):
                gc = self.gc
                while addr != end:
                    if gc.points_to_valid_gc_object(addr):
                        callback(gc, addr)
                    addr += sizeofaddr

            self.rootstackhook = default_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
Ejemplo n.º 6
0
    def __init__(self, gctransformer):
        BaseRootWalker.__init__(self, gctransformer)

        def _asm_callback():
            self.walk_stack_from()
        self._asm_callback = _asm_callback
        self._shape_decompressor = ShapeDecompressor()
        if hasattr(gctransformer.translator, '_jit2gc'):
            jit2gc = gctransformer.translator._jit2gc
            self._extra_gcmapstart = jit2gc['gcmapstart']
            self._extra_gcmapend   = jit2gc['gcmapend']
        else:
            returns_null = lambda: llmemory.NULL
            self._extra_gcmapstart = returns_null
            self._extra_gcmapend   = returns_null
Ejemplo n.º 7
0
    def __init__(self, gctransformer):
        BaseRootWalker.__init__(self, gctransformer)

        def _asm_callback():
            self.walk_stack_from()
        self._asm_callback = _asm_callback
        self._shape_decompressor = ShapeDecompressor()
        if hasattr(gctransformer.translator, '_jit2gc'):
            jit2gc = gctransformer.translator._jit2gc
            self._extra_gcmapstart = jit2gc['gcmapstart']
            self._extra_gcmapend   = jit2gc['gcmapend']
        else:
            returns_null = lambda: llmemory.NULL
            self._extra_gcmapstart = returns_null
            self._extra_gcmapend   = returns_null
Ejemplo n.º 8
0
    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

        translator = gctransformer.translator
        if (hasattr(translator, '_jit2gc') and
                'root_iterator' in translator._jit2gc):
            root_iterator = translator._jit2gc['root_iterator']
            def jit_walk_stack_root(callback, addr, end):
                root_iterator.context = NonConstant(llmemory.NULL)
                gc = self.gc
                while True:
                    addr = root_iterator.next(gc, addr, end)
                    if addr == llmemory.NULL:
                        return
                    callback(gc, addr)
                    addr += sizeofaddr
            self.rootstackhook = jit_walk_stack_root
        else:
            def default_walk_stack_root(callback, addr, end):
                gc = self.gc
                while addr != end:
                    if gc.points_to_valid_gc_object(addr):
                        callback(gc, addr)
                    addr += sizeofaddr
            self.rootstackhook = default_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
Ejemplo n.º 9
0
 def setup_root_walker(self):
     stackbase = self.allocate_stack()
     ll_assert(bool(stackbase), "could not allocate root stack")
     self.gcdata.root_stack_top  = stackbase
     self.gcdata.root_stack_base = stackbase
     BaseRootWalker.setup_root_walker(self)
Ejemplo n.º 10
0
 def setup_root_walker(self):
     self.shadow_stack_pool.initial_setup()
     BaseRootWalker.setup_root_walker(self)
Ejemplo n.º 11
0
 def setup_root_walker(self):
     self.shadow_stack_pool.initial_setup()
     BaseRootWalker.setup_root_walker(self)