[pypy-commit] pypy stmgc-c7: Small optimization for one case

arigo noreply at buildbot.pypy.org
Tue Jul 1 00:13:43 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r72301:e6db9b63d6e6
Date: 2014-06-30 22:00 +0200
http://bitbucket.org/pypy/pypy/changeset/e6db9b63d6e6/

Log:	Small optimization for one case

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
@@ -2353,8 +2353,12 @@
                     assert isinstance(loc_index, ImmedLoc)
                     cardindex = loc_index.value >> card_bits
                     if isinstance(loc_base, RegLoc):
-                        mc.MOV_ri(r11.value, cardindex << 4)     # 32/64bit
-                        mc.ADD_rr(r11.value, loc_base.value)
+                        if rx86.fits_in_32bits(write_locks_base + cardindex):
+                            write_locks_base += cardindex
+                            mc.MOV_rr(r11.value, loc_base.value)
+                        else:
+                            mc.MOV_ri(r11.value, cardindex << 4)    # 32/64bit
+                            mc.ADD_rr(r11.value, loc_base.value)
                         mc.SHR_ri(r11.value, 4)
                     else:
                         mc.MOV_ri(r11.value, cardindex + (loc_base.value >> 4))


More information about the pypy-commit mailing list