fix: raise C stack for INTERP tail-recursion benchmarks - #16
Merged
Merged
Conversation
Windows and macOS CI crashed in BM_FakeLua_TailRecursion_INTERP because the interpreter does not TCO and the default C stack is too small. Co-authored-by: Cursor <cursoragent@cursor.com>
INTERP has no TCO, so the n=1000/5000 benches overflowed Windows/macOS C stacks. Cover tail calls with unit tests at INTERP-safe depth instead, and run bench_mark on pull requests so the suite fails before merge. Co-authored-by: Cursor <cursoragent@cursor.com>
Codegen rejects fewer/extra arguments to a fixed-arity function, so tail-call into 1-arg and 3-arg callees with matching args instead. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Run benchmarksonBM_FakeLua_TailRecursion_INTERP(Windows exit 127 after n=100, macOS SIGSEGV at n=5000). The interpreter does not turn tail calls into loops, so n=5000 is a 5000-deep C++ call chain.bench_markPE stack to 128 MiB (-Wl,--stack) because the default 1–2 MiB is too small, especially with-O0.ulimit -s unlimited(fallback 65532) before running benchmarks.Test plan
Run benchmarkssteps pass (this step is skipped on PRs).Made with Cursor