本文整理匯總了Python中pypy.jit.metainterp.resoperation.ResOperation._exc_box方法的典型用法代碼示例。如果您正苦於以下問題:Python ResOperation._exc_box方法的具體用法?Python ResOperation._exc_box怎麽用?Python ResOperation._exc_box使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pypy.jit.metainterp.resoperation.ResOperation
的用法示例。
在下文中一共展示了ResOperation._exc_box方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: produce_into
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import _exc_box [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 = builder.cpu.calldescrof(TP, TP.ARGS, TP.RESULT)
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)
示例2: produce_into
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import _exc_box [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)
while True:
_, vtableptr = builder.get_random_structure_type_and_vtable(r)
if vtableptr != exc:
break
other_box = ConstAddr(llmemory.cast_ptr_to_adr(vtableptr), builder.cpu)
op = ResOperation(rop.GUARD_EXCEPTION, [other_box], 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)
示例3: produce_into
# 需要導入模塊: from pypy.jit.metainterp.resoperation import ResOperation [as 別名]
# 或者: from pypy.jit.metainterp.resoperation.ResOperation import _exc_box [as 別名]
def produce_into(self, builder, r):
subset, f = self.non_raising_func_code(builder, r)
if len(subset) == 0:
RES = lltype.Void
else:
RES = lltype.Signed
TP = lltype.FuncType([lltype.Signed] * len(subset), RES)
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)
_, vtableptr = builder.get_random_structure_type_and_vtable(r)
exc_box = ConstAddr(llmemory.cast_ptr_to_adr(vtableptr), builder.cpu)
op = ResOperation(rop.GUARD_EXCEPTION, [exc_box], BoxPtr(),
descr=BasicFailDescr())
op.fail_args = builder.subset_of_intvars(r)
op._exc_box = None
builder.should_fail_by = op
builder.guard_op = op
builder.loop.operations.append(op)