Commits

Remi Meier  committed 79f9863

connect guard_not_forced with stm_transaction_break in regalloc/assembler

  • Participants
  • Parent commits 8a7060e
  • Branches stmgc-c4

Comments (0)

Files changed (4)

File rpython/jit/backend/llsupport/regalloc.py

     def can_merge_with_next_guard(self, op, i, operations):
         if (op.getopnum() == rop.CALL_MAY_FORCE or
             op.getopnum() == rop.CALL_ASSEMBLER or
-            op.getopnum() == rop.CALL_RELEASE_GIL):
+            op.getopnum() == rop.CALL_RELEASE_GIL or
+            op.getopnum() == rop.STM_TRANSACTION_BREAK):
             assert operations[i + 1].getopnum() == rop.GUARD_NOT_FORCED
             return True
         if not op.is_comparison():

File rpython/jit/backend/x86/assembler.py

         dest_addr = AddressLoc(base_loc, ofs_loc)
         mc.MOV(dest_addr, X86_64_SCRATCH_REG)
 
-        
-    def stm_transaction_break(self, gcmap):
+    def genop_guard_stm_transaction_break(self, op, guard_op, guard_token,
+                                          arglocs, result_loc):
         assert self.cpu.gc_ll_descr.stm
         if not we_are_translated():
             return     # tests only
 
+        gcmap = self._regalloc.get_gcmap()
+        self._store_force_index(guard_op)
+
         mc = self.mc
         # if stm_should_break_transaction()
         fn = stmtlocal.stm_should_break_transaction_fn
         offset = mc.get_relative_pos() - jz_location2
         mc.overwrite32(jz_location2-4, offset)
 
+        self._emit_guard_not_forced(guard_token)
+
 
 
 

File rpython/jit/backend/x86/regalloc.py

         base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args)
         self.perform_discard(op, [base_loc, ofs_loc, size_loc])
         
-    def consider_stm_transaction_break(self, op):
+    def consider_stm_transaction_break(self, op, guard_op):
         #
         # only save regs for the should_break_transaction call
         self.xrm.before_call()
         self.rm.before_call()
-        gcmap = self.get_gcmap() # allocate the gcmap *before*
         #
-        self.assembler.stm_transaction_break(gcmap)
+        self.perform_with_guard(op, guard_op, [], None)
         
 
     def consider_jump(self, op):
         if (is_comparison_or_ovf_op(num)
             or num == rop.CALL_MAY_FORCE
             or num == rop.CALL_ASSEMBLER
-            or num == rop.CALL_RELEASE_GIL):
+            or num == rop.CALL_RELEASE_GIL
+            or num == rop.STM_TRANSACTION_BREAK):
             oplist_with_guard[num] = value
             oplist[num] = add_none_argument(value)
         else:

File rpython/jit/metainterp/optimizeopt/stm.py

         dispatch_opt(self, op)
 
     def _break_wanted(self):
-        return self.optimizer.stm_info.get('break_wanted', True)
+        is_loop = self.optimizer.loop.operations[0].getopnum() == rop.LABEL
+        return self.optimizer.stm_info.get('break_wanted', is_loop)
     
     def _set_break_wanted(self, val):
         self.optimizer.stm_info['break_wanted'] = val