[pypy-svn] r23152 - pypy/dist/pypy/translator
ac at codespeak.net
ac at codespeak.net
Wed Feb 8 18:37:18 CET 2006
Author: ac
Date: Wed Feb 8 18:37:17 2006
New Revision: 23152
Modified:
pypy/dist/pypy/translator/transform.py
Log:
Make it possible to force stack_check() at the begining of functions.
Modified: pypy/dist/pypy/translator/transform.py
==============================================================================
--- pypy/dist/pypy/translator/transform.py (original)
+++ pypy/dist/pypy/translator/transform.py Wed Feb 8 18:37:17 2006
@@ -146,10 +146,21 @@
def insert_stackcheck(ann):
from pypy.tool.algo.graphlib import Edge, make_edge_dict, break_cycles
edges = []
+ graphs_to_patch = {}
for callposition, (caller, callee) in ann.translator.callgraph.items():
+ if getattr(getattr(callee, 'func', None), 'insert_stack_check_here', False):
+ graphs_to_patch[callee] = True
+ continue
edge = Edge(caller, callee)
edge.callposition = callposition
edges.append(edge)
+
+ for graph in graphs_to_patch:
+ v = Variable()
+ ann.setbinding(v, annmodel.SomeImpossibleValue())
+ unwind_op = SpaceOperation('simple_call', [Constant(stack_check)], v)
+ graph.startblock.operations.insert(0, unwind_op)
+
edgedict = make_edge_dict(edges)
for edge in break_cycles(edgedict, edgedict):
caller = edge.source
More information about the Pypy-commit
mailing list