示例#1
0
文件: asmgcroot.py 项目: juokaz/pypy
    def locate_caller_based_on_retaddr(self, retaddr, ebp_in_caller):
        gcmapstart = llop.gc_asmgcroot_static(llmemory.Address, 0)
        gcmapend   = llop.gc_asmgcroot_static(llmemory.Address, 1)
        item = search_in_gcmap(gcmapstart, gcmapend, retaddr)
        if item:
            self._shape_decompressor.setpos(item.signed[1])
            return

        if not self._shape_decompressor.sorted:
            # the item may have been not found because the main array was
            # not sorted.  Sort it and try again.
            win32_follow_gcmap_jmp(gcmapstart, gcmapend)
            sort_gcmap(gcmapstart, gcmapend)
            self._shape_decompressor.sorted = True
            item = search_in_gcmap(gcmapstart, gcmapend, retaddr)
            if item:
                self._shape_decompressor.setpos(item.signed[1])
                return

        if self._with_jit:
            # item not found.  We assume that it's a JIT-generated
            # location -- but we check for consistency that ebp points
            # to a JITFRAME object.
            from rpython.jit.backend.llsupport.jitframe import STACK_DEPTH_OFS

            tid = self.gc.get_possibly_forwarded_type_id(ebp_in_caller)
            ll_assert(rffi.cast(lltype.Signed, tid) ==
                      rffi.cast(lltype.Signed, self.frame_tid),
                      "found a stack frame that does not belong "
                      "anywhere I know, bug in asmgcc")
            # fish the depth
            extra_stack_depth = (ebp_in_caller + STACK_DEPTH_OFS).signed[0]
            ll_assert((extra_stack_depth & (rffi.sizeof(lltype.Signed) - 1))
                       == 0, "asmgcc: misaligned extra_stack_depth")
            extra_stack_depth //= rffi.sizeof(lltype.Signed)
            self._shape_decompressor.setjitframe(extra_stack_depth)
            return
        llop.debug_fatalerror(lltype.Void, "cannot find gc roots!")
示例#2
0
 def setpos(self, pos):
     if pos < 0:
         pos = ~ pos     # can ignore this "range" marker here
     gccallshapes = llop.gc_asmgcroot_static(llmemory.Address, 2)
     self.addr = gccallshapes + pos
     self.jit_index = -1
示例#3
0
 def setpos(self, pos):
     if pos < 0:
         pos = ~pos  # can ignore this "range" marker here
     gccallshapes = llop.gc_asmgcroot_static(llmemory.Address, 2)
     self.addr = gccallshapes + pos
     self.jit_index = -1