[pypy-commit] pypy arm-backend-2: make sure we are only checking one byte in the cond cond_call_* operations

bivab noreply at buildbot.pypy.org
Tue Feb 28 12:05:59 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r52960:d47de5e0115f
Date: 2012-02-28 11:04 +0000
http://bitbucket.org/pypy/pypy/changeset/d47de5e0115f/

Log:	make sure we are only checking one byte in the cond cond_call_*
	operations

diff --git a/pypy/jit/backend/arm/opassembler.py b/pypy/jit/backend/arm/opassembler.py
--- a/pypy/jit/backend/arm/opassembler.py
+++ b/pypy/jit/backend/arm/opassembler.py
@@ -16,6 +16,7 @@
                                                 gen_emit_unary_float_op,
                                                 saved_registers,
                                                 count_reg_args)
+from pypy.jit.backend.arm.helper.regalloc import check_imm_arg
 from pypy.jit.backend.arm.codebuilder import ARMv7Builder, OverwritingBuilder
 from pypy.jit.backend.arm.jump import remap_frame_layout
 from pypy.jit.backend.arm.regalloc import TempInt, TempPtr
@@ -534,16 +535,10 @@
         else:
             raise AssertionError(opnum)
         loc_base = arglocs[0]
-        self.mc.LDR_ri(r.ip.value, loc_base.value)
-        # calculate the shift value to rotate the ofs according to the ARM
-        # shifted imm values
-        # (4 - 0) * 4 & 0xF = 0
-        # (4 - 1) * 4 & 0xF = 12
-        # (4 - 2) * 4 & 0xF = 8
-        # (4 - 3) * 4 & 0xF = 4
-        ofs = (((4 - descr.jit_wb_if_flag_byteofs) * 4) & 0xF) << 8
-        ofs |= descr.jit_wb_if_flag_singlebyte
-        self.mc.TST_ri(r.ip.value, imm=ofs)
+        assert check_imm_arg(descr.jit_wb_if_flag_byteofs)
+        assert check_imm_arg(descr.jit_wb_if_flag_singlebyte)
+        self.mc.LDRB_ri(r.ip.value, loc_base.value, imm=descr.jit_wb_if_flag_byteofs)
+        self.mc.TST_ri(r.ip.value, imm=descr.jit_wb_if_flag_singlebyte)
 
         jz_location = self.mc.currpos()
         self.mc.BKPT()
@@ -551,11 +546,10 @@
         # for cond_call_gc_wb_array, also add another fast path:
         # if GCFLAG_CARDS_SET, then we can just set one bit and be done
         if card_marking:
-            # calculate the shift value to rotate the ofs according to the ARM
-            # shifted imm values
-            ofs = (((4 - descr.jit_wb_cards_set_byteofs) * 4) & 0xF) << 8
-            ofs |= descr.jit_wb_cards_set_singlebyte
-            self.mc.TST_ri(r.ip.value, imm=ofs)
+            assert check_imm_arg(descr.jit_wb_cards_set_byteofs)
+            assert check_imm_arg(descr.jit_wb_cards_set_singlebyte)
+            self.mc.LDRB_ri(r.ip.value, loc_base.value, imm=descr.jit_wb_cards_set_byteofs)
+            self.mc.TST_ri(r.ip.value, imm=descr.jit_wb_cards_set_singlebyte)
             #
             jnz_location = self.mc.currpos()
             self.mc.BKPT()


More information about the pypy-commit mailing list