mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Stop using SharedTimer except to implement FrontendStatsTracer
Name binding can trigger swiftinterface compilation, which creates a new ASTContext and runs a compilation job. If the compiler was run with -stats-output-dir, this could trigger an assertion because SharedTimer is not re-entrant. Fix this by replacing all direct uses of SharedTimer in the frontend with FrontendStatsTracer. SharedTimer is still used to _implement_ FrontendStatsTracer, however we can collapse some of the layers in the implementation later. Many of the usages should also become redundant over time once more code is converted over to requests.
This commit is contained in:
@@ -1139,7 +1139,8 @@ static bool performMandatorySILPasses(CompilerInvocation &Invocation,
|
||||
/// These may change across compiler versions.
|
||||
static void performSILOptimizations(CompilerInvocation &Invocation,
|
||||
SILModule *SM) {
|
||||
SharedTimer timer("SIL optimization");
|
||||
FrontendStatsTracer tracer(SM->getASTContext().Stats,
|
||||
"SIL optimization");
|
||||
if (Invocation.getFrontendOptions().RequestedAction ==
|
||||
FrontendOptions::ActionType::MergeModules ||
|
||||
!Invocation.getSILOptions().shouldOptimize()) {
|
||||
@@ -1182,7 +1183,8 @@ bool CompilerInstance::performSILProcessing(SILModule *silModule,
|
||||
return true;
|
||||
|
||||
{
|
||||
SharedTimer timer("SIL verification, pre-optimization");
|
||||
FrontendStatsTracer tracer(silModule->getASTContext().Stats,
|
||||
"SIL verification, pre-optimization");
|
||||
silModule->verify();
|
||||
}
|
||||
|
||||
@@ -1192,7 +1194,8 @@ bool CompilerInstance::performSILProcessing(SILModule *silModule,
|
||||
countStatsPostSILOpt(*stats, *silModule);
|
||||
|
||||
{
|
||||
SharedTimer timer("SIL verification, post-optimization");
|
||||
FrontendStatsTracer tracer(silModule->getASTContext().Stats,
|
||||
"SIL verification, post-optimization");
|
||||
silModule->verify();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user