Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r61046:87bb01bc4ae8
Date: 2013-02-10 17:14 +0200
http://bitbucket.org/pypy/pypy/changeset/87bb01bc4ae8/

Log:    turns out floats are 2-words wide on 32bit

diff --git a/rpython/jit/backend/x86/arch.py b/rpython/jit/backend/x86/arch.py
--- a/rpython/jit/backend/x86/arch.py
+++ b/rpython/jit/backend/x86/arch.py
@@ -33,7 +33,7 @@
     # ebp + ebx + esi + edi + 6 extra words + return address = 9 words
     FRAME_FIXED_SIZE = 11
     PASS_ON_MY_FRAME = 6
-    JITFRAME_FIXED_SIZE = 6 + 8 # 6 GPR + 8 XMM
+    JITFRAME_FIXED_SIZE = 6 + 8 * 2 # 6 GPR + 8 XMM * 2 WORDS/float
 else:
     # rbp + rbx + r12 + r13 + r14 + r15 + 12 extra words + return address = 19
     FRAME_FIXED_SIZE = 19
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -1958,7 +1958,10 @@
             elif pos < GPR_REGS * WORD:
                 locs.append(gpr_reg_mgr_cls.all_regs[pos // WORD])
             elif pos < (GPR_REGS + XMM_REGS) * WORD:
-                pos = pos // WORD - GPR_REGS
+                if IS_X86_64:
+                    pos = pos // WORD - GPR_REGS
+                else:
+                    pos = (pos // WORD - GPR_REGS) // 2
                 locs.append(xmm_reg_mgr_cls.all_regs[pos])
             else:
                 i = pos // WORD - JITFRAME_FIXED_SIZE
@@ -1983,10 +1986,14 @@
             if gpr not in ignored_regs:
                 mc.MOV_br(i * WORD + base_ofs, gpr.value)
         if withfloats:
+            if IS_X86_64:
+                coeff = 1
+            else:
+                coeff = 2
             # Push all XMM regs
             ofs = len(gpr_reg_mgr_cls.all_regs)
             for i in range(len(xmm_reg_mgr_cls.all_regs)):
-                mc.MOVSD_bx((ofs + i) * WORD + base_ofs, i)
+                mc.MOVSD_bx((ofs + i) * coeff * WORD + base_ofs, i)
 
     def _pop_all_regs_from_frame(self, mc, ignored_regs, withfloats,
                                  callee_only=False):
@@ -2001,9 +2008,13 @@
                 mc.MOV_rb(gpr.value, i * WORD + base_ofs)
         if withfloats:
             # Pop all XMM regs
+            if IS_X86_64:
+                coeff = 1
+            else:
+                coeff = 2
             ofs = len(gpr_reg_mgr_cls.all_regs)
             for i in range(len(xmm_reg_mgr_cls.all_regs)):
-                mc.MOVSD_xb(i, (ofs + i) * WORD + base_ofs)
+                mc.MOVSD_xb(i, (ofs + i) * WORD * coeff + base_ofs)
 
     def _build_failure_recovery(self, exc, withfloats=False):
         mc = codebuf.MachineCodeBlockWrapper()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to