Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* ISLE: Make block codegen non-recursive In #8919 we learned that `Codegen::emit_block` can overrun the stack when generating Rust source for deeply-nested blocks. Stack usage can be worse than one might expect because ISLE is called from a build script, and those are always built in debug mode. This commit avoids the problem by using an explicit heap-allocated stack instead of recursion. I recommend turning on the "ignore whitespace" option in your diff tool of choice when reviewing this commit. The amount of stack space that this recursive function uses is affected by the version of rustc used to compile it, and the amount of stack space available depends on the host platform. As a result, this was only observed on Windows with a recent nightly version of rustc, but it could eventually affect other platforms or compiler versions, especially as ISLE rules grow in complexity. Note that there are several other places in ISLE which recurse over the user-provided rules. This commit does not change those, but they could also become a problem in the future. * Review comments: make stack manipulation local to emit_block Co-authored-by: Jamey Sharp <[email protected]>
- Loading branch information