[pypy-commit] pypy guard-compatible: Kill an unnecessary ADD

arigo pypy.commits at gmail.com
Tue May 24 14:51:08 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: guard-compatible
Changeset: r84664:a9f396fa0c0d
Date: 2016-05-24 20:51 +0200
http://bitbucket.org/pypy/pypy/changeset/a9f396fa0c0d/

Log:	Kill an unnecessary ADD

diff --git a/rpython/jit/backend/x86/guard_compat.py b/rpython/jit/backend/x86/guard_compat.py
--- a/rpython/jit/backend/x86/guard_compat.py
+++ b/rpython/jit/backend/x86/guard_compat.py
@@ -195,7 +195,9 @@
     ofs2 = _real_number(BCLIST + BCLISTITEMSOFS)
     mc.MOV_sr(2*WORD, rdx)                  # MOV [RSP+16], RDX
     mc.MOV_rm(r11, (rdx, ofs1))             # MOV R11, [RDX + bc_list.length]
-    mc.ADD_ri(rdx, ofs2)                    # ADD RDX, $bc_list.items
+    # in the sequel, "RDX + bc_list.items" is a pointer to the leftmost
+    # array item of the range still under consideration.  The length of
+    # this range is R11, which is always a power-of-two-minus-1.
     mc.JMP_l8(0)                            # JMP loop
     jmp_location = mc.get_relative_pos()
     mc.force_frame_size(frame_size)
@@ -210,11 +212,12 @@
     jz_location = mc.get_relative_pos()
 
     _fix_forward_label(mc, jmp_location)    # loop:
-    mc.CMP_ra(rax, (rdx, r11, SH, -WORD))   # CMP RAX, [RDX + 8*R11 - 8]
+    mc.CMP_ra(rax, (rdx, r11, SH, ofs2-WORD))
+                                            # CMP RAX, [RDX + items + 8*R11 - 8]
     mc.J_il8(rx86.Conditions['A'], right_label - (mc.get_relative_pos() + 2))
     mc.J_il8(rx86.Conditions['NE'], left_label - (mc.get_relative_pos() + 2))
 
-    mc.MOV_ra(r11, (rdx, r11, SH, 0))       # MOV R11, [RDX + 8*R11]
+    mc.MOV_ra(r11, (rdx, r11, SH, ofs2))    # MOV R11, [RDX + items + 8*R11]
     mc.MOV_rs(rdx, 2*WORD)                  # MOV RDX, [RSP+16]
     ofs = _real_number(BCMOSTRECENT)
     mc.MOV_mr((rdx, ofs), rax)              # MOV [RDX+bc_most_recent], RAX


More information about the pypy-commit mailing list