[pypy-commit] pypy jitframe-on-heap: update cond_call_gc_wb and wb_slowpath

bivab noreply at buildbot.pypy.org
Tue Feb 26 11:55:32 CET 2013


Author: David Schneider <david.schneider at picle.org>
Branch: jitframe-on-heap
Changeset: r61817:9dd6acf62511
Date: 2013-02-26 11:54 +0100
http://bitbucket.org/pypy/pypy/changeset/9dd6acf62511/

Log:	update cond_call_gc_wb and wb_slowpath

diff --git a/rpython/jit/backend/arm/assembler.py b/rpython/jit/backend/arm/assembler.py
--- a/rpython/jit/backend/arm/assembler.py
+++ b/rpython/jit/backend/arm/assembler.py
@@ -327,6 +327,14 @@
             self._store_and_reset_exception(mc, exc0, exc1)
         mc.BL(func)
         #
+        if not for_frame:
+            self._pop_all_regs_from_jitframe(mc, [], withfloats, callee_only=True)
+        else:
+            self._restore_exception(mc, exc0, exc1)
+            mc.VPOP([vfpr.value for vfpr in r.caller_vfp_resp])
+            mc.POP([gpr.value for gpr in r.caller_resp] +
+                            [exc0.value, exc1.value])
+        #
         if withcards:
             # A final TEST8 before the RET, for the caller.  Careful to
             # not follow this instruction with another one that changes
@@ -335,13 +343,6 @@
                                     imm=descr.jit_wb_if_flag_byteofs)
             mc.TST_ri(r.ip.value, imm=0x80)
         #
-        if not for_frame:
-            self._pop_all_regs_from_jitframe(mc, [], withfloats, callee_only=True)
-        else:
-            self._restore_exception(mc, exc0, exc1)
-            mc.VPOP([vfpr.value for vfpr in r.caller_vfp_resp])
-            mc.POP([gpr.value for gpr in r.caller_resp] +
-                            [exc0.value, exc1.value])
         mc.POP([r.ip.value, r.pc.value])
         #
         rawstart = mc.materialize(self.cpu.asmmemmgr, [])
diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py
--- a/rpython/jit/backend/arm/opassembler.py
+++ b/rpython/jit/backend/arm/opassembler.py
@@ -547,19 +547,25 @@
     emit_op_keepalive = emit_op_debug_merge_point
 
     def emit_op_cond_call_gc_wb(self, op, arglocs, regalloc, fcond):
+        self._write_barrier_fastpath(self.mc, op.getdescr(), arglocs, fcond)
+
+    def emit_op_cond_call_gc_wb_array(self, op, arglocs, regalloc, fcond):
+        self._write_barrier_fastpath(self.mc, op.getdescr(), arglocs,
+                                                        fcond, array=True)
+
+    def _write_barrier_fastpath(self, mc, descr, arglocs, fcond, array=False,
+                                                            is_frame=False):
         # Write code equivalent to write_barrier() in the GC: it checks
         # a flag in the object at arglocs[0], and if set, it calls a
         # helper piece of assembler.  The latter saves registers as needed
         # and call the function jit_remember_young_pointer() from the GC.
-        descr = op.getdescr()
         if we_are_translated():
             cls = self.cpu.gc_ll_descr.has_write_barrier_class()
             assert cls is not None and isinstance(descr, cls)
         #
-        opnum = op.getopnum()
         card_marking = False
         mask = descr.jit_wb_if_flag_singlebyte
-        if opnum == rop.COND_CALL_GC_WB_ARRAY and descr.jit_wb_cards_set != 0:
+        if array and descr.jit_wb_cards_set != 0:
             # assumptions the rest of the function depends on:
             assert (descr.jit_wb_cards_set_byteofs ==
                     descr.jit_wb_if_flag_byteofs)
@@ -568,11 +574,13 @@
             mask = descr.jit_wb_if_flag_singlebyte | -0x80
         #
         loc_base = arglocs[0]
-        self.mc.LDRB_ri(r.ip.value, loc_base.value,
-                                    imm=descr.jit_wb_if_flag_byteofs)
+        if is_frame:
+            assert loc_base is r.fp
+        else:
+            self.mc.LDRB_ri(r.ip.value, loc_base.value,
+                                        imm=descr.jit_wb_if_flag_byteofs)
         mask &= 0xFF
         self.mc.TST_ri(r.ip.value, imm=mask)
-
         jz_location = self.mc.currpos()
         self.mc.BKPT()
 
@@ -658,8 +666,6 @@
         pmc.B_offs(offset, c.EQ)
         return fcond
 
-    emit_op_cond_call_gc_wb_array = emit_op_cond_call_gc_wb
-
     def emit_op_setfield_gc(self, op, arglocs, regalloc, fcond):
         value_loc, base_loc, ofs, size = arglocs
         if size.value == 8:


More information about the pypy-commit mailing list