Humm, I think I am missing some of the mechanics; there' no
MBasicBlock::nstack_, right? I just see the slot count that comes from the
CompileInfo, which is set once for the entire compilation unit.
Also we don't know the precise
nstack value eagerly, as there is an N-to-1 relationship between
MBasicBlock and wasm blocks; a
br_if ends an
MBasicBlock, pushing defs corresponding to the branch target, not the current block result type.
So in general, in the current one-pass compiler, we know the maximum number of possible results (
nmax) for the current block at any point: it's initially the number of return values of the function; when entering a block, it becomes
nmax = max(nmax, block.results().length()); additionally when entering loops, it becomes
nmax = max(nmax, block.params.length()). But we don't know
nmax for the function as a whole in advance, nor do we know
nresults for any given
MBasicBlock until it ends.