mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Run Sourcekitd-tests in a non dispatch thread
Since Dispatch threads have a 64k stack size, tests were failing due to blowing the stack on Windows. This runs the tests in thread with a larger stack size. This fixes some 90ish sourcekit tests on Windows.
This commit is contained in:
@@ -186,6 +186,15 @@ namespace SourceKit {
|
||||
|
||||
void ASTUnit::Implementation::consumeAsync(SwiftASTConsumerRef ConsumerRef,
|
||||
ASTUnitRef ASTRef) {
|
||||
#if defined(_WIN32)
|
||||
// Windows uses more up for stack space (why?) than macOS/Linux which
|
||||
// causes stack overflows in a dispatch thread with 64k stack. Passing
|
||||
// useDeepStack=true means it's given a _beginthreadex thread with an 8MB
|
||||
// stack.
|
||||
bool useDeepStack = true;
|
||||
#else
|
||||
bool useDeepStack = false;
|
||||
#endif
|
||||
Queue.dispatch([ASTRef, ConsumerRef]{
|
||||
SwiftASTConsumer &ASTConsumer = *ConsumerRef;
|
||||
|
||||
@@ -197,7 +206,7 @@ namespace SourceKit {
|
||||
LOG_WARN_FUNC("did not find primary SourceFile");
|
||||
ConsumerRef->failed("did not find primary SourceFile");
|
||||
}
|
||||
});
|
||||
}, useDeepStack);
|
||||
}
|
||||
|
||||
ASTUnit::ASTUnit(uint64_t Generation, std::shared_ptr<SwiftStatistics> Stats)
|
||||
|
||||
Reference in New Issue
Block a user