Commits

Remi Meier  committed 1b01693

add new llops to funcgen and change code generation in assembler

  • Participants
  • Parent commits b18d1e3
  • Branches stmgc-c4

Comments (0)

Files changed (7)

File pypy/interpreter/pyopcode.py

                         self=self, co_code=co_code,
                         next_instr=next_instr, ec=ec)
                     # nothing inbetween!
-                    if rstm.jit_should_break_transaction(False):
+                    if rstm.jit_stm_should_break_transaction(False):
                         rstm.jit_stm_transaction_break_point()
                     self = self._hints_for_stm()
                 next_instr = self.handle_bytecode(co_code, next_instr, ec)

File pypy/module/pypyjit/interp_jit.py

                     frame=self, next_instr=next_instr, pycode=pycode,
                     is_being_profiled=is_being_profiled)
                 # nothing inbetween!
-                if rstm.jit_should_break_transaction(False):
+                if rstm.jit_stm_should_break_transaction(False):
                     rstm.jit_stm_transaction_break_point()
                 co_code = pycode.co_code
                 self.valuestackdepth = hint(self.valuestackdepth, promote=True)
             self.last_instr = intmask(jumpto)
             ec.bytecode_trace(self, decr_by)
             jumpto = r_uint(self.last_instr)
-            if rstm.jit_should_break_transaction(True):
+            if rstm.jit_stm_should_break_transaction(True):
                 rstm.jit_stm_transaction_break_point()
         #
         pypyjitdriver.can_enter_jit(frame=self, ec=ec, next_instr=jumpto,

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

             return     # tests only
 
         mc = self.mc
-        # if stm_should_break_transaction()
-        fn = stmtlocal.stm_should_break_transaction_fn
-        mc.CALL(imm(self.cpu.cast_ptr_to_int(fn)))
-        mc.TEST8(eax.lowest8bits(), eax.lowest8bits())
-        mc.J_il(rx86.Conditions['Z'], 0xfffff)    # patched later
-        jz_location2 = mc.get_relative_pos()
         #
         # call stm_transaction_break() with the address of the
         # STM_RESUME_BUF and the custom longjmp function
         self.push_gcmap(mc, gcmap, mov=True)
         #
-        # save all registers
-        base_ofs = self.cpu.get_baseofs_of_frame_field()
-        for gpr in self._regalloc.rm.reg_bindings.values():
-            v = gpr_reg_mgr_cls.all_reg_indexes[gpr.value]
-            mc.MOV_br(v * WORD + base_ofs, gpr.value)
-        if IS_X86_64:
-            coeff = 1
-        else:
-            coeff = 2
-        ofs = len(gpr_reg_mgr_cls.all_regs)
-        for xr in self._regalloc.xrm.reg_bindings.values():
-            mc.MOVSD_bx((ofs + xr.value * coeff) * WORD + base_ofs, xr.value)
-        #
         # CALL break function
         fn = self.stm_transaction_break_path
         mc.CALL(imm(fn))
         # ** HERE ** is the place an aborted transaction retries
         # ebp/frame reloaded by longjmp callback
         #
-        # restore regs
-        base_ofs = self.cpu.get_baseofs_of_frame_field()
-        for gpr in self._regalloc.rm.reg_bindings.values():
-            v = gpr_reg_mgr_cls.all_reg_indexes[gpr.value]
-            mc.MOV_rb(gpr.value, v * WORD + base_ofs)
-        if IS_X86_64:
-            coeff = 1
-        else:
-            coeff = 2
-        ofs = len(gpr_reg_mgr_cls.all_regs)
-        for xr in self._regalloc.xrm.reg_bindings.values():
-            mc.MOVSD_xb(xr.value, (ofs + xr.value * coeff) * WORD + base_ofs)
-        #
-        # patch the JZ above
-        offset = mc.get_relative_pos() - jz_location2
-        mc.overwrite32(jz_location2-4, offset)
+
 
 
 

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

     def consider_stm_transaction_break(self, op):
         #
         # only save regs for the should_break_transaction call
-        self.xrm.before_call()
-        self.rm.before_call()
+        self.xrm.before_call(save_all_regs=1)
+        self.rm.before_call(save_all_regs=1)
         gcmap = self.get_gcmap() # allocate the gcmap *before*
         #
         self.assembler.stm_transaction_break(gcmap)

File rpython/jit/tl/tlc.py

                 myjitdriver.jit_merge_point(frame=frame,
                                             code=code, pc=pc, pool=pool)
                 # nothing inbetween!
-                if rstm.jit_should_break_transaction(False):
+                if rstm.jit_stm_should_break_transaction(False):
                     rstm.jit_stm_transaction_break_point()
             opcode = ord(code[pc])
             pc += 1
                 pc += char2int(code[pc])
                 pc += 1
                 if jitted and old_pc > pc:
-                    if rstm.jit_should_break_transaction(True):
+                    if rstm.jit_stm_should_break_transaction(True):
                         rstm.jit_stm_transaction_break_point()
                     myjitdriver.can_enter_jit(code=code, pc=pc, frame=frame,
                                               pool=pool)
                     old_pc = pc
                     pc += char2int(code[pc]) + 1
                     if jitted and old_pc > pc:
-                        if rstm.jit_should_break_transaction(True):
+                        if rstm.jit_stm_should_break_transaction(True):
                             rstm.jit_stm_transaction_break_point()
                         myjitdriver.can_enter_jit(code=code, pc=pc, frame=frame,
                                                   pool=pool)
                     old_pc = pc
                     pc += offset
                     if jitted and old_pc > pc:
-                        if rstm.jit_should_break_transaction(True):
+                        if rstm.jit_stm_should_break_transaction(True):
                             rstm.jit_stm_transaction_break_point()
                         myjitdriver.can_enter_jit(code=code, pc=pc, frame=frame,
                                                   pool=pool)

File rpython/translator/c/funcgen.py

     OP_STM_CLEAR_EXCEPTION_DATA_ON_ABORT= _OP_STM
     OP_STM_ALLOCATE_NONMOVABLE_INT_ADR  = _OP_STM
     OP_JIT_STM_TRANSACTION_BREAK_POINT  = _OP_STM
+    OP_JIT_STM_SHOULD_BREAK_TRANSACTION = _OP_STM
 
     def OP_STM_IGNORED_START(self, op):
         return '/* stm_ignored_start */'

File rpython/translator/stm/funcgen.py

 
 def jit_stm_transaction_break_point(funcgen, op):
     return '/* jit_stm_transaction_break_point */'
+
+def jit_stm_should_break_transaction(funcgen, op):
+    result = funcgen.expr(op.result)
+    return '%s = 0; /* jit_stm_should_break_transaction */' % (result, )
     
 def stm_finalize(funcgen, op):
     return 'stm_finalize();'