Fixes to incremental DDK/blaze

This CL fixes a number of issues:
* Semi-leaking old components when starting over
  (i.e. when loading a new sdk)
* Setting new filesystem not really working because the old one was
  cached in the ProcessedOptions
* Leaking old state because of an apparent VM bug (http://dartbug.com/36983)

Change-Id: Ib124257c456b019941e253409c1ef56eedcf66b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103121
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen 2019-05-21 09:10:58 +00:00 committed by commit-bot@chromium.org
parent e7f7984995
commit 2bbb6aae9b
3 changed files with 13 additions and 1 deletions

View file

@ -70,8 +70,11 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
if (oldState == null ||
oldState.incrementalCompiler == null ||
oldState.incrementalCompiler.outlineOnly != outlineOnly) {
// No previous state.
// No - or immediately not correct - previous state.
startOver = true;
// We'll load a new sdk, anything loaded already will have a wrong root.
workerInputCache.clear();
} else {
// We do have a previous state.
cachedSdkInput = workerInputCache[sdkSummary];
@ -79,6 +82,8 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
!digestsEqual(cachedSdkInput.digest, sdkDigest)) {
// The sdk is out of date.
startOver = true;
// We'll load a new sdk, anything loaded already will have a wrong root.
workerInputCache.clear();
}
}
@ -120,6 +125,7 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
incrementalCompiler.invalidateAllSources();
options.packagesFileUri = packagesFile;
options.fileSystem = fileSystem;
processedOpts.clearFileSystemCache();
}
// Then read all the input summary components.

View file

@ -165,6 +165,9 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
..fileSystem = fileSystem ?? StandardFileSystem.instance;
if (experiments != null) options.experimentalFlags = experiments;
// We'll load a new sdk, anything loaded already will have a wrong root.
workerInputCache.clear();
processedOpts = new ProcessedOptions(options: options);
cachedSdkInput = new WorkerInputComponent(null /* not compared anyway */,
@ -190,6 +193,7 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
incrementalCompiler.invalidateAllSources();
options.packagesFileUri = packagesFile;
options.fileSystem = fileSystem;
processedOpts.clearFileSystemCache();
}
InitializedCompilerState compilerState = new InitializedCompilerState(
options, processedOpts,

View file

@ -299,6 +299,8 @@ Future<ComputeKernelResult> computeKernel(List<String> args,
return Future.value(fe.serializeComponent(incrementalComponent));
});
state.options.onDiagnostic = null; // See http://dartbug.com/36983.
} else if (summaryOnly) {
kernel = await fe.compileSummary(state, sources, onDiagnostic,
includeOffsets: false);