Beispiel #1
0
 def write_stack_adj(self, mc, initial):
     if initial:
         addr = write_stack_reserve(mc, self.reserved_stack_vars)
         self.initial_addr = addr
     else:
         addr = write_stack_adj(mc, self.reserved_stack_vars)
         self.adj_addrs.append(addr)
Beispiel #2
0
 def ensure_stack_vars(self, n):
     if CALL_ALIGN > 1:
         # align the stack to a multiple of CALL_ALIGN words
         stack_words = GraphCtx.PROLOGUE_FIXED_WORDS + n
         stack_words = (stack_words + CALL_ALIGN-1) & ~ (CALL_ALIGN-1)
         n = stack_words - GraphCtx.PROLOGUE_FIXED_WORDS
     # patch all the LEA ESP if the requested amount has grown
     if n > self.reserved_stack_vars:
         addr = self.initial_addr
         patchmc = self.rgenop.InMemoryCodeBuilder(addr, addr+99)
         write_stack_reserve(patchmc, n)
         patchmc.done()
         for addr in self.adj_addrs:
             patchmc = self.rgenop.InMemoryCodeBuilder(addr, addr+99)
             write_stack_adj(patchmc, n)
             patchmc.done()
         self.reserved_stack_vars = n