提交 d1e06e3a authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Merge pull request #806 from lamblin/fix_n_calls

Make new VM_Linker with same options as the old one
......@@ -32,7 +32,7 @@ class T_bunch_of_modes(unittest.TestCase):
# test that it runs something
f([[1, 2], [3, 4]], [5, 6])
linker_classes_involved.append(f.maker.mode.linker.__class__)
# print 'MODE:', mode, f.maker.mode.linker, 'stop'
#print 'MODE:', mode, f.maker.mode.linker, 'stop'
# regression check:
# there should be
# - VM_Linker
......
......@@ -527,6 +527,8 @@ class VM_Linker(link.LocalLinker):
between Loop/LoopGC and Stack.
"""
# Note: if more parameters are added to __init__, make sure to forward
# them in the "type(self)(...)" call in the "accept" method below.
if allow_gc is None:
allow_gc = config.allow_gc
self.fgraph = None
......@@ -543,12 +545,21 @@ class VM_Linker(link.LocalLinker):
:param no_recycling: WRITEME
:returns: self (TODO: WHY? Who calls this function?)
:returns: self if fgraph is the first FunctionGraph that has ever been
associated to self, else, a new VM_Linker associated to fgraph.
"""
if no_recycling is None:
no_recycling = []
if self.fgraph is not None and self.fgraph is not fgraph:
return type(self)().accept(fgraph, no_recycling)
# Build a new VM_Linker, and call accept on that one.
# Warning: make sure to forward the correct values of
# all parameters to __init__ here.
return type(self)(
allow_gc=self.allow_gc,
use_cloop=self.use_cloop,
callback=self.callback,
lazy=self.lazy
).accept(fgraph, no_recycling)
self.fgraph = fgraph
self.no_recycling = no_recycling
return self
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论