[pypy-commit] pypy ppc-jit-backend: Do not save the volatile registers around the call malloc in malloc_slowpath

bivab noreply at buildbot.pypy.org
Tue Feb 21 11:06:11 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: ppc-jit-backend
Changeset: r52717:1f4a181255fa
Date: 2012-02-21 02:04 -0800
http://bitbucket.org/pypy/pypy/changeset/1f4a181255fa/

Log:	Do not save the volatile registers around the call malloc in
	malloc_slowpath

	Saving the registers for malloc on the stack overwrites the saved
	volatiles leading to random failures when the volatile registers are
	restored. The volatile registers managed by the register allocator
	are saved and restored anyway around the call to malloc.

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
@@ -307,15 +307,17 @@
             mc.stw(r.SCRATCH.value, r.SP.value, 0) 
         else:
             mc.std(r.SCRATCH.value, r.SP.value, 0)
-        with Saved_Volatiles(mc):
-            # 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():
-                mc.store(reg.value, r.SPP.value, ofs)
-            mc.call(addr)
-            for reg, ofs in PPCRegisterManager.REGLOC_TO_COPY_AREA_OFS.items():
-                mc.load(reg.value, r.SPP.value, ofs)
+        # managed volatiles are saved below
+        if self.cpu.supports_floats:
+            assert 0, "make sure to save floats here"
+        # 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():
+            mc.store(reg.value, r.SPP.value, ofs)
+        mc.call(addr)
+        for reg, ofs in PPCRegisterManager.REGLOC_TO_COPY_AREA_OFS.items():
+            mc.load(reg.value, r.SPP.value, ofs)
 
         mc.cmp_op(0, r.r3.value, 0, imm=True)
         jmp_pos = mc.currpos()


More information about the pypy-commit mailing list