本文整理匯總了Python中pypy.jit.metainterp.resoperation.ResOperation.setfailargs方法的典型用法代碼示例。如果您正苦於以下問題:Python ResOperation.setfailargs方法的具體用法?Python ResOperation.setfailargs怎麽用?Python ResOperation.setfailargs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pypy.jit.metainterp.resoperation.ResOperation
的用法示例。
在下文中一共展示了ResOperation.setfailargs方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: store_final_boxes_in_guard
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import setfailargs [as 別名]
def store_final_boxes_in_guard(self, op):
descr = op.getdescr()
assert isinstance(descr, compile.ResumeGuardDescr)
modifier = resume.ResumeDataVirtualAdder(descr, self.resumedata_memo)
newboxes = modifier.finish(self.values, self.pendingfields)
if len(newboxes) > self.metainterp_sd.options.failargs_limit: # XXX be careful here
compile.giveup()
descr.store_final_boxes(op, newboxes)
#
if op.getopnum() == rop.GUARD_VALUE:
if self.getvalue(op.getarg(0)) in self.bool_boxes:
# Hack: turn guard_value(bool) into guard_true/guard_false.
# This is done after the operation is emitted to let
# store_final_boxes_in_guard set the guard_opnum field of the
# descr to the original rop.GUARD_VALUE.
constvalue = op.getarg(1).getint()
if constvalue == 0:
opnum = rop.GUARD_FALSE
elif constvalue == 1:
opnum = rop.GUARD_TRUE
else:
raise AssertionError("uh?")
newop = ResOperation(opnum, [op.getarg(0)], op.result, descr)
newop.setfailargs(op.getfailargs())
return newop
else:
# a real GUARD_VALUE. Make it use one counter per value.
descr.make_a_counter_per_value(op)
return op
示例2: exc_handling
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import setfailargs [as 別名]
def exc_handling(guard_op):
# operations need to start with correct GUARD_EXCEPTION
if guard_op._exc_box is None:
op = ResOperation(rop.GUARD_NO_EXCEPTION, [], None)
else:
op = ResOperation(rop.GUARD_EXCEPTION, [guard_op._exc_box], BoxPtr())
op.setdescr(BasicFailDescr())
op.setfailargs([])
return op
示例3: produce_into
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import setfailargs [as 別名]
def produce_into(self, builder, r):
fail_subset = builder.subset_of_intvars(r)
subset, f, exc = self.raising_func_code(builder, r)
TP = lltype.FuncType([lltype.Signed] * len(subset), lltype.Void)
ptr = llhelper(lltype.Ptr(TP), f)
c_addr = ConstAddr(llmemory.cast_ptr_to_adr(ptr), builder.cpu)
args = [c_addr] + subset
descr = builder.cpu.calldescrof(TP, TP.ARGS, TP.RESULT)
self.put(builder, args, descr)
exc_box = ConstAddr(llmemory.cast_ptr_to_adr(exc), builder.cpu)
op = ResOperation(rop.GUARD_EXCEPTION, [exc_box], BoxPtr(),
descr=BasicFailDescr())
op.setfailargs(fail_subset)
builder.loop.operations.append(op)
示例4: produce_into
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import setfailargs [as 別名]
def produce_into(self, builder, r):
subset, f, exc = self.raising_func_code(builder, r)
TP = lltype.FuncType([lltype.Signed] * len(subset), lltype.Void)
ptr = llhelper(lltype.Ptr(TP), f)
c_addr = ConstAddr(llmemory.cast_ptr_to_adr(ptr), builder.cpu)
args = [c_addr] + subset
descr = self.getcalldescr(builder, TP)
self.put(builder, args, descr)
op = ResOperation(rop.GUARD_NO_EXCEPTION, [], BoxPtr(),
descr=BasicFailDescr())
op._exc_box = ConstAddr(llmemory.cast_ptr_to_adr(exc), builder.cpu)
op.setfailargs(builder.subset_of_intvars(r))
builder.should_fail_by = op
builder.guard_op = op
builder.loop.operations.append(op)
示例5: produce_into
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import setfailargs [as 別名]
def produce_into(self, builder, r):
fail_subset = builder.subset_of_intvars(r)
original_intvars = builder.intvars[:]
super(AbstractOvfOperation, self).produce_into(builder, r)
if builder.fakemetainterp._got_exc: # overflow detected
assert isinstance(builder.fakemetainterp._got_exc, OverflowError)
op = ResOperation(rop.GUARD_OVERFLOW, [], None)
# the overflowed result should not be used any more, but can
# be used on the failure path: recompute fail_subset including
# the result, and then remove it from builder.intvars.
fail_subset = builder.subset_of_intvars(r)
builder.intvars[:] = original_intvars
else:
op = ResOperation(rop.GUARD_NO_OVERFLOW, [], None)
op.setdescr(BasicFailDescr())
op.setfailargs(fail_subset)
builder.loop.operations.append(op)