[pypy-svn] r71380 - pypy/trunk/pypy/jit/backend/x86

arigo at codespeak.net arigo at codespeak.net
Sun Feb 21 15:28:00 CET 2010


Author: arigo
Date: Sun Feb 21 15:27:59 2010
New Revision: 71380

Modified:
   pypy/trunk/pypy/jit/backend/x86/assembler.py
   pypy/trunk/pypy/jit/backend/x86/regalloc.py
Log:
After all, don't rely on the fact that the compiler will not change the
values pushed as arguments to the function and do the proper fix.  Too
bad, one or two extra pushes/pops per call to remember_young_pointer().


Modified: pypy/trunk/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/assembler.py	Sun Feb 21 15:27:59 2010
@@ -1389,16 +1389,12 @@
         for i in range(len(arglocs)-1, 2, -1):
             mc.PUSH(arglocs[i])
         mc.CALL(rel32(op.args[2].getint()))
-        pop_count = 0
-        for i in range(3, len(arglocs)):
+        mc.POP(eax)
+        mc.POP(eax)
+        for i in range(5, len(arglocs)):
             loc = arglocs[i]
-            pop_count += 1
-            if isinstance(loc, REG):
-                while pop_count > 0:
-                    mc.POP(loc)
-                    pop_count -= 1
-        if pop_count:
-            mc.ADD(esp, imm(WORD * pop_count))
+            assert isinstance(loc, REG)
+            mc.POP(loc)
         # patch the JZ above
         offset = mc.get_relative_pos() - jz_location
         assert 0 < offset <= 127

Modified: pypy/trunk/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/regalloc.py	Sun Feb 21 15:27:59 2010
@@ -665,14 +665,8 @@
         # See remember_young_pointer() in rpython/memory/gc/generation.py.
         for v, reg in self.rm.reg_bindings.items():
             if ((reg is eax or reg is ecx or reg is edx)
-                and self.rm.stays_alive(v)
-                and reg not in arglocs[3:]):
+                and self.rm.stays_alive(v)):
                 arglocs.append(reg)
-        # XXX this generates code that looks like: push eax / call / pop eax
-        # and expects eax to be saved, even though it's also an argument to
-        # the call.  This holds so far, by looking at the assembler of
-        # remember_young_pointer(), but it may be a bit fragile.  For a
-        # fix see r71364+r71370.
         self.PerformDiscard(op, arglocs)
         self.rm.possibly_free_vars(op.args)
 



More information about the Pypy-commit mailing list