-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When oxc is being used in Rolldown run on large applications (lots of javascript code), the combination of tokio + rayon + recursing binary expressions in transform and codegen can easily cause stack overflow.
This was evident when I worked on Rspack with swc. The proposed solution was to set RUST_MIN_STACK to a super high value.
Hours can be lost when debugging such cases, and I don't want to tell my downstream users to set a higher RUST_MIN_STACK.
Besides, esbuild unrolls its recursions for binary expressions, and we should do the same since our goal is to target super large codebases.
To trigger the stack overflow, we can have a set of tests where RUST_MIN_STACK is to a lower number.
tasks/coverage/misc/pass/swc-1627.js also contains a large binary expression.
Or we can dynamically generate a large dynamic expression so we don't commit in a huge file.
Seen in wild: https://github.com/denoland/deno/issues/24325#issuecomment-2203867362
"AAEAAAASAQAABAAgR0RFRrRCsIIAAir4AAACYkdQT1Or8IZpAAItXAAAZS5H" +
"U1VCeoGFdwACkowAABWQT1MvMpl2sYAAAhh4AAAAYGNtYXDG7lFtAAId8AAA" +
"BoJjdnQgBg4uPQACJ2gAAABaZnBnbYP7I6sAAiR0AAABvGdhc3AACAATAAIq" +
"7AAAAAxnbHlm1d+kywAAASwAAfh4aGRteHmPiKEAAhjYAAAFGGhlYWT9R9JX" +
"AAID5AAAADZoaGVhDUgS1wACGFQAAAAkaG10eN7XI9kAAgQcAAAUOGxvY2HG" +
// <continues for ~3864 more lines
And code generated file: https://github.com/StoneCypher/jssm/blob/main/src/ts/fsl_parser.ts