コード例 #1
0
ファイル: optimizer.py プロジェクト: zcxowwww/pypy
 def is_call_pure_pure_canraise(self, op):
     if not rop.is_call_pure(op.getopnum()):
         return False
     effectinfo = op.getdescr().get_extra_info()
     if effectinfo.check_can_raise(ignore_memoryerror=True):
         return True
     return False
コード例 #2
0
ファイル: optimizer.py プロジェクト: mozillazg/pypy
 def is_call_pure_pure_canraise(self, op):
     if not rop.is_call_pure(op.getopnum()):
         return False
     effectinfo = op.getdescr().get_extra_info()
     if effectinfo.check_can_raise(ignore_memoryerror=True):
         return True
     return False
コード例 #3
0
ファイル: optimizer.py プロジェクト: Mu-L/pypy
 def _emit_operation(self, op):
     assert not rop.is_call_pure(op.getopnum())
     orig_op = op
     op = self.get_box_replacement(op)
     if op.is_constant():
         return  # can happen e.g. if we postpone the operation that becomes
         # constant
     # XXX kill, requires thinking
     #op = self.replace_op_with(op, op.opnum)
     for i in range(op.numargs()):
         arg = self.force_box(op.getarg(i))
         op.setarg(i, arg)
     self.metainterp_sd.profiler.count(jitprof.Counters.OPT_OPS)
     if rop.is_guard(op.opnum):
         assert isinstance(op, GuardResOp)
         self.metainterp_sd.profiler.count(jitprof.Counters.OPT_GUARDS)
         pendingfields = self.pendingfields
         self.pendingfields = None
         if self.replaces_guard and orig_op in self.replaces_guard:
             self.replace_guard_op(self.replaces_guard[orig_op], op)
             del self.replaces_guard[orig_op]
             return
         else:
             op = self.emit_guard_operation(op, pendingfields)
     opnum = op.opnum
     if ((rop.has_no_side_effect(opnum) or rop.is_guard(opnum)
          or rop.is_jit_debug(opnum) or rop.is_ovf(opnum))
             and not self.is_call_pure_pure_canraise(op)):
         pass
     else:
         self._last_guard_op = None
     self._really_emitted_operation = op
     self._newoperations.append(op)
     self._emittedoperations[op] = None
コード例 #4
0
ファイル: optimizer.py プロジェクト: mozillazg/pypy
 def _emit_operation(self, op):
     assert not rop.is_call_pure(op.getopnum())
     orig_op = op
     op = self.get_box_replacement(op)
     if op.is_constant():
         return # can happen e.g. if we postpone the operation that becomes
         # constant
     # XXX kill, requires thinking
     #op = self.replace_op_with(op, op.opnum)
     for i in range(op.numargs()):
         arg = self.force_box(op.getarg(i))
         op.setarg(i, arg)
     self.metainterp_sd.profiler.count(jitprof.Counters.OPT_OPS)
     if rop.is_guard(op.opnum):
         assert isinstance(op, GuardResOp)
         self.metainterp_sd.profiler.count(jitprof.Counters.OPT_GUARDS)
         pendingfields = self.pendingfields
         self.pendingfields = None
         if self.replaces_guard and orig_op in self.replaces_guard:
             self.replace_guard_op(self.replaces_guard[orig_op], op)
             del self.replaces_guard[orig_op]
             return
         else:
             op = self.emit_guard_operation(op, pendingfields)
     elif op.can_raise():
         self.exception_might_have_happened = True
     opnum = op.opnum
     if ((rop.has_no_side_effect(opnum) or rop.is_guard(opnum) or
          rop.is_jit_debug(opnum) or
          rop.is_ovf(opnum)) and not self.is_call_pure_pure_canraise(op)):
         pass
     else:
         self._last_guard_op = None
     self._really_emitted_operation = op
     self._newoperations.append(op)