本文整理匯總了Python中rpython.rtyper.annlowlevel.MixLevelHelperAnnotator.finish_rtype方法的典型用法代碼示例。如果您正苦於以下問題:Python MixLevelHelperAnnotator.finish_rtype方法的具體用法?Python MixLevelHelperAnnotator.finish_rtype怎麽用?Python MixLevelHelperAnnotator.finish_rtype使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rpython.rtyper.annlowlevel.MixLevelHelperAnnotator
的用法示例。
在下文中一共展示了MixLevelHelperAnnotator.finish_rtype方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: BaseGCTransformer
# 需要導入模塊: from rpython.rtyper.annlowlevel import MixLevelHelperAnnotator [as 別名]
# 或者: from rpython.rtyper.annlowlevel.MixLevelHelperAnnotator import finish_rtype [as 別名]
#.........這裏部分代碼省略.........
self.links_to_split = None
v = Variable('vanishing_exc_value')
v.concretetype = self.get_lltype_of_exception_value()
llops = LowLevelOpList()
self.pop_alive(v, llops)
graph.exc_cleanup = (v, list(llops))
return is_borrowed # xxx for tests only
def annotate_helper(self, ll_helper, ll_args, ll_result, inline=False):
assert not self.finished_helpers
args_s = map(lltype_to_annotation, ll_args)
s_result = lltype_to_annotation(ll_result)
graph = self.mixlevelannotator.getgraph(ll_helper, args_s, s_result)
# the produced graphs does not need to be fully transformed
self.need_minimal_transform(graph)
if inline:
self.graphs_to_inline[graph] = True
FUNCTYPE = lltype.FuncType(ll_args, ll_result)
return self.mixlevelannotator.graph2delayed(graph, FUNCTYPE=FUNCTYPE)
def inittime_helper(self, ll_helper, ll_args, ll_result, inline=True):
ptr = self.annotate_helper(ll_helper, ll_args, ll_result, inline=inline)
return Constant(ptr, lltype.typeOf(ptr))
def annotate_finalizer(self, ll_finalizer, ll_args, ll_result):
fptr = self.annotate_helper(ll_finalizer, ll_args, ll_result)
self.ll_finalizers_ptrs.append(fptr)
return fptr
def finish_helpers(self, backendopt=True):
if self.translator is not None:
self.mixlevelannotator.finish_annotate()
if self.translator is not None:
self.mixlevelannotator.finish_rtype()
if backendopt:
self.mixlevelannotator.backend_optimize()
self.finished_helpers = True
# Make sure that the database also sees all finalizers now.
# It is likely that the finalizers need special support there
newgcdependencies = self.ll_finalizers_ptrs
return newgcdependencies
def get_finish_helpers(self):
return self.finish_helpers
def finish_tables(self):
pass
def get_finish_tables(self):
return self.finish_tables
def finish(self, backendopt=True):
self.finish_helpers(backendopt=backendopt)
self.finish_tables()
def transform_generic_set(self, hop):
opname = hop.spaceop.opname
v_new = hop.spaceop.args[-1]
v_old = hop.genop('g' + opname[1:],
hop.inputargs()[:-1],
resulttype=v_new.concretetype)
self.push_alive(v_new, hop.llops)
hop.rename('bare_' + opname)
self.pop_alive(v_old, hop.llops)
def push_alive(self, var, llops):