2 ms·
Measuring of stack requirements is typically implemented by the way of walking the call graph and adding up functions' stack sizes (for usual function these are
by nagisa 5y ago
Measuring of stack requirements is typically implemented by the way of walking the call graph and adding up functions' stack sizes (for usual function these are well known at compile time). There are “only” a couple problematic cases where this algorithm fails: recursion, `alloca` and the likes, and indirect calls.
For all of these problems there are more complex analyses that can be done to determine e.g. maximum recursion depth or possible functions that an indirect call could resolve to. And failing all of these there is usually a way for an engineer to override or provide this information.