]> granicus.if.org Git - python/commit
Vastly improved stacksize calculation.
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 17 Oct 2001 13:37:29 +0000 (13:37 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 17 Oct 2001 13:37:29 +0000 (13:37 +0000)
commit138d90eb73415e48a0e7f09a7c9603b1164bcaed
treeb631166b29128e07e71b263e145634a6870c47a8
parentd114261608f986b5c797eef4330fbe32041d3eb6
Vastly improved stacksize calculation.

There are now no known cases where the compiler package computes a
stack depth lower than the one computed by the builtin compiler.  (To
achieve this state, we had to fix bugs in both compilers :-).

The chief change is to do the depth calculations with respect to basic
blocks.  The stack effect of block is calculated.  Then the flow graph
is traversed using breadth-first search to find the max weight path
through the graph.

Had to fix the StackDepthTracker to calculate the right info for
several opcodes: LOAD_ATTR, CALL_FUNCTION (and friends), MAKE_CLOSURE,
and DUP_TOPX.

XXX Still need to handle free variables in MAKE_CLOSURE.

XXX There are still a lot of places where the computed stack depth is
larger than for the builtin compiler.  These won't cause the
interpreter to overflow the frame, but they waste space.
Lib/compiler/pyassem.py