max stack depth calculation

Neil Schemenauer <[email protected]> Sun, 28 Mar 2004 21:57:49 -0500
Newsgroups gmane.comp.python.compiler
Message-ID <[email protected]>
The stack depth calculation that I checked in for the AST compiler
could end up being fairly expensive.  It tries to find control paths
that give the highest entry stack depth for each basic block.  Once
you know the entry stack depths, you can examine each block and find
the one that uses the largest stack.

I had a thought today on how to make the calculation more efficient.
Could we assume that the entry stack depth for each basic block is
the same, regardless of the control path taken?

I've tried changing the calculation to make use of that assumption.
It does sometimes end up with a smaller stack than the old
calculation.  However, I haven't found a case were it leads to a
stack overflow.

  Neil