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:
Gwen Mittertreiner
2019-06-03 13:23:12 -07:00
parent f26998ec27
commit fa513db7ed
2 changed files with 33 additions and 11 deletions

View File

@@ -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)