Skip to content

Commit

Permalink
Rollup merge of #131116 - mustartt:aix-stack-size, r=petrochenkov
Browse files Browse the repository at this point in the history
Increase Stack Size for AIX

On AIX, there are limited support for tail call optimizations, so we need to set a larger stack size value.

Fixes the following tests on AIX:
```
[ui] tests/ui/associated-consts/issue-93775.rs
[ui] tests/ui/closures/deeply-nested_closures.rs
[ui] tests/ui/issues/issue-74564-if-expr-stack-overflow.rs
[ui] tests/ui/parser/survive-peano-lesson-queue.rs
```
  • Loading branch information
workingjubilee authored Oct 4, 2024
2 parents 5a8fcab + 162ee75 commit 554daa0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_data_structures/src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ const RED_ZONE: usize = 100 * 1024; // 100k

// Only the first stack that is pushed, grows exponentially (2^n * STACK_PER_RECURSION) from then
// on. This flag has performance relevant characteristics. Don't set it too high.
#[cfg(not(target_os = "aix"))]
const STACK_PER_RECURSION: usize = 1024 * 1024; // 1MB
// LLVM for AIX doesn't feature TCO, increase recursion size for workaround.
#[cfg(target_os = "aix")]
const STACK_PER_RECURSION: usize = 16 * 1024 * 1024; // 16MB

/// Grows the stack on demand to prevent stack overflow. Call this in strategic locations
/// to "break up" recursive calls. E.g. almost any call to `visit_expr` or equivalent can benefit
Expand Down

0 comments on commit 554daa0

Please sign in to comment.