Merge pull request #40066 from ahoppen/pr/deep-stack

[SourceKit] Use deep stack when parsing in the XPC service
This commit is contained in:
Alex Hoppen
2021-11-15 09:17:03 +01:00
committed by GitHub
2 changed files with 803 additions and 2 deletions

View File

@@ -735,8 +735,17 @@ public:
void parseIfNeeded() {
if (!IsParsed) {
Parser->parse();
IsParsed = true;
// Perform parsing on a deep stack that's the same size as the main thread
// during normal compilation to avoid stack overflows.
static WorkQueue BigStackQueue{
WorkQueue::Dequeuing::Concurrent,
"SwiftDocumentSyntaxInfo::parseIfNeeded.BigStackQueue"};
BigStackQueue.dispatchSync(
[this]() {
Parser->parse();
IsParsed = true;
},
/*isStackDeep=*/true);
}
}