aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorMichael Spencer <bigcheesegs@gmail.com>2025-04-30 19:14:15 -0700
committerGitHub <noreply@github.com>2025-04-30 19:14:15 -0700
commit07deaf8464f29c34ff46983450a7412a36adcb7b (patch)
tree01f3d1b5782f81c9f4e4d9c23122b6ffc5bab71e /clang/lib/Frontend/CompilerInstance.cpp
parent46838e1a093510529185408349fe192c09ea42f0 (diff)
downloadllvm-07deaf8464f29c34ff46983450a7412a36adcb7b.zip
llvm-07deaf8464f29c34ff46983450a7412a36adcb7b.tar.gz
llvm-07deaf8464f29c34ff46983450a7412a36adcb7b.tar.bz2
Reland: [llvm][clang] Allocate a new stack instead of spawning a new thread to get more stack space (#136046)
Reland https://github.com/llvm/llvm-project/pull/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 cbc9c9d..fc69987 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1289,7 +1289,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);