[pypy-commit] pypy ppc-jit-backend: create a minimal frame malloc_slowpath and save sp and lr to the corresponding slots

bivab noreply at buildbot.pypy.org
Tue Feb 21 18:03:15 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: ppc-jit-backend
Changeset: r52743:26cf1b59efdb
Date: 2012-02-21 09:02 -0800
http://bitbucket.org/pypy/pypy/changeset/26cf1b59efdb/

Log:	create a minimal frame malloc_slowpath and save sp and lr to the
	corresponding slots

diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py
--- a/pypy/jit/backend/ppc/ppc_assembler.py
+++ b/pypy/jit/backend/ppc/ppc_assembler.py
@@ -302,14 +302,15 @@
             for _ in range(6):
                 mc.write32(0)
         frame_size = (# add space for floats later
-                    + WORD # Link Register
                     + BACKCHAIN_SIZE * WORD)
-        mc.subi(r.SP.value, r.SP.value, frame_size)
-        mc.mflr(r.SCRATCH.value)
         if IS_PPC_32:
-            mc.stw(r.SCRATCH.value, r.SP.value, 0) 
+            mc.stwu(r.SP.value, r.SP.value, -frame_size)
+            mc.mflr(r.SCRATCH.value)
+            mc.stw(r.SCRATCH.value, r.SP.value, frame_size + WORD) 
         else:
-            mc.std(r.SCRATCH.value, r.SP.value, 0)
+            mc.stdu(r.SP.value, r.SP.value, -frame_size)
+            mc.mflr(r.SCRATCH.value)
+            mc.std(r.SCRATCH.value, r.SP.value, frame_size + 2 * WORD)
         # managed volatiles are saved below
         if self.cpu.supports_floats:
             assert 0, "make sure to save floats here"
@@ -330,9 +331,13 @@
         mc.load_imm(r.r4, nursery_free_adr)
         mc.load(r.r4.value, r.r4.value, 0)
  
-        mc.load(r.SCRATCH.value, r.SP.value, 0) 
-        mc.mtlr(r.SCRATCH.value)     # restore LR
-        mc.addi(r.SP.value, r.SP.value, frame_size) # restore old SP
+        if IS_PPC_32:
+            ofs = WORD
+        else:
+            ofs = WORD * 2
+        mc.load(r.SCRATCH.value, r.SP.value, frame_size + ofs) 
+        mc.mtlr(r.SCRATCH.value)
+        mc.addi(r.SP.value, r.SP.value, frame_size)
         mc.blr()
 
         # if r3 == 0 we skip the return above and jump to the exception path


More information about the pypy-commit mailing list