mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Add cancellation points for 'compile' requests
After each stage of the compilation pipeline before the code generation. Sema, SILGen, SILOptimization, SILLowering, IRGen.
This commit is contained in:
@@ -1556,6 +1556,10 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
|
||||
if (observer)
|
||||
observer->performedSILGeneration(*SM);
|
||||
|
||||
// Cancellation check after SILGen.
|
||||
if (Instance.isCancellationRequested())
|
||||
return true;
|
||||
|
||||
auto *Stats = Instance.getASTContext().Stats;
|
||||
if (Stats)
|
||||
countStatsPostSILGen(*Stats, *SM);
|
||||
@@ -1629,6 +1633,10 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
|
||||
if (observer)
|
||||
observer->performedSILProcessing(*SM);
|
||||
|
||||
// Cancellation check after SILOptimzation.
|
||||
if (Instance.isCancellationRequested())
|
||||
return true;
|
||||
|
||||
if (PSPs.haveModuleSummaryOutputPath()) {
|
||||
if (serializeModuleSummary(SM.get(), PSPs, Context)) {
|
||||
return true;
|
||||
@@ -1663,6 +1671,10 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
|
||||
|
||||
runSILLoweringPasses(*SM);
|
||||
|
||||
// Cancellation check after SILLowering.
|
||||
if (Instance.isCancellationRequested())
|
||||
return true;
|
||||
|
||||
// TODO: at this point we need to flush any the _tracing and profiling_
|
||||
// in the UnifiedStatsReporter, because the those subsystems of the USR
|
||||
// retain _pointers into_ the SILModule, and the SILModule's lifecycle is
|
||||
@@ -1690,6 +1702,10 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
|
||||
IRGenOpts, Invocation.getTBDGenOptions(), std::move(SM), PSPs,
|
||||
OutputFilename, MSF, HashGlobal, ParallelOutputFilenames);
|
||||
|
||||
// Cancellation check after IRGen.
|
||||
if (Instance.isCancellationRequested())
|
||||
return true;
|
||||
|
||||
// If no IRModule is available, bail. This can either happen if IR generation
|
||||
// fails, or if parallelIRGen happened correctly (in which case it would have
|
||||
// already performed LLVM).
|
||||
|
||||
Reference in New Issue
Block a user