[SourceKit] Use a deep stack to perform syntactic parsing

Othwerise we were performing the syntactic parsing on a background queue that had a reduced stack size which could result in stack overflows.

rdar://84474387
This commit is contained in:
Alex Hoppen
2021-11-08 21:10:36 +01:00
parent b888dc0e40
commit 3a96cc7c51
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);
}
}