Exemplo n.º 1
0
 def locate_caller_based_on_retaddr(self, retaddr):
     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
     gcmapstart2 = self._extra_gcmapstart()
     gcmapend2   = self._extra_gcmapend()
     if gcmapstart2 != gcmapend2:
         # we have a non-empty JIT-produced table to look in
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item.address[1])
             return
         # maybe the JIT-produced table is not sorted?
         sort_gcmap(gcmapstart2, gcmapend2)
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item.address[1])
             return
     # 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)
     item = search_in_gcmap(gcmapstart, gcmapend, retaddr)
     if item:
         self._shape_decompressor.setpos(item.signed[1])
         return
     llop.debug_fatalerror(lltype.Void, "cannot find gc roots!")
Exemplo n.º 2
0
 def locate_caller_based_on_retaddr(self, retaddr):
     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
     gcmapstart2 = self._extra_gcmapstart()
     gcmapend2   = self._extra_gcmapend()
     if gcmapstart2 != gcmapend2:
         # we have a non-empty JIT-produced table to look in
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item.address[1])
             return
         # maybe the JIT-produced table is not sorted?
         sort_gcmap(gcmapstart2, gcmapend2)
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item.address[1])
             return
     # the item may have been not found because the main array was
     # not sorted.  Sort it and try again.
     sort_gcmap(gcmapstart, gcmapend)
     item = search_in_gcmap(gcmapstart, gcmapend, retaddr)
     if item:
         self._shape_decompressor.setpos(item.signed[1])
         return
     llop.debug_fatalerror(lltype.Void, "cannot find gc roots!")
Exemplo n.º 3
0
    def walk_stack_from(self):
        curframe = lltype.malloc(WALKFRAME, flavor='raw')
        otherframe = lltype.malloc(WALKFRAME, flavor='raw')

        # Walk over all the pieces of stack.  They are in a circular linked
        # list of structures of 7 words, the 2 first words being prev/next.
        # The anchor of this linked list is:
        anchor = llop.gc_asmgcroot_static(llmemory.Address, 3)
        initialframedata = anchor.address[1]
        stackscount = 0
        while initialframedata != anchor:     # while we have not looped back
            self.fill_initial_frame(curframe, initialframedata)
            # Loop over all the frames in the stack
            while self.walk_to_parent_frame(curframe, otherframe):
                swap = curframe
                curframe = otherframe    # caller becomes callee
                otherframe = swap
            # Then proceed to the next piece of stack
            initialframedata = initialframedata.address[1]
            stackscount += 1
        #
        expected = rffi.stackcounter.stacks_counter
        ll_assert(not (stackscount < expected), "non-closed stacks around")
        ll_assert(not (stackscount > expected), "stacks counter corruption?")
        lltype.free(otherframe, flavor='raw')
        lltype.free(curframe, flavor='raw')
Exemplo n.º 4
0
    def walk_stack_from(self):
        curframe = lltype.malloc(WALKFRAME, flavor='raw')
        otherframe = lltype.malloc(WALKFRAME, flavor='raw')

        # Walk over all the pieces of stack.  They are in a circular linked
        # list of structures of 7 words, the 2 first words being prev/next.
        # The anchor of this linked list is:
        anchor = llop.gc_asmgcroot_static(llmemory.Address, 3)
        initialframedata = anchor.address[1]
        stackscount = 0
        while initialframedata != anchor:     # while we have not looped back
            self.fill_initial_frame(curframe, initialframedata)
            # Loop over all the frames in the stack
            while self.walk_to_parent_frame(curframe, otherframe):
                swap = curframe
                curframe = otherframe    # caller becomes callee
                otherframe = swap
            # Then proceed to the next piece of stack
            initialframedata = initialframedata.address[1]
            stackscount += 1
        #
        expected = rffi.stackcounter.stacks_counter
        ll_assert(not (stackscount < expected), "non-closed stacks around")
        ll_assert(not (stackscount > expected), "stacks counter corruption?")
        lltype.free(otherframe, flavor='raw')
        lltype.free(curframe, flavor='raw')
Exemplo n.º 5
0
 def locate_caller_based_on_retaddr(self, retaddr):
     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
     gcmapstart2 = self._extra_gcmapstart()
     gcmapend2   = self._extra_gcmapend()
     if gcmapstart2 != gcmapend2:
         # we have a non-empty JIT-produced table to look in
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item)
             return
         # maybe the JIT-produced table is not sorted?
         was_already_sorted = self._extra_mark_sorted()
         if not was_already_sorted:
             sort_gcmap(gcmapstart2, gcmapend2)
             item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
             if item:
                 self._shape_decompressor.setaddr(item)
                 return
         # there is a rare risk that the array contains *two* entries
         # with the same key, one of which is dead (null value), and we
         # found the dead one above.  Solve this case by replacing all
         # dead keys with nulls, sorting again, and then trying again.
         replace_dead_entries_with_nulls(gcmapstart2, gcmapend2)
         sort_gcmap(gcmapstart2, gcmapend2)
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item)
             return
     # 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)
     item = search_in_gcmap(gcmapstart, gcmapend, retaddr)
     if item:
         self._shape_decompressor.setpos(item.signed[1])
         return
     llop.debug_fatalerror(lltype.Void, "cannot find gc roots!")
Exemplo n.º 6
0
 def locate_caller_based_on_retaddr(self, retaddr):
     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
     gcmapstart2 = self._extra_gcmapstart()
     gcmapend2 = self._extra_gcmapend()
     if gcmapstart2 != gcmapend2:
         # we have a non-empty JIT-produced table to look in
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item)
             return
         # maybe the JIT-produced table is not sorted?
         was_already_sorted = self._extra_mark_sorted()
         if not was_already_sorted:
             sort_gcmap(gcmapstart2, gcmapend2)
             item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
             if item:
                 self._shape_decompressor.setaddr(item)
                 return
         # there is a rare risk that the array contains *two* entries
         # with the same key, one of which is dead (null value), and we
         # found the dead one above.  Solve this case by replacing all
         # dead keys with nulls, sorting again, and then trying again.
         replace_dead_entries_with_nulls(gcmapstart2, gcmapend2)
         sort_gcmap(gcmapstart2, gcmapend2)
         item = search_in_gcmap2(gcmapstart2, gcmapend2, retaddr)
         if item:
             self._shape_decompressor.setaddr(item)
             return
     # 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)
     item = search_in_gcmap(gcmapstart, gcmapend, retaddr)
     if item:
         self._shape_decompressor.setpos(item.signed[1])
         return
     llop.debug_fatalerror(lltype.Void, "cannot find gc roots!")
Exemplo n.º 7
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
Exemplo n.º 8
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