Commits

Armin Rigo committed 344d1fe

Fix: should not have killed needed_extra_stack_locations() from 'default'.

Comments (0)

Files changed (2)

pypy/jit/backend/x86/assembler.py

         regalloc.walk_operations(operations)
         if we_are_translated() or self.cpu.dont_keepalive_stuff:
             self._regalloc = None   # else keep it around for debugging
-        frame_depth = regalloc.fm.get_frame_depth()
+        frame_depth = regalloc.get_final_frame_depth()
         jump_target_descr = regalloc.jump_target_descr
         if jump_target_descr is not None:
             target_frame_depth = jump_target_descr._x86_clt.frame_depth

pypy/jit/backend/x86/regalloc.py

         self.min_bytes_before_label = max(self.min_bytes_before_label,
                                           at_least_position)
 
-    @staticmethod
-    def reserve_param(n):
+    def needed_extra_stack_locations(self, n):
         assert n <= OFFSTACK_REAL_FRAME
-        #self.param_depth = max(self.param_depth, n)
+        self.min_frame_depth = self.fm.get_frame_depth()
+        return
+        # call *after* you needed extra stack locations: (%esp), (%esp+4)...
+        min_frame_depth = self.fm.get_frame_depth() + n
+        if min_frame_depth > self.min_frame_depth:
+            self.min_frame_depth = min_frame_depth
+
+    def get_final_frame_depth(self):
+        self.needed_extra_stack_locations(0)  # update min_frame_depth
+        return self.min_frame_depth
 
     def _set_initial_bindings(self, inputargs):
         if IS_X86_64: