aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorMichael Spencer <bigcheesegs@gmail.com>2025-04-15 11:19:07 -0700
committerGitHub <noreply@github.com>2025-04-15 11:19:07 -0700
commitd0c973a7a0149db3b71767d4c5a20a31e6a8ed5b (patch)
tree2be5e6ce890d3708b2b91ca8f0716e5d49e987a5 /clang/lib/Frontend/CompilerInstance.cpp
parenta5aa0c46c3274eaf25dde4d792a1abd6191cccf9 (diff)
downloadllvm-d0c973a7a0149db3b71767d4c5a20a31e6a8ed5b.zip
llvm-d0c973a7a0149db3b71767d4c5a20a31e6a8ed5b.tar.gz
llvm-d0c973a7a0149db3b71767d4c5a20a31e6a8ed5b.tar.bz2
[llvm][clang] Allocate a new stack instead of spawning a new thread to get more stack space (#133173)
Clang spawns a new thread to avoid running out of stack space. This can make debugging and performance analysis more difficult as how the threads are connected is difficult to recover. This patch introduces `runOnNewStack` and applies it in Clang. On platforms that have good support for it this allocates a new stack and moves to it using assembly. Doing split stacks like this actually runs on most platforms, but many debuggers and unwinders reject the large or backwards stack offsets that occur. Apple platforms and tools are known to support this, so this only enables it there for now.
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 243e0a3..5fe80fc 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1265,7 +1265,7 @@ bool CompilerInstance::compileModule(SourceLocation ImportLoc,
// Execute the action to actually build the module in-place. Use a separate
// thread so that we get a stack large enough.
- bool Crashed = !llvm::CrashRecoveryContext().RunSafelyOnThread(
+ bool Crashed = !llvm::CrashRecoveryContext().RunSafelyOnNewStack(
[&]() {
GenerateModuleFromModuleMapAction Action;
Instance.ExecuteAction(Action);