[pypy-commit] pypy ppc-jit-backend: (edelsohn, bivab) Fix offsets where registers are stored around malloc calls and actually save them

bivab noreply at buildbot.pypy.org
Fri Feb 17 20:57:48 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: ppc-jit-backend
Changeset: r52593:a702c4ce1008
Date: 2012-02-17 11:56 -0800
http://bitbucket.org/pypy/pypy/changeset/a702c4ce1008/

Log:	(edelsohn, bivab) Fix offsets where registers are stored around
	malloc calls and actually save them

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
@@ -3,7 +3,7 @@
 from pypy.jit.backend.ppc.ppc_form import PPCForm as Form
 from pypy.jit.backend.ppc.ppc_field import ppc_fields
 from pypy.jit.backend.ppc.regalloc import (TempInt, PPCFrameManager,
-                                                  Regalloc)
+                                                  Regalloc, PPCRegisterManager)
 from pypy.jit.backend.ppc.assembler import Assembler
 from pypy.jit.backend.ppc.opassembler import OpAssembler
 from pypy.jit.backend.ppc.symbol_lookup import lookup
@@ -305,7 +305,17 @@
             # Values to compute size stored in r3 and r4
             mc.subf(r.r3.value, r.r3.value, r.r4.value)
             addr = self.cpu.gc_ll_descr.get_malloc_slowpath_addr()
+            for reg, ofs in PPCRegisterManager.REGLOC_TO_COPY_AREA_OFS.items():
+                if IS_PPC_32:
+                    mc.stw(reg.value, r.SPP.value, ofs)
+                else:
+                    mc.std(reg.value, r.SPP.value, ofs)
             mc.call(addr)
+            for reg, ofs in PPCRegisterManager.REGLOC_TO_COPY_AREA_OFS.items():
+                if IS_PPC_32:
+                    mc.lwz(reg.value, r.SPP.value, ofs)
+                else:
+                    mc.ld(reg.value, r.SPP.value, ofs)
 
         mc.cmp_op(0, r.r3.value, 0, imm=True)
         jmp_pos = mc.currpos()
diff --git a/pypy/jit/backend/ppc/regalloc.py b/pypy/jit/backend/ppc/regalloc.py
--- a/pypy/jit/backend/ppc/regalloc.py
+++ b/pypy/jit/backend/ppc/regalloc.py
@@ -50,37 +50,33 @@
     save_around_call_regs = r.VOLATILES
 
     REGLOC_TO_COPY_AREA_OFS = {
-        r.r0:   MY_COPY_OF_REGS + 0 * WORD,
-        r.r2:   MY_COPY_OF_REGS + 1 * WORD,
-        r.r3:   MY_COPY_OF_REGS + 2 * WORD,
-        r.r4:   MY_COPY_OF_REGS + 3 * WORD,
-        r.r5:   MY_COPY_OF_REGS + 4 * WORD,
-        r.r6:   MY_COPY_OF_REGS + 5 * WORD,
-        r.r7:   MY_COPY_OF_REGS + 6 * WORD,
-        r.r8:   MY_COPY_OF_REGS + 7 * WORD,
-        r.r9:   MY_COPY_OF_REGS + 8 * WORD,
-        r.r10:  MY_COPY_OF_REGS + 9 * WORD,
-        r.r11:  MY_COPY_OF_REGS + 10 * WORD,
-        r.r12:  MY_COPY_OF_REGS + 11 * WORD,
-        r.r13:  MY_COPY_OF_REGS + 12 * WORD,
-        r.r14:  MY_COPY_OF_REGS + 13 * WORD,
-        r.r15:  MY_COPY_OF_REGS + 14 * WORD,
-        r.r16:  MY_COPY_OF_REGS + 15 * WORD,
-        r.r17:  MY_COPY_OF_REGS + 16 * WORD,
-        r.r18:  MY_COPY_OF_REGS + 17 * WORD,
-        r.r19:  MY_COPY_OF_REGS + 18 * WORD,
-        r.r20:  MY_COPY_OF_REGS + 19 * WORD,
-        r.r21:  MY_COPY_OF_REGS + 20 * WORD,
-        r.r22:  MY_COPY_OF_REGS + 21 * WORD,
-        r.r23:  MY_COPY_OF_REGS + 22 * WORD,
-        r.r24:  MY_COPY_OF_REGS + 23 * WORD,
-        r.r25:  MY_COPY_OF_REGS + 24 * WORD,
-        r.r26:  MY_COPY_OF_REGS + 25 * WORD,
-        r.r27:  MY_COPY_OF_REGS + 26 * WORD,
-        r.r28:  MY_COPY_OF_REGS + 27 * WORD,
-        r.r29:  MY_COPY_OF_REGS + 28 * WORD,
-        r.r30:  MY_COPY_OF_REGS + 29 * WORD,
-        r.r31:  MY_COPY_OF_REGS + 30 * WORD,
+        r.r3:   MY_COPY_OF_REGS + 0 * WORD,
+        r.r4:   MY_COPY_OF_REGS + 1 * WORD,
+        r.r5:   MY_COPY_OF_REGS + 2 * WORD,
+        r.r6:   MY_COPY_OF_REGS + 3 * WORD,
+        r.r7:   MY_COPY_OF_REGS + 4 * WORD,
+        r.r8:   MY_COPY_OF_REGS + 5 * WORD,
+        r.r9:   MY_COPY_OF_REGS + 6 * WORD,
+        r.r10:  MY_COPY_OF_REGS + 7 * WORD,
+        r.r11:  MY_COPY_OF_REGS + 8 * WORD,
+        r.r12:  MY_COPY_OF_REGS + 9 * WORD,
+        r.r14:  MY_COPY_OF_REGS + 10 * WORD,
+        r.r15:  MY_COPY_OF_REGS + 11 * WORD,
+        r.r16:  MY_COPY_OF_REGS + 12 * WORD,
+        r.r17:  MY_COPY_OF_REGS + 13 * WORD,
+        r.r18:  MY_COPY_OF_REGS + 14 * WORD,
+        r.r19:  MY_COPY_OF_REGS + 15 * WORD,
+        r.r20:  MY_COPY_OF_REGS + 16 * WORD,
+        r.r21:  MY_COPY_OF_REGS + 17 * WORD,
+        r.r22:  MY_COPY_OF_REGS + 18 * WORD,
+        r.r23:  MY_COPY_OF_REGS + 19 * WORD,
+        r.r24:  MY_COPY_OF_REGS + 20 * WORD,
+        r.r25:  MY_COPY_OF_REGS + 21 * WORD,
+        r.r26:  MY_COPY_OF_REGS + 22 * WORD,
+        r.r27:  MY_COPY_OF_REGS + 23 * WORD,
+        r.r28:  MY_COPY_OF_REGS + 24 * WORD,
+        r.r29:  MY_COPY_OF_REGS + 25 * WORD,
+        r.r30:  MY_COPY_OF_REGS + 26 * WORD,
     }
 
     def __init__(self, longevity, frame_manager=None, assembler=None):


More information about the pypy-commit mailing list