[pypy-commit] pypy arm-backed-float: ensure 8 byte stack aligment when entering the compiled code

bivab noreply at buildbot.pypy.org
Fri May 20 10:34:27 CEST 2011


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backed-float
Changeset: r44312:fac212983c3d
Date: 2011-05-20 10:11 +0200
http://bitbucket.org/pypy/pypy/changeset/fac212983c3d/

Log:	ensure 8 byte stack aligment when entering the compiled code

diff --git a/pypy/jit/backend/arm/assembler.py b/pypy/jit/backend/arm/assembler.py
--- a/pypy/jit/backend/arm/assembler.py
+++ b/pypy/jit/backend/arm/assembler.py
@@ -379,20 +379,25 @@
     def gen_func_epilog(self, mc=None, cond=c.AL):
         if mc is None:
             mc = self.mc
+        offset = 1
+        if self.cpu.supports_floats:
+            offset += 1 # to keep stack alignment
         mc.MOV_rr(r.sp.value, r.fp.value, cond=cond)
-        mc.ADD_ri(r.sp.value, r.sp.value, (N_REGISTERS_SAVED_BY_MALLOC+1)*WORD, cond=cond)
+        mc.ADD_ri(r.sp.value, r.sp.value, (N_REGISTERS_SAVED_BY_MALLOC+offset)*WORD, cond=cond)
         if self.cpu.supports_floats:
             mc.VPOP([reg.value for reg in r.callee_saved_vfp_registers], cond=cond)
         mc.POP([reg.value for reg in r.callee_restored_registers], cond=cond)
 
     def gen_func_prolog(self):
         self.mc.PUSH([reg.value for reg in r.callee_saved_registers])
+        offset = 1
         if self.cpu.supports_floats:
             self.mc.VPUSH([reg.value for reg in r.callee_saved_vfp_registers])
+            offset +=1 # to keep stack alignment
         # here we modify the stack pointer to leave room for the 9 registers
         # that are going to be saved here around malloc calls and one word to
         # store the force index
-        self.mc.SUB_ri(r.sp.value, r.sp.value,  (N_REGISTERS_SAVED_BY_MALLOC+1)*WORD)
+        self.mc.SUB_ri(r.sp.value, r.sp.value, (N_REGISTERS_SAVED_BY_MALLOC+offset)*WORD)
         self.mc.MOV_rr(r.fp.value, r.sp.value)
 
     def gen_bootstrap_code(self, nonfloatlocs, floatlocs, inputargs):


More information about the pypy-commit mailing list