[pypy-commit] pypy default: fix a bit more cleanly without writing to the stack

arigo noreply at buildbot.pypy.org
Wed Dec 3 12:20:01 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r74795:4e877792713b
Date: 2014-12-03 12:19 +0100
http://bitbucket.org/pypy/pypy/changeset/4e877792713b/

Log:	fix a bit more cleanly without writing to the stack

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
@@ -1152,15 +1152,15 @@
             if isinstance(argloc, RegLoc):
                 if WORD == 4 and argloc.value >= 4:
                     # meh, can't read the lowest byte of esi or edi on 32-bit
-                    if resloc.value < 4:
+                    if resloc is not argloc:
                         self.mc.MOV(resloc, argloc)
                         argloc = resloc
-                    else:
-                        tmploc = RawEspLoc(0, INT)
-                        self.mc.MOV(tmploc, argloc)
-                        argloc = tmploc
-                if isinstance(argloc, RegLoc):
-                    argloc = argloc.lowest8bits()
+                    if resloc.value >= 4:
+                        # still annoyed, hack needed
+                        self.mc.SHL_ri(resloc.value, 24)
+                        self.mc.SAR_ri(resloc.value, 24)
+                        return
+                argloc = argloc.lowest8bits()
             self.mc.MOVSX8(resloc, argloc)
         elif numbytesloc.value == 2:
             self.mc.MOVSX16(resloc, argloc)


More information about the pypy-commit mailing list