Esempio n. 1
0
def fatalerror_notb(msg):
    # a variant of fatalerror() that doesn't print the RPython traceback
    if not we_are_translated():
        raise FatalError(msg)
    from rpython.rtyper.lltypesystem import lltype
    from rpython.rtyper.lltypesystem.lloperation import llop
    llop.debug_fatalerror(lltype.Void, msg)
Esempio n. 2
0
def fatalerror_notb(msg):
    # a variant of fatalerror() that doesn't print the RPython traceback
    if not we_are_translated():
        raise FatalError(msg)
    from rpython.rtyper.lltypesystem import lltype
    from rpython.rtyper.lltypesystem.lloperation import llop
    llop.debug_fatalerror(lltype.Void, msg)
Esempio n. 3
0
def fatalerror(msg):
    # print the RPython traceback and abort with a fatal error
    if not we_are_translated():
        raise FatalError(msg)
    from rpython.rtyper.lltypesystem import lltype
    from rpython.rtyper.lltypesystem.lloperation import llop
    llop.debug_print_traceback(lltype.Void)
    llop.debug_fatalerror(lltype.Void, msg)
Esempio n. 4
0
def fatalerror(msg):
    # print the RPython traceback and abort with a fatal error
    if not we_are_translated():
        raise FatalError(msg)
    from rpython.rtyper.lltypesystem import lltype
    from rpython.rtyper.lltypesystem.lloperation import llop
    llop.debug_print_traceback(lltype.Void)
    llop.debug_fatalerror(lltype.Void, msg)
Esempio n. 5
0
    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!")
Esempio n. 6
0
 def next(self):
     index = self.jit_index
     if index < 0:
         # case "outside the jit"
         addr = self.addr
         value = 0
         while True:
             b = ord(addr.char[0])
             addr += 1
             value += b
             if b < 0x80:
                 break
             value = (value - 0x80) << 7
         self.addr = addr
         return value
     else:
         # case "in the jit"
         from rpython.jit.backend.x86.arch import FRAME_FIXED_SIZE
         from rpython.jit.backend.x86.arch import PASS_ON_MY_FRAME
         self.jit_index = index + 1
         if index == 0:
             # the jitframe is an object in EBP
             return LOC_REG | ((INDEX_OF_EBP + 1) << 2)
         if index == 1:
             return 0
         # the remaining returned values should be:
         #      saved %rbp
         #      saved %r15           or on 32bit:
         #      saved %r14             saved %ebp
         #      saved %r13             saved %edi
         #      saved %r12             saved %esi
         #      saved %rbx             saved %ebx
         #      return addr            return addr
         stack_depth = PASS_ON_MY_FRAME + self.extra_stack_depth
         if IS_64_BITS:
             if index == 2:   # rbp
                 return LOC_ESP_PLUS | (stack_depth << 2)
             if index == 3:   # r15
                 return LOC_ESP_PLUS | ((stack_depth + 5) << 2)
             if index == 4:   # r14
                 return LOC_ESP_PLUS | ((stack_depth + 4) << 2)
             if index == 5:   # r13
                 return LOC_ESP_PLUS | ((stack_depth + 3) << 2)
             if index == 6:   # r12
                 return LOC_ESP_PLUS | ((stack_depth + 2) << 2)
             if index == 7:   # rbx
                 return LOC_ESP_PLUS | ((stack_depth + 1) << 2)
             if index == 8:   # return addr
                 return (LOC_ESP_PLUS |
                     ((FRAME_FIXED_SIZE + self.extra_stack_depth) << 2))
         else:
             if index == 2:   # ebp
                 return LOC_ESP_PLUS | (stack_depth << 2)
             if index == 3:   # edi
                 return LOC_ESP_PLUS | ((stack_depth + 3) << 2)
             if index == 4:   # esi
                 return LOC_ESP_PLUS | ((stack_depth + 2) << 2)
             if index == 5:   # ebx
                 return LOC_ESP_PLUS | ((stack_depth + 1) << 2)
             if index == 6:   # return addr
                 return (LOC_ESP_PLUS |
                     ((FRAME_FIXED_SIZE + self.extra_stack_depth) << 2))
         llop.debug_fatalerror(lltype.Void, "asmgcroot: invalid index")
         return 0   # annotator fix
Esempio n. 7
0
 def next(self):
     index = self.jit_index
     if index < 0:
         # case "outside the jit"
         addr = self.addr
         value = 0
         while True:
             b = ord(addr.char[0])
             addr += 1
             value += b
             if b < 0x80:
                 break
             value = (value - 0x80) << 7
         self.addr = addr
         return value
     else:
         # case "in the jit"
         from rpython.jit.backend.x86.arch import FRAME_FIXED_SIZE
         from rpython.jit.backend.x86.arch import PASS_ON_MY_FRAME
         self.jit_index = index + 1
         if index == 0:
             # the jitframe is an object in EBP
             return LOC_REG | ((INDEX_OF_EBP + 1) << 2)
         if index == 1:
             return 0
         # the remaining returned values should be:
         #      saved %rbp
         #      saved %r15           or on 32bit:
         #      saved %r14             saved %ebp
         #      saved %r13             saved %edi
         #      saved %r12             saved %esi
         #      saved %rbx             saved %ebx
         #      return addr            return addr
         stack_depth = PASS_ON_MY_FRAME + self.extra_stack_depth
         if IS_64_BITS:
             if index == 2:  # rbp
                 return LOC_ESP_PLUS | (stack_depth << 2)
             if index == 3:  # r15
                 return LOC_ESP_PLUS | ((stack_depth + 5) << 2)
             if index == 4:  # r14
                 return LOC_ESP_PLUS | ((stack_depth + 4) << 2)
             if index == 5:  # r13
                 return LOC_ESP_PLUS | ((stack_depth + 3) << 2)
             if index == 6:  # r12
                 return LOC_ESP_PLUS | ((stack_depth + 2) << 2)
             if index == 7:  # rbx
                 return LOC_ESP_PLUS | ((stack_depth + 1) << 2)
             if index == 8:  # return addr
                 return (LOC_ESP_PLUS |
                         ((FRAME_FIXED_SIZE + self.extra_stack_depth) << 2))
         else:
             if index == 2:  # ebp
                 return LOC_ESP_PLUS | (stack_depth << 2)
             if index == 3:  # edi
                 return LOC_ESP_PLUS | ((stack_depth + 3) << 2)
             if index == 4:  # esi
                 return LOC_ESP_PLUS | ((stack_depth + 2) << 2)
             if index == 5:  # ebx
                 return LOC_ESP_PLUS | ((stack_depth + 1) << 2)
             if index == 6:  # return addr
                 return (LOC_ESP_PLUS |
                         ((FRAME_FIXED_SIZE + self.extra_stack_depth) << 2))
         llop.debug_fatalerror(lltype.Void, "asmgcroot: invalid index")
         return 0  # annotator fix