[pypy-svn] r34408 - pypy/dist/pypy/jit/codegen/i386

arigo at codespeak.net arigo at codespeak.net
Thu Nov 9 13:22:58 CET 2006


Author: arigo
Date: Thu Nov  9 13:22:57 2006
New Revision: 34408

Modified:
   pypy/dist/pypy/jit/codegen/i386/rgenop.py
Log:
Trying to fix the stack alignment code for calls on the Mac/x86 machines.


Modified: pypy/dist/pypy/jit/codegen/i386/rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/rgenop.py	(original)
+++ pypy/dist/pypy/jit/codegen/i386/rgenop.py	Thu Nov  9 13:22:57 2006
@@ -337,11 +337,15 @@
         
     def genop_call(self, sigtoken, gv_fnptr, args_gv):
         MASK = CALL_ALIGN-1
-        final_depth = self.stackdepth + len(args_gv)
-        delta = (final_depth+MASK)&~MASK-final_depth
-        if delta:
-            self.mc.SUB(esp, imm(delta*WORD))
-            self.stackdepth += delta
+        if MASK:
+            final_depth = self.stackdepth
+            for gv_arg in args_gv:
+                if gv_arg is not None:
+                    final_depth += 1
+            delta = (final_depth+MASK)&~MASK-final_depth
+            if delta:
+                self.mc.SUB(esp, imm(delta*WORD))
+                self.stackdepth += delta
         for i in range(len(args_gv)-1, -1, -1):
             gv_arg = args_gv[i]
             if gv_arg is not None:



More information about the Pypy-commit mailing list