Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows stack overflow with larger stack red_zone #9693

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/transformers/js/core/src/env_replacer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use swc_core::common::Mark;
use swc_core::common::DUMMY_SP;
use swc_core::ecma::ast;
use swc_core::ecma::atoms::JsWord;
use swc_core::ecma::utils::stack_size::maybe_grow_default;
use swc_core::ecma::utils::stack_size::maybe_grow;
use swc_core::ecma::visit::{Fold, FoldWith};

use crate::utils::*;
Expand Down Expand Up @@ -166,7 +166,9 @@ impl<'a> Fold for EnvReplacer<'a> {
}
}

maybe_grow_default(|| node.fold_children_with(self))
// We need a larger red_zone here than swc's default because of possible
// stack overflows on windows with files like https://github.com/highlightjs/highlight.js/blob/105a11a13eedbf830c0e80cc052028ceb593837f/src/languages/isbl.js.
maybe_grow(32 * 1024, 16 * 1024, || node.fold_children_with(self))
}

fn fold_var_decl(&mut self, node: VarDecl) -> VarDecl {
Expand Down