Version 2.14.0-307.0.dev
Merge commit '672d66cea05306b48f34b4e9c2379f2a21993e2c' into 'dev'
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index db83350..ab4deff 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -679,7 +679,7 @@
@override
void listenAnalysisDriver(analysis.AnalysisDriver analysisDriver) {
analysisDriver.results.listen((result) {
- var path = result.path!;
+ var path = result.path;
filesToFlush.add(path);
if (analysisServer.isAnalyzed(path)) {
_notificationManager.recordAnalysisErrors(NotificationManager.serverId,
diff --git a/pkg/analysis_server/lib/src/computer/computer_outline.dart b/pkg/analysis_server/lib/src/computer/computer_outline.dart
index fedd848..deca868 100644
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart
@@ -87,9 +87,6 @@
Location _getLocationOffsetLength(int offset, int length) {
var path = resolvedUnit.path;
- if (path == null) {
- throw StateError('DartUnitOutlineComputer called with invalid result');
- }
var startLocation = resolvedUnit.lineInfo.getLocation(offset);
var startLine = startLocation.lineNumber;
var startColumn = startLocation.columnNumber;
diff --git a/pkg/analysis_server/lib/src/computer/import_elements_computer.dart b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart
index 3a2ec51..d6c013d 100644
--- a/pkg/analysis_server/lib/src/computer/import_elements_computer.dart
+++ b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart
@@ -32,8 +32,7 @@
Future<SourceChange> createEdits(
List<ImportedElements> importedElementsList) async {
var unit = libraryResult.unit;
- var path = libraryResult.path;
- if (unit == null || path == null) {
+ if (unit == null) {
// We should never reach this point because the libraryResult should be
// valid.
return SourceChange('');
@@ -50,7 +49,7 @@
}
var builder = ChangeBuilder(session: libraryResult.session);
- await builder.addDartFileEdit(path, (builder) {
+ await builder.addDartFileEdit(libraryResult.path, (builder) {
for (var importedElements in filteredImportedElements) {
var matchingImports =
_findMatchingImports(existingImports, importedElements);
diff --git a/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart b/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart
index 223e056..d618f66 100644
--- a/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart
+++ b/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart
@@ -24,7 +24,7 @@
var context = tracker.getContext(analysisContext);
if (context == null) return;
- var librariesObject = context.getLibraries(resolvedUnit.path!);
+ var librariesObject = context.getLibraries(resolvedUnit.path);
var importedUriSet = resolvedUnit.libraryElement.importedLibraries
.map((importedLibrary) => importedLibrary.source.uri)
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 0e5ba49..443a663 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -611,7 +611,7 @@
var provider = TopLevelDeclarationsProvider(tracker);
return provider.get(
result.session.analysisContext,
- result.path!,
+ result.path,
name,
);
}, extensionCache: server.getExtensionCacheFor(result));
diff --git a/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart b/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart
index 36e5272..74085faa 100644
--- a/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart
+++ b/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart
@@ -15,7 +15,7 @@
var outline = computer.compute();
// send notification
var params = protocol.FlutterOutlineParams(
- resolvedUnit.path!,
+ resolvedUnit.path,
outline,
);
server.sendNotification(params.toNotification());
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
index 5063d04..0fb95ee 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
@@ -309,7 +309,7 @@
var tracker = server.declarationsTracker!;
return TopLevelDeclarationsProvider(tracker).get(
unit.session.analysisContext,
- unit.path!,
+ unit.path,
name,
);
}, extensionCache: server.getExtensionCacheFor(unit));
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
index ccf8bb2..8dc8323 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
@@ -374,7 +374,7 @@
importingUris.first == '${library.uri}';
}).map((item) => declarationToCompletionItem(
capabilities,
- unit.path!,
+ unit.path,
offset,
includedSet,
library,
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index ab57310..31c8884 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -826,11 +826,6 @@
analysisDriver.results.listen((result) {
var path = result.path;
- if (path == null) {
- // This shouldn't occur - result.path is marked with a TODO to become
- // non-nullable.
- return;
- }
filesToFlush.add(path);
if (analysisServer.isAnalyzed(path)) {
final serverErrors = protocol.doAnalysisError_listFromEngine(result);
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index 05538df..cb7e0ed 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -112,7 +112,7 @@
// send notification
var params = protocol.AnalysisOutlineParams(
- resolvedUnit.path!, fileKind, outline,
+ resolvedUnit.path, fileKind, outline,
libraryName: libraryName);
server.sendNotification(params.toNotification());
});
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index fce6916..f6dc69a 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -100,7 +100,7 @@
}) async {
request.checkAborted();
var pathContext = request.resourceProvider.pathContext;
- if (!file_paths.isDart(pathContext, request.result.path!)) {
+ if (!file_paths.isDart(pathContext, request.result.path)) {
return const <CompletionSuggestion>[];
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index 467c954..9bcd314 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -704,7 +704,7 @@
ExecutableElement element, bool invokeSuper) async {
var displayTextBuffer = StringBuffer();
var builder = ChangeBuilder(session: request.result.session);
- await builder.addDartFileEdit(request.result.path!, (builder) {
+ await builder.addDartFileEdit(request.result.path, (builder) {
builder.addReplacement(range.node(targetId), (builder) {
builder.writeOverride(
element,
diff --git a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart
index 8aa88e2..988a42d 100644
--- a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart
+++ b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart
@@ -264,7 +264,7 @@
String get eol => utils.endOfLine;
- String get file => completionContext.resolveResult.path!;
+ String get file => completionContext.resolveResult.path;
String get key => completionContext.key;
diff --git a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart
index 9bd0039..e71629b 100644
--- a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart
+++ b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart
@@ -120,7 +120,7 @@
String get eol => utils.endOfLine;
- String get file => statementContext.resolveResult.path!;
+ String get file => statementContext.resolveResult.path;
LineInfo get lineInfo => statementContext.resolveResult.lineInfo;
diff --git a/pkg/analysis_server/lib/src/services/correction/base_processor.dart b/pkg/analysis_server/lib/src/services/correction/base_processor.dart
index 543d8c9..fb8a04f 100644
--- a/pkg/analysis_server/lib/src/services/correction/base_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/base_processor.dart
@@ -33,7 +33,7 @@
this.selectionLength = 0,
required this.resolvedResult,
required this.workspace,
- }) : file = resolvedResult.path!,
+ }) : file = resolvedResult.path,
session = resolvedResult.session,
sessionHelper = AnalysisSessionHelper(resolvedResult.session),
typeProvider = resolvedResult.typeProvider,
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index b43cfbc..097765f 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -336,7 +336,7 @@
await compute(producer);
var newHash = computeChangeHash();
if (newHash != oldHash) {
- changeMap.add(result.path!, code);
+ changeMap.add(result.path, code);
}
}
@@ -401,7 +401,7 @@
if (useConfigFiles) {
var provider = result.session.resourceProvider;
var context = provider.pathContext;
- var dartFileName = result.path!;
+ var dartFileName = result.path;
var configFileName = '${context.withoutExtension(dartFileName)}.config';
var configFile = provider.getFile(configFileName);
try {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
index bc10e17..83b0402 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
@@ -249,7 +249,7 @@
this.overrideSet,
this.selectionOffset = -1,
this.selectionLength = 0,
- }) : file = resolvedResult.path!,
+ }) : file = resolvedResult.path,
session = resolvedResult.session,
sessionHelper = AnalysisSessionHelper(resolvedResult.session),
typeProvider = resolvedResult.typeProvider,
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart
index 0f22239..c841c0f 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart
@@ -27,7 +27,7 @@
}
var libraryPath = resolvedResult.libraryElement.source.fullName;
- var partPath = resolvedResult.path!;
+ var partPath = resolvedResult.path;
var relativePath = relative(libraryPath, from: dirname(partPath));
var uri = Uri.file(relativePath).toString();
var replacementRange = range.node(libraryName);
diff --git a/pkg/analysis_server/lib/src/services/flutter/property.dart b/pkg/analysis_server/lib/src/services/flutter/property.dart
index 11af175..0d4f3e3 100644
--- a/pkg/analysis_server/lib/src/services/flutter/property.dart
+++ b/pkg/analysis_server/lib/src/services/flutter/property.dart
@@ -118,7 +118,7 @@
);
}
- await builder.addDartFileEdit(resolvedUnit.path!, (builder) {
+ await builder.addDartFileEdit(resolvedUnit.path, (builder) {
_changeCode(builder, (builder) {
var expression = value.expression;
if (expression != null) {
@@ -155,7 +155,7 @@
}
var beginOffset = argumentExpression.offset;
- await builder.addDartFileEdit(resolvedUnit.path!, (builder) {
+ await builder.addDartFileEdit(resolvedUnit.path, (builder) {
builder.addDeletion(
SourceRange(beginOffset, endOffset - beginOffset),
);
@@ -559,7 +559,7 @@
var builder = ChangeBuilder(session: property.resolvedUnit.session);
- await builder.addDartFileEdit(property.resolvedUnit.path!, (builder) {
+ await builder.addDartFileEdit(property.resolvedUnit.path, (builder) {
property._changeCode(builder, (builder) {
if (leftCode == rightCode && topCode == bottomCode) {
builder.writeReference(classEdgeInsets);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
index 2432c5b..0fc97d8 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
@@ -61,7 +61,7 @@
utils = CorrectionUtils(resolveResult);
}
- String get file => resolveResult.path!;
+ String get file => resolveResult.path;
@override
String get refactoringName => 'Extract Local Variable';
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
index 36304e9..1137c45 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
@@ -144,7 +144,7 @@
Future<SourceChange> createChange() async {
var builder =
ChangeBuilder(session: sessionHelper.session, eol: utils.endOfLine);
- await builder.addDartFileEdit(resolveResult.path!, (builder) {
+ await builder.addDartFileEdit(resolveResult.path, (builder) {
final expression = _expression;
final statements = _statements;
if (expression != null) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_file.dart b/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
index b8535bd..1fcf8cb 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
@@ -113,8 +113,7 @@
}
if (newDir != oldDir) {
- await changeBuilder.addDartFileEdit(definingUnitResult.path!,
- (builder) {
+ await changeBuilder.addDartFileEdit(definingUnitResult.path, (builder) {
for (var directive in definingUnitResult.unit!.directives) {
if (directive is UriBasedDirective) {
_updateUriReference(builder, directive, oldDir, newDir);
diff --git a/pkg/analysis_server/test/protocol_server_test.dart b/pkg/analysis_server/test/protocol_server_test.dart
index 49cae54..ac31994 100644
--- a/pkg/analysis_server/test/protocol_server_test.dart
+++ b/pkg/analysis_server/test/protocol_server_test.dart
@@ -361,7 +361,7 @@
Map<String, FileResult> fileResults = {};
void addFileResult(FileResult result) {
- fileResults[result.path!] = result;
+ fileResults[result.path] = result;
}
@override
diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics.dart b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
index d32c961..45d77c6 100644
--- a/pkg/analysis_server/tool/code_completion/completion_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
@@ -1315,7 +1315,7 @@
}
for (var result in results) {
_resolvedUnitResult = result;
- var filePath = result.path!;
+ var filePath = result.path;
// Use the ExpectedCompletionsVisitor to compute the set of expected
// completions for this CompilationUnit.
final visitor = ExpectedCompletionsVisitor(filePath);
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 6ccdf32..665f334 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 2.1.0
+* Changed `AnalysisResult.path` to be non-nullable.
+
## 2.0.0
* Removed deprecated `Scope.lookup2()`.
* Removed deprecated setters in API of AST.
diff --git a/pkg/analyzer/lib/dart/analysis/results.dart b/pkg/analyzer/lib/dart/analysis/results.dart
index 287c470..c9230c2 100644
--- a/pkg/analyzer/lib/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/dart/analysis/results.dart
@@ -17,9 +17,7 @@
abstract class AnalysisResult {
/// The absolute and normalized path of the file that was analyzed.
/// If [state] is not [ResultState.VALID], throws [StateError].
- ///
- /// TODO(migration): should not be nullable
- String? get path;
+ String get path;
/// Return the session used to compute this result.
/// If [state] is not [ResultState.VALID], throws [StateError].
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index f275425..28d520f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -1148,7 +1148,7 @@
// last time, so we don't need to produce it again now.
} else {
_resultController.add(result);
- _lastProducedSignatures[result.path!] = result._signature;
+ _lastProducedSignatures[result.path] = result._signature;
}
} catch (exception, stackTrace) {
_reportException(path, exception, stackTrace);
diff --git a/pkg/analyzer/lib/src/dart/analysis/results.dart b/pkg/analyzer/lib/src/dart/analysis/results.dart
index ef041e2..41abe8f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/results.dart
@@ -17,7 +17,7 @@
final AnalysisSession session;
@override
- final String? path;
+ final String path;
@override
final Uri uri;
@@ -79,17 +79,11 @@
final List<ParsedUnitResult>? units;
ParsedLibraryResultImpl(
- AnalysisSession session, String? path, Uri uri, this.units)
+ AnalysisSession session, String path, Uri uri, this.units)
: super(session, path, uri);
- ParsedLibraryResultImpl.external(AnalysisSession session, Uri uri)
- : this(session, null, uri, null);
-
@override
ResultState get state {
- if (path == null) {
- return ResultState.NOT_A_FILE;
- }
return ResultState.VALID;
}
@@ -171,17 +165,11 @@
final List<ResolvedUnitResult>? units;
ResolvedLibraryResultImpl(
- AnalysisSession session, String? path, Uri uri, this.element, this.units)
+ AnalysisSession session, String path, Uri uri, this.element, this.units)
: super(session, path, uri);
- ResolvedLibraryResultImpl.external(AnalysisSession session, Uri uri)
- : this(session, null, uri, null, null);
-
@override
ResultState get state {
- if (path == null) {
- return ResultState.NOT_A_FILE;
- }
return ResultState.VALID;
}
diff --git a/pkg/analyzer/test/generated/constant_test.dart b/pkg/analyzer/test/generated/constant_test.dart
index f4a4079..f97d66a 100644
--- a/pkg/analyzer/test/generated/constant_test.dart
+++ b/pkg/analyzer/test/generated/constant_test.dart
@@ -497,7 +497,7 @@
var expression = findNode.variableDeclaration('x =').initializer!;
- var file = getFile(result.path!);
+ var file = getFile(result.path);
var evaluator = ConstantEvaluator(
file.createSource(result.uri),
result.libraryElement as LibraryElementImpl,
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index dee0e8e..eef1ad3 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -3028,7 +3028,7 @@
driver.changeFile(b);
await waitForIdleWithoutExceptions();
- List<String> analyzedPaths = allResults.map((r) => r.path!).toList();
+ List<String> analyzedPaths = allResults.map((r) => r.path).toList();
// The changed file must be the first.
expect(analyzedPaths[0], b);
@@ -3070,7 +3070,7 @@
driver.changeFile(a);
await waitForIdleWithoutExceptions();
- List<String> analyzedPaths = allResults.map((r) => r.path!).toList();
+ List<String> analyzedPaths = allResults.map((r) => r.path).toList();
// The changed files must be the first.
expect(analyzedPaths[0], a);
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index 03dd0ff..2fe77d8 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -1007,7 +1007,7 @@
}
''');
- _assertDiscoveredLibraryForParts([result.path!]);
+ _assertDiscoveredLibraryForParts([result.path]);
}
test_resolve_part_of_uri() async {
@@ -1028,7 +1028,7 @@
}
''');
- _assertDiscoveredLibraryForParts([result.path!]);
+ _assertDiscoveredLibraryForParts([result.path]);
}
test_resolveFile_cache() async {
diff --git a/pkg/analyzer/test/verify_diagnostics_test.dart b/pkg/analyzer/test/verify_diagnostics_test.dart
index 648fbf0..103c27e 100644
--- a/pkg/analyzer/test/verify_diagnostics_test.dart
+++ b/pkg/analyzer/test/verify_diagnostics_test.dart
@@ -321,7 +321,7 @@
/// Extract documentation from the file that was parsed to produce the given
/// [result].
Future<void> _validateFile(ParsedUnitResult result) async {
- filePath = result.path!;
+ filePath = result.path;
hasWrittenFilePath = false;
CompilationUnit unit = result.unit;
for (CompilationUnitMember declaration in unit.declarations) {
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
index 12e92b5..6de2511 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
@@ -1281,7 +1281,7 @@
/// the given [resolvedUnit] and [timeStamp].
DartFileEditBuilderImpl(ChangeBuilderImpl changeBuilder, this.resolvedUnit,
int timeStamp, this.libraryChangeBuilder)
- : super(changeBuilder, resolvedUnit.path!, timeStamp);
+ : super(changeBuilder, resolvedUnit.path, timeStamp);
@override
bool get hasEdits =>
diff --git a/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart b/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart
index a302a76..d424abf 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart
@@ -21,7 +21,7 @@
DartFoldingRequestImpl(this.resourceProvider, this.result);
@override
- String get path => result.path!;
+ String get path => result.path;
}
/// A concrete implementation of [FoldingCollector].
diff --git a/pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart b/pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart
index 5e55b48..95bd889 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart
@@ -21,7 +21,7 @@
DartHighlightsRequestImpl(this.resourceProvider, this.result);
@override
- String get path => result.path!;
+ String get path => result.path;
}
/// A concrete implementation of [HighlightsCollector].
diff --git a/pkg/analyzer_plugin/lib/src/utilities/kythe/entries.dart b/pkg/analyzer_plugin/lib/src/utilities/kythe/entries.dart
index 191101c..684e9e7 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/kythe/entries.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/kythe/entries.dart
@@ -19,7 +19,7 @@
DartEntryRequestImpl(this.resourceProvider, this.result);
@override
- String get path => result.path!;
+ String get path => result.path;
}
/// A concrete implementation of [EntryCollector].
diff --git a/pkg/analyzer_plugin/lib/src/utilities/navigation/navigation.dart b/pkg/analyzer_plugin/lib/src/utilities/navigation/navigation.dart
index 4e1850c..23709a3 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/navigation/navigation.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/navigation/navigation.dart
@@ -28,7 +28,7 @@
this.resourceProvider, this.offset, this.length, this.result);
@override
- String get path => result.path!;
+ String get path => result.path;
}
/// A concrete implementation of [NavigationCollector].
diff --git a/pkg/analyzer_plugin/lib/src/utilities/occurrences/occurrences.dart b/pkg/analyzer_plugin/lib/src/utilities/occurrences/occurrences.dart
index 6bd0592..f436774 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/occurrences/occurrences.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/occurrences/occurrences.dart
@@ -20,7 +20,7 @@
DartOccurrencesRequestImpl(this.resourceProvider, this.result);
@override
- String get path => result.path!;
+ String get path => result.path;
}
/// A concrete implementation of [OccurrencesCollector].
diff --git a/pkg/analyzer_plugin/lib/src/utilities/outline/outline.dart b/pkg/analyzer_plugin/lib/src/utilities/outline/outline.dart
index 44d4dd9..284f140 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/outline/outline.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/outline/outline.dart
@@ -20,7 +20,7 @@
DartOutlineRequestImpl(this.resourceProvider, this.result);
@override
- String get path => result.path!;
+ String get path => result.path;
}
/// A concrete implementation of [OutlineCollector].
diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_yaml_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_yaml_test.dart
index 866316c..00da884 100644
--- a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_yaml_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_yaml_test.dart
@@ -21,7 +21,9 @@
}
class AbstractYamlChangeBuilderTest extends AbstractChangeBuilderTest {
- String get testFilePath => '/home/my/pubspec.yaml';
+ String get testFilePath {
+ return resourceProvider.convertPath('/home/my/pubspec.yaml');
+ }
void createPubspec(String content) {
resourceProvider.newFile(testFilePath, content);
diff --git a/pkg/compiler/test/equivalence/id_equivalence.dart b/pkg/compiler/test/equivalence/id_equivalence.dart
index 31ece9d..879d6b9 100644
--- a/pkg/compiler/test/equivalence/id_equivalence.dart
+++ b/pkg/compiler/test/equivalence/id_equivalence.dart
@@ -17,7 +17,7 @@
SourceSpan computeSourceSpanFromUriOffset(Uri uri, int offset) {
if (uri != null) {
- if (offset != null) {
+ if (offset != null && offset != -1) {
return new SourceSpan(uri, offset, offset + 1);
} else {
return new SourceSpan(uri, 0, 0);
diff --git a/pkg/dds/analysis_options.yaml b/pkg/dds/analysis_options.yaml
index 413f412..1f83658 100644
--- a/pkg/dds/analysis_options.yaml
+++ b/pkg/dds/analysis_options.yaml
@@ -2,5 +2,6 @@
linter:
rules:
+ - depend_on_referenced_packages
- directives_ordering
- prefer_generic_function_type_aliases
diff --git a/pkg/dds/lib/src/devtools/devtools_client.dart b/pkg/dds/lib/src/devtools/devtools_client.dart
index 8bc3564..e5ec54e 100644
--- a/pkg/dds/lib/src/devtools/devtools_client.dart
+++ b/pkg/dds/lib/src/devtools/devtools_client.dart
@@ -4,12 +4,11 @@
import 'dart:async';
+import 'package:devtools_shared/devtools_server.dart';
import 'package:json_rpc_2/src/server.dart' as json_rpc;
import 'package:sse/src/server/sse_handler.dart';
import 'package:stream_channel/stream_channel.dart';
-import 'server_api.dart';
-
class LoggingMiddlewareSink<S> implements StreamSink<S> {
LoggingMiddlewareSink(this.sink);
diff --git a/pkg/dds/lib/src/devtools/devtools_handler.dart b/pkg/dds/lib/src/devtools/devtools_handler.dart
index 87c4fa6..3b55bfb 100644
--- a/pkg/dds/lib/src/devtools/devtools_handler.dart
+++ b/pkg/dds/lib/src/devtools/devtools_handler.dart
@@ -5,13 +5,13 @@
import 'dart:async';
import 'package:dds/src/constants.dart';
+import 'package:devtools_shared/devtools_server.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf_static/shelf_static.dart';
import 'package:sse/server/sse_handler.dart';
import '../dds_impl.dart';
import 'devtools_client.dart';
-import 'server_api.dart';
/// Returns a [Handler] which handles serving DevTools and the DevTools server
/// API under $DDS_URI/devtools/.
diff --git a/pkg/dds/lib/src/devtools/file_system.dart b/pkg/dds/lib/src/devtools/file_system.dart
deleted file mode 100644
index d5d6c6a..0000000
--- a/pkg/dds/lib/src/devtools/file_system.dart
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// TODO(bkonyi): remove once package:devtools_server_api is available
-// See https://github.com/flutter/devtools/issues/2958.
-
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-
-import 'usage.dart';
-
-class LocalFileSystem {
- static String _userHomeDir() {
- final String envKey =
- Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
- final String? value = Platform.environment[envKey];
- return value == null ? '.' : value;
- }
-
- /// Returns the path to the DevTools storage directory.
- static String devToolsDir() {
- return path.join(_userHomeDir(), '.flutter-devtools');
- }
-
- /// Moves the .devtools file to ~/.flutter-devtools/.devtools if the .devtools file
- /// exists in the user's home directory.
- static void maybeMoveLegacyDevToolsStore() {
- final file = File(path.join(_userHomeDir(), DevToolsUsage.storeName));
- if (file.existsSync()) {
- ensureDevToolsDirectory();
- file.copySync(path.join(devToolsDir(), DevToolsUsage.storeName));
- file.deleteSync();
- }
- }
-
- /// Creates the ~/.flutter-devtools directory if it does not already exist.
- static void ensureDevToolsDirectory() {
- Directory('${LocalFileSystem.devToolsDir()}').createSync();
- }
-
- /// Returns a DevTools file from the given path.
- ///
- /// Only files within ~/.flutter-devtools/ can be accessed.
- static File? devToolsFileFromPath(String pathFromDevToolsDir) {
- if (pathFromDevToolsDir.contains('..')) {
- // The passed in path should not be able to walk up the directory tree
- // outside of the ~/.flutter-devtools/ directory.
- return null;
- }
- ensureDevToolsDirectory();
- final file = File(path.join(devToolsDir(), pathFromDevToolsDir));
- if (!file.existsSync()) {
- return null;
- }
- return file;
- }
-
- /// Returns a DevTools file from the given path as encoded json.
- ///
- /// Only files within ~/.flutter-devtools/ can be accessed.
- static String? devToolsFileAsJson(String pathFromDevToolsDir) {
- final file = devToolsFileFromPath(pathFromDevToolsDir);
- if (file == null) return null;
-
- final fileName = path.basename(file.path);
- if (!fileName.endsWith('.json')) return null;
-
- final content = file.readAsStringSync();
- final json = jsonDecode(content);
- json['lastModifiedTime'] = file.lastModifiedSync().toString();
- return jsonEncode(json);
- }
-
- /// Whether the flutter store file exists.
- static bool flutterStoreExists() {
- final flutterStore = File('${_userHomeDir()}/.flutter');
- return flutterStore.existsSync();
- }
-}
diff --git a/pkg/dds/lib/src/devtools/server_api.dart b/pkg/dds/lib/src/devtools/server_api.dart
deleted file mode 100644
index 5f21a03..0000000
--- a/pkg/dds/lib/src/devtools/server_api.dart
+++ /dev/null
@@ -1,228 +0,0 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// TODO(bkonyi): remove once package:devtools_server_api is available
-// See https://github.com/flutter/devtools/issues/2958.
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:devtools_shared/devtools_shared.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import 'file_system.dart';
-import 'usage.dart';
-
-/// The DevTools server API.
-///
-/// This defines endpoints that serve all requests that come in over api/.
-class ServerApi {
- static const errorNoActiveSurvey = 'ERROR: setActiveSurvey not called.';
-
- /// Determines whether or not [request] is an API call.
- static bool canHandle(shelf.Request request) {
- return request.url.path.startsWith(apiPrefix);
- }
-
- /// Handles all requests.
- ///
- /// To override an API call, pass in a subclass of [ServerApi].
- static FutureOr<shelf.Response> handle(
- shelf.Request request, [
- ServerApi? api,
- ]) {
- api ??= ServerApi();
- switch (request.url.path) {
- // ----- Flutter Tool GA store. -----
- case apiGetFlutterGAEnabled:
- // Is Analytics collection enabled?
- return api.getCompleted(
- request,
- json.encode(FlutterUsage.doesStoreExist ? _usage!.enabled : null),
- );
- case apiGetFlutterGAClientId:
- // Flutter Tool GA clientId - ONLY get Flutter's clientId if enabled is
- // true.
- return (FlutterUsage.doesStoreExist)
- ? api.getCompleted(
- request,
- json.encode(_usage!.enabled ? _usage!.clientId : null),
- )
- : api.getCompleted(
- request,
- json.encode(null),
- );
-
- // ----- DevTools GA store. -----
-
- case apiResetDevTools:
- _devToolsUsage.reset();
- return api.getCompleted(request, json.encode(true));
- case apiGetDevToolsFirstRun:
- // Has DevTools been run first time? To bring up welcome screen.
- return api.getCompleted(
- request,
- json.encode(_devToolsUsage.isFirstRun),
- );
- case apiGetDevToolsEnabled:
- // Is DevTools Analytics collection enabled?
- return api.getCompleted(request, json.encode(_devToolsUsage.enabled));
- case apiSetDevToolsEnabled:
- // Enable or disable DevTools analytics collection.
- final queryParams = request.requestedUri.queryParameters;
- if (queryParams.containsKey(devToolsEnabledPropertyName)) {
- _devToolsUsage.enabled =
- json.decode(queryParams[devToolsEnabledPropertyName]!);
- }
- return api.setCompleted(request, json.encode(_devToolsUsage.enabled));
-
- // ----- DevTools survey store. -----
-
- case apiSetActiveSurvey:
- // Assume failure.
- bool result = false;
-
- // Set the active survey used to store subsequent apiGetSurveyActionTaken,
- // apiSetSurveyActionTaken, apiGetSurveyShownCount, and
- // apiIncrementSurveyShownCount calls.
- final queryParams = request.requestedUri.queryParameters;
- if (queryParams.keys.length == 1 &&
- queryParams.containsKey(activeSurveyName)) {
- final String theSurveyName = queryParams[activeSurveyName]!;
-
- // Set the current activeSurvey.
- _devToolsUsage.activeSurvey = theSurveyName;
- result = true;
- }
-
- return api.getCompleted(request, json.encode(result));
- case apiGetSurveyActionTaken:
- // Request setActiveSurvey has not been requested.
- if (_devToolsUsage.activeSurvey == null) {
- return api.badRequest('$errorNoActiveSurvey '
- '- $apiGetSurveyActionTaken');
- }
- // SurveyActionTaken has the survey been acted upon (taken or dismissed)
- return api.getCompleted(
- request,
- json.encode(_devToolsUsage.surveyActionTaken),
- );
- // TODO(terry): remove the query param logic for this request.
- // setSurveyActionTaken should only be called with the value of true, so
- // we can remove the extra complexity.
- case apiSetSurveyActionTaken:
- // Request setActiveSurvey has not been requested.
- if (_devToolsUsage.activeSurvey == null) {
- return api.badRequest('$errorNoActiveSurvey '
- '- $apiSetSurveyActionTaken');
- }
- // Set the SurveyActionTaken.
- // Has the survey been taken or dismissed..
- final queryParams = request.requestedUri.queryParameters;
- if (queryParams.containsKey(surveyActionTakenPropertyName)) {
- _devToolsUsage.surveyActionTaken =
- json.decode(queryParams[surveyActionTakenPropertyName]!);
- }
- return api.setCompleted(
- request,
- json.encode(_devToolsUsage.surveyActionTaken),
- );
- case apiGetSurveyShownCount:
- // Request setActiveSurvey has not been requested.
- if (_devToolsUsage.activeSurvey == null) {
- return api.badRequest('$errorNoActiveSurvey '
- '- $apiGetSurveyShownCount');
- }
- // SurveyShownCount how many times have we asked to take survey.
- return api.getCompleted(
- request,
- json.encode(_devToolsUsage.surveyShownCount),
- );
- case apiIncrementSurveyShownCount:
- // Request setActiveSurvey has not been requested.
- if (_devToolsUsage.activeSurvey == null) {
- return api.badRequest('$errorNoActiveSurvey '
- '- $apiIncrementSurveyShownCount');
- }
- // Increment the SurveyShownCount, we've asked about the survey.
- _devToolsUsage.incrementSurveyShownCount();
- return api.getCompleted(
- request,
- json.encode(_devToolsUsage.surveyShownCount),
- );
- case apiGetBaseAppSizeFile:
- final queryParams = request.requestedUri.queryParameters;
- if (queryParams.containsKey(baseAppSizeFilePropertyName)) {
- final filePath = queryParams[baseAppSizeFilePropertyName]!;
- final fileJson = LocalFileSystem.devToolsFileAsJson(filePath);
- if (fileJson == null) {
- return api.badRequest('No JSON file available at $filePath.');
- }
- return api.getCompleted(request, fileJson);
- }
- return api.badRequest('Request for base app size file does not '
- 'contain a query parameter with the expected key: '
- '$baseAppSizeFilePropertyName');
- case apiGetTestAppSizeFile:
- final queryParams = request.requestedUri.queryParameters;
- if (queryParams.containsKey(testAppSizeFilePropertyName)) {
- final filePath = queryParams[testAppSizeFilePropertyName]!;
- final fileJson = LocalFileSystem.devToolsFileAsJson(filePath);
- if (fileJson == null) {
- return api.badRequest('No JSON file available at $filePath.');
- }
- return api.getCompleted(request, fileJson);
- }
- return api.badRequest('Request for test app size file does not '
- 'contain a query parameter with the expected key: '
- '$testAppSizeFilePropertyName');
- default:
- return api.notImplemented(request);
- }
- }
-
- // Accessing Flutter usage file e.g., ~/.flutter.
- // NOTE: Only access the file if it exists otherwise Flutter Tool hasn't yet
- // been run.
- static final FlutterUsage? _usage =
- FlutterUsage.doesStoreExist ? FlutterUsage() : null;
-
- // Accessing DevTools usage file e.g., ~/.devtools
- static final DevToolsUsage _devToolsUsage = DevToolsUsage();
-
- static DevToolsUsage get devToolsPreferences => _devToolsUsage;
-
- /// Logs a page view in the DevTools server.
- ///
- /// In the open-source version of DevTools, Google Analytics handles this
- /// without any need to involve the server.
- FutureOr<shelf.Response> logScreenView(shelf.Request request) =>
- notImplemented(request);
-
- /// Return the value of the property.
- FutureOr<shelf.Response> getCompleted(shelf.Request request, String value) =>
- shelf.Response.ok('$value');
-
- /// Return the value of the property after the property value has been set.
- FutureOr<shelf.Response> setCompleted(shelf.Request request, String value) =>
- shelf.Response.ok('$value');
-
- /// A [shelf.Response] for API calls that encountered a request problem e.g.,
- /// setActiveSurvey not called.
- ///
- /// This is a 400 Bad Request response.
- FutureOr<shelf.Response> badRequest([String? logError]) {
- if (logError != null) print(logError);
- return shelf.Response(HttpStatus.badRequest);
- }
-
- /// A [shelf.Response] for API calls that have not been implemented in this
- /// server.
- ///
- /// This is a no-op 204 No Content response because returning 404 Not Found
- /// creates unnecessary noise in the console.
- FutureOr<shelf.Response> notImplemented(shelf.Request request) =>
- shelf.Response(HttpStatus.noContent);
-}
diff --git a/pkg/dds/lib/src/devtools/usage.dart b/pkg/dds/lib/src/devtools/usage.dart
deleted file mode 100644
index 8e61b90..0000000
--- a/pkg/dds/lib/src/devtools/usage.dart
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// TODO(bkonyi): remove once package:devtools_server_api is available
-// See https://github.com/flutter/devtools/issues/2958.
-
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-import 'package:usage/usage_io.dart';
-
-import 'file_system.dart';
-
-/// Access the file '~/.flutter'.
-class FlutterUsage {
- /// Create a new Usage instance; [versionOverride] and [configDirOverride] are
- /// used for testing.
- FlutterUsage({
- String settingsName = 'flutter',
- String? versionOverride,
- String? configDirOverride,
- }) {
- _analytics = AnalyticsIO('', settingsName, '');
- }
-
- late Analytics _analytics;
-
- /// Does the .flutter store exist?
- static bool get doesStoreExist {
- return LocalFileSystem.flutterStoreExists();
- }
-
- bool get isFirstRun => _analytics.firstRun;
-
- bool get enabled => _analytics.enabled;
-
- set enabled(bool value) => _analytics.enabled = value;
-
- String get clientId => _analytics.clientId;
-}
-
-// Access the DevTools on disk store (~/.devtools/.devtools).
-class DevToolsUsage {
- /// Create a new Usage instance; [versionOverride] and [configDirOverride] are
- /// used for testing.
- DevToolsUsage({
- String? versionOverride,
- String? configDirOverride,
- }) {
- LocalFileSystem.maybeMoveLegacyDevToolsStore();
- properties = IOPersistentProperties(
- storeName,
- documentDirPath: LocalFileSystem.devToolsDir(),
- );
- }
-
- static const storeName = '.devtools';
-
- /// The activeSurvey is the property name of a top-level property
- /// existing or created in the file ~/.devtools
- /// If the property doesn't exist it is created with default survey values:
- ///
- /// properties[activeSurvey]['surveyActionTaken'] = false;
- /// properties[activeSurvey]['surveyShownCount'] = 0;
- ///
- /// It is a requirement that the API apiSetActiveSurvey must be called before
- /// calling any survey method on DevToolsUsage (addSurvey, rewriteActiveSurvey,
- /// surveyShownCount, incrementSurveyShownCount, or surveyActionTaken).
- String? _activeSurvey;
-
- late IOPersistentProperties properties;
-
- static const _surveyActionTaken = 'surveyActionTaken';
- static const _surveyShownCount = 'surveyShownCount';
-
- void reset() {
- properties.remove('firstRun');
- properties['enabled'] = false;
- }
-
- bool get isFirstRun {
- properties['firstRun'] = properties['firstRun'] == null;
- return properties['firstRun'];
- }
-
- bool get enabled {
- if (properties['enabled'] == null) {
- properties['enabled'] = false;
- }
-
- return properties['enabled'];
- }
-
- set enabled(bool? value) {
- properties['enabled'] = value;
- return properties['enabled'];
- }
-
- bool surveyNameExists(String? surveyName) => properties[surveyName] != null;
-
- void _addSurvey(String? surveyName) {
- assert(activeSurvey == surveyName);
- rewriteActiveSurvey(false, 0);
- }
-
- String? get activeSurvey => _activeSurvey;
-
- set activeSurvey(String? surveyName) {
- _activeSurvey = surveyName;
-
- if (!surveyNameExists(activeSurvey)) {
- // Create the survey if property is non-existent in ~/.devtools
- _addSurvey(activeSurvey);
- }
- }
-
- /// Need to rewrite the entire survey structure for property to be persisted.
- void rewriteActiveSurvey(bool? actionTaken, int? shownCount) {
- properties[activeSurvey] = {
- _surveyActionTaken: actionTaken,
- _surveyShownCount: shownCount,
- };
- }
-
- int? get surveyShownCount {
- final prop = properties[activeSurvey];
- if (prop[_surveyShownCount] == null) {
- rewriteActiveSurvey(prop[_surveyActionTaken], 0);
- }
- return properties[activeSurvey][_surveyShownCount];
- }
-
- void incrementSurveyShownCount() {
- surveyShownCount; // Ensure surveyShownCount has been initialized.
- final prop = properties[activeSurvey];
- rewriteActiveSurvey(prop[_surveyActionTaken], prop[_surveyShownCount] + 1);
- }
-
- bool get surveyActionTaken {
- return properties[activeSurvey][_surveyActionTaken] == true;
- }
-
- set surveyActionTaken(bool? value) {
- final prop = properties[activeSurvey];
- rewriteActiveSurvey(value, prop[_surveyShownCount]);
- }
-}
-
-abstract class PersistentProperties {
- PersistentProperties(this.name);
-
- final String name;
-
- dynamic operator [](String key);
-
- void operator []=(String key, dynamic value);
-
- /// Re-read settings from the backing store.
- ///
- /// May be a no-op on some platforms.
- void syncSettings();
-}
-
-const JsonEncoder _jsonEncoder = JsonEncoder.withIndent(' ');
-
-class IOPersistentProperties extends PersistentProperties {
- IOPersistentProperties(
- String name, {
- String? documentDirPath,
- }) : super(name) {
- final String fileName = name.replaceAll(' ', '_');
- documentDirPath ??= LocalFileSystem.devToolsDir();
- _file = File(path.join(documentDirPath, fileName));
- if (!_file.existsSync()) {
- _file.createSync(recursive: true);
- }
- syncSettings();
- }
-
- IOPersistentProperties.fromFile(File file) : super(path.basename(file.path)) {
- _file = file;
- if (!_file.existsSync()) {
- _file.createSync(recursive: true);
- }
- syncSettings();
- }
-
- late File _file;
-
- Map? _map;
-
- @override
- dynamic operator [](String? key) => _map![key];
-
- @override
- void operator []=(String? key, dynamic value) {
- if (value == null && !_map!.containsKey(key)) return;
- if (_map![key] == value) return;
-
- if (value == null) {
- _map!.remove(key);
- } else {
- _map![key] = value;
- }
-
- try {
- _file.writeAsStringSync(_jsonEncoder.convert(_map) + '\n');
- } catch (_) {}
- }
-
- @override
- void syncSettings() {
- try {
- String contents = _file.readAsStringSync();
- if (contents.isEmpty) contents = '{}';
- _map = jsonDecode(contents);
- } catch (_) {
- _map = {};
- }
- }
-
- void remove(String propertyName) {
- _map!.remove(propertyName);
- }
-}
diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml
index 2bf3136..62298b1 100644
--- a/pkg/dds/pubspec.yaml
+++ b/pkg/dds/pubspec.yaml
@@ -24,7 +24,6 @@
shelf_web_socket: ^1.0.0
sse: ^4.0.0
stream_channel: ^2.0.0
- usage: ^4.0.0
vm_service: ^7.0.0
web_socket_channel: ^2.0.0
diff --git a/pkg/nnbd_migration/lib/migration_cli.dart b/pkg/nnbd_migration/lib/migration_cli.dart
index a9893c0..c592edc 100644
--- a/pkg/nnbd_migration/lib/migration_cli.dart
+++ b/pkg/nnbd_migration/lib/migration_cli.dart
@@ -1093,7 +1093,7 @@
});
await processResources((ResolvedUnitResult result) async {
_progressBar.tick();
- if (_migrationCli.shouldBeMigrated(result.path!)) {
+ if (_migrationCli.shouldBeMigrated(result.path)) {
await _task!.finalizeUnit(result);
}
});
diff --git a/pkg/nnbd_migration/lib/src/front_end/info_builder.dart b/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
index c6f6fb4..def1ec6 100644
--- a/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
@@ -111,7 +111,7 @@
// referenced (we'll just skip the entire library because we'll only
// ever see its parts).
sourceInfo ??= SourceInformation();
- var edit = listener!.sourceChange.getFileEdit(unitResult.path!);
+ var edit = listener!.sourceChange.getFileEdit(unitResult.path);
var unit = _explainUnit(sourceInfo, unitResult, edit);
if (_pathsToProcess!.contains(unitResult.path)) {
units.add(unit);
diff --git a/runtime/docs/gc.md b/runtime/docs/gc.md
index 7857b3d..1daea96 100644
--- a/runtime/docs/gc.md
+++ b/runtime/docs/gc.md
@@ -6,7 +6,7 @@
Object pointers refer either to immediate objects or heap objects, distinguished by a tag in the low bits of the pointer. The Dart VM has only one kind of immediate object, Smis (small integers), whose pointers have a tag of 0. Heap objects have a pointer tag of 1. The upper bits of a Smi pointer are its value, and the upper bits of a heap object pointer are the most significant bits of its address (the least significant bit is always 0 because heap objects always have greater than 2-byte alignment).
-A tag of 0 allows many operations to be performed on Smis without untagging and retagging. It also allows hiding aligned addresses to the C heap from the GC.
+A tag of 0 allows many operations to be performed on Smis without untagging and retagging.
A tag of 1 has no penalty on heap object access because removing the tag can be folded into the offset used by load and store instructions.
diff --git a/runtime/tests/vm/dart/isolates/fibonacci_call_ig_test.dart b/runtime/tests/vm/dart/isolates/fibonacci_call_ig_test.dart
index 61acb3f..f265932 100644
--- a/runtime/tests/vm/dart/isolates/fibonacci_call_ig_test.dart
+++ b/runtime/tests/vm/dart/isolates/fibonacci_call_ig_test.dart
@@ -12,6 +12,12 @@
import 'test_utils.dart';
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final rp = ReceivePort();
final int n = 18;
await spawnInDetachedGroup(fibonacciRecursive, [rp.sendPort, n]);
diff --git a/runtime/tests/vm/dart/isolates/fibonacci_call_test.dart b/runtime/tests/vm/dart/isolates/fibonacci_call_test.dart
index a8ba640..efc70bb 100644
--- a/runtime/tests/vm/dart/isolates/fibonacci_call_test.dart
+++ b/runtime/tests/vm/dart/isolates/fibonacci_call_test.dart
@@ -11,6 +11,12 @@
import 'test_utils.dart';
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final rp = ReceivePort();
final int n = 18;
await Isolate.spawn(fibonacciRecursive, [rp.sendPort, n]);
diff --git a/runtime/tests/vm/dart/isolates/limited_active_mutator_test.dart b/runtime/tests/vm/dart/isolates/limited_active_mutator_test.dart
index 147dfdc..4137f06 100644
--- a/runtime/tests/vm/dart/isolates/limited_active_mutator_test.dart
+++ b/runtime/tests/vm/dart/isolates/limited_active_mutator_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// SharedObjects=ffi_test_functions
// VMOptions=--enable-isolate-groups --experimental-enable-isolate-groups-jit --disable-heap-verification --disable-thread-pool-limit
import 'dart:async';
diff --git a/runtime/tests/vm/dart/isolates/ring_gc_sendAndExit_test.dart b/runtime/tests/vm/dart/isolates/ring_gc_sendAndExit_test.dart
index e461273..46a5db4 100644
--- a/runtime/tests/vm/dart/isolates/ring_gc_sendAndExit_test.dart
+++ b/runtime/tests/vm/dart/isolates/ring_gc_sendAndExit_test.dart
@@ -12,6 +12,12 @@
import 'test_utils.dart';
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final int numIsolates = (isDebugMode || isSimulator) ? 100 : 5000;
// Spawn ring of 1k isolates.
diff --git a/runtime/tests/vm/dart/isolates/ring_gc_test.dart b/runtime/tests/vm/dart/isolates/ring_gc_test.dart
index f0ecbc1..ca2084b 100644
--- a/runtime/tests/vm/dart/isolates/ring_gc_test.dart
+++ b/runtime/tests/vm/dart/isolates/ring_gc_test.dart
@@ -31,6 +31,12 @@
}
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final int numIsolates = (isDebugMode || isSimulator) ? 100 : 1000;
// Spawn ring of 1k isolates.
diff --git a/runtime/tests/vm/dart/isolates/test_utils.dart b/runtime/tests/vm/dart/isolates/test_utils.dart
index b2ffa76..4e1d929 100644
--- a/runtime/tests/vm/dart/isolates/test_utils.dart
+++ b/runtime/tests/vm/dart/isolates/test_utils.dart
@@ -10,6 +10,10 @@
final bool isDebugMode = Platform.script.path.contains('Debug');
final bool isSimulator = Platform.script.path.contains('SIM');
+final bool isArtificialReloadMode = Platform.executableArguments.any((arg) => [
+ '--hot-reload-rollback-test-mode',
+ '--hot-reload-test-mode'
+ ].contains(arg));
// Implements recursive summation:
// sum(n) => n == 0 ? 0
diff --git a/runtime/tests/vm/dart_2/isolates/fibonacci_call_ig_test.dart b/runtime/tests/vm/dart_2/isolates/fibonacci_call_ig_test.dart
index 61acb3f..f265932 100644
--- a/runtime/tests/vm/dart_2/isolates/fibonacci_call_ig_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/fibonacci_call_ig_test.dart
@@ -12,6 +12,12 @@
import 'test_utils.dart';
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final rp = ReceivePort();
final int n = 18;
await spawnInDetachedGroup(fibonacciRecursive, [rp.sendPort, n]);
diff --git a/runtime/tests/vm/dart_2/isolates/fibonacci_call_test.dart b/runtime/tests/vm/dart_2/isolates/fibonacci_call_test.dart
index a8ba640..efc70bb 100644
--- a/runtime/tests/vm/dart_2/isolates/fibonacci_call_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/fibonacci_call_test.dart
@@ -11,6 +11,12 @@
import 'test_utils.dart';
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final rp = ReceivePort();
final int n = 18;
await Isolate.spawn(fibonacciRecursive, [rp.sendPort, n]);
diff --git a/runtime/tests/vm/dart_2/isolates/limited_active_mutator_test.dart b/runtime/tests/vm/dart_2/isolates/limited_active_mutator_test.dart
index 147dfdc..4137f06 100644
--- a/runtime/tests/vm/dart_2/isolates/limited_active_mutator_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/limited_active_mutator_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// SharedObjects=ffi_test_functions
// VMOptions=--enable-isolate-groups --experimental-enable-isolate-groups-jit --disable-heap-verification --disable-thread-pool-limit
import 'dart:async';
diff --git a/runtime/tests/vm/dart_2/isolates/reload_active_stack_test.dart b/runtime/tests/vm/dart_2/isolates/reload_active_stack_test.dart
index 22cdd91..615941f 100644
--- a/runtime/tests/vm/dart_2/isolates/reload_active_stack_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/reload_active_stack_test.dart
@@ -2,11 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-import 'dart:io';
-import 'dart:convert';
-
-import 'package:path/path.dart' as path;
import 'package:expect/expect.dart';
import 'reload_utils.dart';
diff --git a/runtime/tests/vm/dart_2/isolates/reload_many_isolates_live_and_die_test.dart b/runtime/tests/vm/dart_2/isolates/reload_many_isolates_live_and_die_test.dart
index 335bbb5..7cfcbf6 100644
--- a/runtime/tests/vm/dart_2/isolates/reload_many_isolates_live_and_die_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/reload_many_isolates_live_and_die_test.dart
@@ -3,10 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
-import 'dart:convert';
-import 'package:path/path.dart' as path;
import 'package:expect/expect.dart';
import 'reload_utils.dart';
diff --git a/runtime/tests/vm/dart_2/isolates/reload_many_isolates_test.dart b/runtime/tests/vm/dart_2/isolates/reload_many_isolates_test.dart
index 67fe65c..70ff30c 100644
--- a/runtime/tests/vm/dart_2/isolates/reload_many_isolates_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/reload_many_isolates_test.dart
@@ -2,11 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-import 'dart:io';
-import 'dart:convert';
-
-import 'package:path/path.dart' as path;
import 'package:expect/expect.dart';
import 'reload_utils.dart';
diff --git a/runtime/tests/vm/dart_2/isolates/reload_no_active_stack_test.dart b/runtime/tests/vm/dart_2/isolates/reload_no_active_stack_test.dart
index 93f06de2..a681d0a 100644
--- a/runtime/tests/vm/dart_2/isolates/reload_no_active_stack_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/reload_no_active_stack_test.dart
@@ -2,11 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-import 'dart:io';
-import 'dart:convert';
-
-import 'package:path/path.dart' as path;
import 'package:expect/expect.dart';
import 'reload_utils.dart';
diff --git a/runtime/tests/vm/dart_2/isolates/ring_gc_sendAndExit_test.dart b/runtime/tests/vm/dart_2/isolates/ring_gc_sendAndExit_test.dart
index e461273..46a5db4 100644
--- a/runtime/tests/vm/dart_2/isolates/ring_gc_sendAndExit_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/ring_gc_sendAndExit_test.dart
@@ -12,6 +12,12 @@
import 'test_utils.dart';
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final int numIsolates = (isDebugMode || isSimulator) ? 100 : 5000;
// Spawn ring of 1k isolates.
diff --git a/runtime/tests/vm/dart_2/isolates/ring_gc_test.dart b/runtime/tests/vm/dart_2/isolates/ring_gc_test.dart
index f0ecbc1..ca2084b 100644
--- a/runtime/tests/vm/dart_2/isolates/ring_gc_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/ring_gc_test.dart
@@ -31,6 +31,12 @@
}
main(args) async {
+ // We don't run this test in our artificial hot reload mode, because it would
+ // create too many threads during the reload (one per isolate), which can
+ // cause this test or other concurrently executing tests to Crash due to
+ // unability of `pthread_create` to create a new thread.
+ if (isArtificialReloadMode) return;
+
final int numIsolates = (isDebugMode || isSimulator) ? 100 : 1000;
// Spawn ring of 1k isolates.
diff --git a/runtime/tests/vm/dart_2/isolates/test_utils.dart b/runtime/tests/vm/dart_2/isolates/test_utils.dart
index 67b84d8..fdf47d7 100644
--- a/runtime/tests/vm/dart_2/isolates/test_utils.dart
+++ b/runtime/tests/vm/dart_2/isolates/test_utils.dart
@@ -10,6 +10,10 @@
final bool isDebugMode = Platform.script.path.contains('Debug');
final bool isSimulator = Platform.script.path.contains('SIM');
+final bool isArtificialReloadMode = Platform.executableArguments.any((arg) => [
+ '--hot-reload-rollback-test-mode',
+ '--hot-reload-test-mode'
+ ].contains(arg));
// Implements recursive summation:
// sum(n) => n == 0 ? 0
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 2cd1ed4..9c5c5af 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -145,13 +145,11 @@
dart/*: SkipByDesign # Migrated tests are not supposed to run on non-NNBD bots.
[ $runtime == vm ]
-dart/isolates/*: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart/issue_31959_31960_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart/sendandexit_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart/spawn_infinite_loop_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart/transferable_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart/transferable_throws_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
-dart_2/isolates/*: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart_2/issue_31959_31960_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart_2/sendandexit_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
dart_2/spawn_infinite_loop_test: Pass, Slow # https://dartbug.com/36097: Slower while isolate groups are being gradually enabled in JIT mode.
@@ -436,34 +434,11 @@
[ $runtime != dart_precompiled || $system == android ]
dart/bare_instructions_trampolines_test: SkipByDesign # This test is for VM AOT only (android fails due to listing interfaces).
-dart/isolates/fibonacci_call_ig_test: Skip # Only AOT has lightweight enough isolates to run those tests, JIT work is pending.
-dart/isolates/fibonacci_call_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/internal: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/limited_active_mutator_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/ring_gc_sendAndExit_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/ring_gc_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/sum_recursive_call_ig_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/sum_recursive_call_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/sum_recursive_tail_call_ig_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/sum_recursive_tail_call_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart/isolates/thread_pool_test: Skip # Only AOT has lightweight enough isolates to run those tests.
dart_2/bare_instructions_trampolines_test: SkipByDesign # This test is for VM AOT only (android fails due to listing interfaces).
-dart_2/isolates/fibonacci_call_ig_test: Skip # Only AOT has lightweight enough isolates to run those tests, JIT work is pending.
-dart_2/isolates/fibonacci_call_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/internal: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/limited_active_mutator_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/ring_gc_sendAndExit_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/ring_gc_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/sum_recursive_call_ig_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/sum_recursive_call_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/sum_recursive_tail_call_ig_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/sum_recursive_tail_call_test: Skip # Only AOT has lightweight enough isolates to run those tests.
-dart_2/isolates/thread_pool_test: Skip # Only AOT has lightweight enough isolates to run those tests.
[ $hot_reload || $hot_reload_rollback ]
dart/appjit*: SkipByDesign # Cannot reload with URI pointing to app snapshot.
dart/disassemble_determinism_test: SkipSlow # Runs expensive fibonacci(32) computation in 2 subprocesses
-dart/isolates/spawn_function_test: Skip # This test explicitly enables isolate groups (off-by-default atm). It will be enabled once full IG reloading is implemented.
dart/issue_31959_31960_test: SkipSlow
dart/minimal_kernel_test: SkipSlow # gen_kernel is too slow in hot reload testing mode
dart/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow in hot reload testing mode
@@ -475,7 +450,6 @@
dart/stack_overflow_shared_test: SkipSlow # Too slow with --shared-slow-path-triggers-gc flag and not relevant outside precompiled.
dart_2/appjit*: SkipByDesign # Cannot reload with URI pointing to app snapshot.
dart_2/disassemble_determinism_test: SkipSlow # Runs expensive fibonacci(32) computation in 2 subprocesses
-dart_2/isolates/spawn_function_test: Skip # This test explicitly enables isolate groups (off-by-default atm). It will be enabled once full IG reloading is implemented.
dart_2/issue_31959_31960_test: SkipSlow
dart_2/minimal_kernel_test: SkipSlow # gen_kernel is too slow in hot reload testing mode
dart_2/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow in hot reload testing mode
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index d47ec82..dfd02fa 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -3245,25 +3245,6 @@
cache->untag()->filled_entry_count_ = d->Read<int32_t>();
}
}
-
-#if defined(DART_PRECOMPILED_RUNTIME)
- void PostLoad(Deserializer* d, const Array& refs, bool primary) {
- if (FLAG_use_bare_instructions) {
- // By default, every megamorphic call site will load the target
- // [Function] from the hash table and call indirectly via loading the
- // entrypoint from the function.
- //
- // In --use-bare-instruction we reduce the extra indirection via the
- // [Function] object by storing the entry point directly into the hashmap.
- //
- auto& cache = MegamorphicCache::Handle(d->zone());
- for (intptr_t i = start_index_; i < stop_index_; ++i) {
- cache ^= refs.At(i);
- cache.SwitchToBareInstructions();
- }
- }
- }
-#endif // defined(DART_PRECOMPILED_RUNTIME)
};
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -7117,6 +7098,7 @@
buffer.Printf(" %10s", "Cumulative");
buffer.Printf(" %8s", "HeapSize");
buffer.Printf(" %5s", "Cid");
+ buffer.Printf(" %9s", "Canonical");
buffer.AddString("\n");
GrowableArray<SerializationCluster*> clusters_by_size;
for (intptr_t cid = 1; cid < num_cids_; cid++) {
@@ -7183,6 +7165,11 @@
} else {
buffer.Printf(" %5s", "");
}
+ if (cluster->is_canonical()) {
+ buffer.Printf(" %9s", "canonical");
+ } else {
+ buffer.Printf(" %9s", "");
+ }
buffer.AddString("\n");
}
OS::PrintErr("%s", buffer.buffer());
diff --git a/runtime/vm/compiler/stub_code_compiler_arm.cc b/runtime/vm/compiler/stub_code_compiler_arm.cc
index 50f9b49..d0216f6 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm.cc
@@ -3140,20 +3140,13 @@
// proper target for the given name and arguments descriptor. If the
// illegal class id was found, the target is a cache miss handler that can
// be invoked as a normal Dart function.
- const auto target_address = FieldAddress(IP, base + target::kWordSize);
- if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(
- ARGS_DESC_REG,
- FieldAddress(R9, target::CallSiteData::arguments_descriptor_offset()));
- __ Branch(target_address);
- } else {
- __ ldr(R0, target_address);
+ __ ldr(R0, FieldAddress(IP, base + target::kWordSize));
+ if (!(FLAG_precompiled_mode && FLAG_use_bare_instructions)) {
__ ldr(CODE_REG, FieldAddress(R0, target::Function::code_offset()));
- __ ldr(
- ARGS_DESC_REG,
- FieldAddress(R9, target::CallSiteData::arguments_descriptor_offset()));
- __ Branch(FieldAddress(R0, target::Function::entry_point_offset()));
}
+ __ ldr(ARGS_DESC_REG,
+ FieldAddress(R9, target::CallSiteData::arguments_descriptor_offset()));
+ __ Branch(FieldAddress(R0, target::Function::entry_point_offset()));
// Probe failed, check if it is a miss.
__ Bind(&probe_failed);
@@ -3194,14 +3187,17 @@
__ b(&loop);
__ Bind(&found);
- const intptr_t code_offset =
- target::ICData::CodeIndexFor(1) * target::kWordSize;
- const intptr_t entry_offset =
- target::ICData::EntryPointIndexFor(1) * target::kWordSize;
- if (!(FLAG_precompiled_mode && FLAG_use_bare_instructions)) {
- __ ldr(CODE_REG, Address(R8, code_offset));
+ if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
+ const intptr_t entry_offset =
+ target::ICData::EntryPointIndexFor(1) * target::kWordSize;
+ __ LoadCompressed(R0, Address(R8, entry_offset));
+ __ Branch(FieldAddress(R0, target::Function::entry_point_offset()));
+ } else {
+ const intptr_t code_offset =
+ target::ICData::CodeIndexFor(1) * target::kWordSize;
+ __ LoadCompressed(CODE_REG, Address(R8, code_offset));
+ __ Branch(FieldAddress(CODE_REG, target::Code::entry_point_offset()));
}
- __ Branch(Address(R8, entry_offset));
__ Bind(&miss);
__ LoadIsolate(R2);
diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc
index 1e36ee5..d4bc8cf 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc
@@ -3309,19 +3309,12 @@
// proper target for the given name and arguments descriptor. If the
// illegal class id was found, the target is a cache miss handler that can
// be invoked as a normal Dart function.
- const auto target_address =
- FieldAddress(TMP, base + target::kCompressedWordSize, kObjectBytes);
- if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(R1, target_address);
- __ ldr(
- ARGS_DESC_REG,
- FieldAddress(R5, target::CallSiteData::arguments_descriptor_offset()));
- } else {
- __ LoadCompressed(R0, target_address);
- __ ldr(R1, FieldAddress(R0, target::Function::entry_point_offset()));
- __ ldr(
- ARGS_DESC_REG,
- FieldAddress(R5, target::CallSiteData::arguments_descriptor_offset()));
+ __ LoadCompressed(
+ R0, FieldAddress(TMP, base + target::kCompressedWordSize, kObjectBytes));
+ __ ldr(R1, FieldAddress(R0, target::Function::entry_point_offset()));
+ __ ldr(ARGS_DESC_REG,
+ FieldAddress(R5, target::CallSiteData::arguments_descriptor_offset()));
+ if (!(FLAG_precompiled_mode && FLAG_use_bare_instructions)) {
__ LoadCompressed(CODE_REG,
FieldAddress(R0, target::Function::code_offset()));
}
@@ -3374,22 +3367,20 @@
__ b(&loop);
__ Bind(&found);
- const intptr_t code_offset =
- target::ICData::CodeIndexFor(1) * target::kCompressedWordSize;
-#if defined(DART_COMPRESSED_POINTERS)
- __ LoadCompressed(CODE_REG,
- Address(R8, code_offset, Address::Offset, kObjectBytes));
- __ ldr(R1, FieldAddress(CODE_REG, target::Code::entry_point_offset()));
- __ br(R1);
-#else
- const intptr_t entry_offset =
- target::ICData::EntryPointIndexFor(1) * target::kCompressedWordSize;
- __ ldr(R1, Address(R8, entry_offset));
- if (!(FLAG_precompiled_mode && FLAG_use_bare_instructions)) {
- __ ldr(CODE_REG, Address(R8, code_offset));
+ if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
+ const intptr_t entry_offset =
+ target::ICData::EntryPointIndexFor(1) * target::kCompressedWordSize;
+ __ LoadCompressed(R1,
+ Address(R8, entry_offset, Address::Offset, kObjectBytes));
+ __ ldr(R1, FieldAddress(R1, target::Function::entry_point_offset()));
+ } else {
+ const intptr_t code_offset =
+ target::ICData::CodeIndexFor(1) * target::kCompressedWordSize;
+ __ LoadCompressed(CODE_REG,
+ Address(R8, code_offset, Address::Offset, kObjectBytes));
+ __ ldr(R1, FieldAddress(CODE_REG, target::Code::entry_point_offset()));
}
__ br(R1);
-#endif
__ Bind(&miss);
__ LoadIsolate(R2);
diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc
index e776269..6981255 100644
--- a/runtime/vm/compiler/stub_code_compiler_x64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_x64.cc
@@ -3251,21 +3251,16 @@
// proper target for the given name and arguments descriptor. If the
// illegal class id was found, the target is a cache miss handler that can
// be invoked as a normal Dart function.
- const auto target_address = FieldAddress(RDI, RCX, TIMES_COMPRESSED_WORD_SIZE,
- base + target::kCompressedWordSize);
- if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ movq(R10, FieldAddress(
- RBX, target::CallSiteData::arguments_descriptor_offset()));
- __ jmp(target_address);
- } else {
- __ LoadCompressed(RAX, target_address);
- __ movq(R10, FieldAddress(
- RBX, target::CallSiteData::arguments_descriptor_offset()));
- __ movq(RCX, FieldAddress(RAX, target::Function::entry_point_offset()));
+ __ LoadCompressed(RAX, FieldAddress(RDI, RCX, TIMES_COMPRESSED_WORD_SIZE,
+ base + target::kCompressedWordSize));
+ __ movq(R10, FieldAddress(
+ RBX, target::CallSiteData::arguments_descriptor_offset()));
+ __ movq(RCX, FieldAddress(RAX, target::Function::entry_point_offset()));
+ if (!(FLAG_precompiled_mode && FLAG_use_bare_instructions)) {
__ LoadCompressed(CODE_REG,
FieldAddress(RAX, target::Function::code_offset()));
- __ jmp(RCX);
}
+ __ jmp(RCX);
// Probe failed, check if it is a miss.
__ Bind(&probe_failed);
@@ -3316,19 +3311,17 @@
__ jmp(&loop);
__ Bind(&found);
- const intptr_t code_offset =
- target::ICData::CodeIndexFor(1) * target::kCompressedWordSize;
-#if defined(DART_COMPRESSED_POINTERS)
- __ LoadCompressed(CODE_REG, Address(R13, code_offset));
- __ jmp(FieldAddress(CODE_REG, target::Code::entry_point_offset()));
-#else
- const intptr_t entry_offset =
- target::ICData::EntryPointIndexFor(1) * target::kCompressedWordSize;
- if (!(FLAG_precompiled_mode && FLAG_use_bare_instructions)) {
- __ movq(CODE_REG, Address(R13, code_offset));
+ if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
+ const intptr_t entry_offset =
+ target::ICData::EntryPointIndexFor(1) * target::kCompressedWordSize;
+ __ LoadCompressed(RCX, Address(R13, entry_offset));
+ __ jmp(FieldAddress(RCX, target::Function::entry_point_offset()));
+ } else {
+ const intptr_t code_offset =
+ target::ICData::CodeIndexFor(1) * target::kCompressedWordSize;
+ __ LoadCompressed(CODE_REG, Address(R13, code_offset));
+ __ jmp(FieldAddress(CODE_REG, target::Code::entry_point_offset()));
}
- __ jmp(Address(R13, entry_offset));
-#endif
__ Bind(&miss);
__ LoadIsolate(RAX);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index e3e73a8..7c9214a 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -15492,10 +15492,8 @@
// AOT
ASSERT(target.HasCode());
const Code& code = Code::Handle(target.CurrentCode());
- const Smi& entry_point =
- Smi::Handle(Smi::FromAlignedAddress(code.EntryPoint()));
data.SetAt(data_pos + CodeIndexFor(num_args_tested), code);
- data.SetAt(data_pos + EntryPointIndexFor(num_args_tested), entry_point);
+ data.SetAt(data_pos + EntryPointIndexFor(num_args_tested), target);
#endif
}
@@ -17880,16 +17878,7 @@
}
#if defined(DEBUG)
- if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- if (target.IsFunction()) {
- const auto& function = Function::Cast(target);
- const auto& entry_point = Smi::Handle(
- Smi::FromAlignedAddress(Code::EntryPointOf(function.CurrentCode())));
- ASSERT(LookupLocked(class_id) == entry_point.ptr());
- }
- } else {
- ASSERT(LookupLocked(class_id) == target.ptr());
- }
+ ASSERT(LookupLocked(class_id) == target.ptr());
#endif // define(DEBUG)
}
@@ -18005,25 +17994,6 @@
name.ToCString());
}
-void MegamorphicCache::SwitchToBareInstructions() {
- NoSafepointScope no_safepoint_scope;
-
- intptr_t capacity = mask() + 1;
- for (intptr_t i = 0; i < capacity; ++i) {
- const intptr_t target_index = i * kEntryLength + kTargetFunctionIndex;
- CompressedObjectPtr* slot = &Array::DataOf(buckets())[target_index];
- ObjectPtr decompressed_slot = slot->Decompress(buckets()->heap_base());
- const intptr_t cid = decompressed_slot->GetClassIdMayBeSmi();
- if (cid == kFunctionCid) {
- CodePtr code =
- Function::CurrentCodeOf(Function::RawCast(decompressed_slot));
- *slot = Smi::FromAlignedAddress(Code::EntryPointOf(code));
- } else {
- ASSERT(cid == kSmiCid || cid == kNullCid);
- }
- }
-}
-
void SubtypeTestCache::Init() {
cached_array_ = Array::New(kTestEntryLength, Heap::kOld);
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index cd72a01..f6d88ea 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -6968,8 +6968,6 @@
void EnsureContains(const Smi& class_id, const Object& target) const;
ObjectPtr Lookup(const Smi& class_id) const;
- void SwitchToBareInstructions();
-
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(UntaggedMegamorphicCache));
}
@@ -11961,17 +11959,6 @@
const Object& target) {
ASSERT(target.IsNull() || target.IsFunction() || target.IsSmi());
array.SetAt((index * kEntryLength) + kClassIdIndex, class_id);
-#if defined(DART_PRECOMPILED_RUNTIME)
- if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- if (target.IsFunction()) {
- const auto& function = Function::Cast(target);
- const auto& entry_point = Smi::Handle(
- Smi::FromAlignedAddress(Code::EntryPointOf(function.CurrentCode())));
- array.SetAt((index * kEntryLength) + kTargetFunctionIndex, entry_point);
- return;
- }
- }
-#endif // defined(DART_PRECOMPILED_RUNTIME)
array.SetAt((index * kEntryLength) + kTargetFunctionIndex, target);
}
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index affccc9..ca45f4d 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -646,8 +646,8 @@
while (offset < next_field_offset) {
if (unboxed_fields.Get(offset / kCompressedWordSize)) {
- uword* p = reinterpret_cast<uword*>(result->raw_value() -
- kHeapObjectTag + offset);
+ compressed_uword* p = reinterpret_cast<compressed_uword*>(
+ result->raw_value() - kHeapObjectTag + offset);
// Reads 32 bits of the unboxed value at a time
*p = ReadWordWith32BitReads();
} else {
diff --git a/sdk/lib/_internal/vm/lib/bigint_patch.dart b/sdk/lib/_internal/vm/lib/bigint_patch.dart
index dd627df..f040c45 100644
--- a/sdk/lib/_internal/vm/lib/bigint_patch.dart
+++ b/sdk/lib/_internal/vm/lib/bigint_patch.dart
@@ -1657,8 +1657,9 @@
*/
int get bitLength {
if (_used == 0) return 0;
- if (_isNegative) return (~this).bitLength;
- return _digitBits * (_used - 1) + _digits[_used - 1].bitLength;
+ var highBits = _digits[_used - 1];
+ if (_isNegative) highBits -= 1;
+ return _digitBits * (_used - 1) + highBits.bitLength;
}
/**
diff --git a/third_party/devtools/update.sh b/third_party/devtools/update.sh
index ae3aa49..90533c5 100755
--- a/third_party/devtools/update.sh
+++ b/third_party/devtools/update.sh
@@ -38,4 +38,3 @@
-install-mode copy \
-preserve-writable \
-tag git_revision:$1
-
diff --git a/tools/VERSION b/tools/VERSION
index 479459d..2cc3d43 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 306
+PRERELEASE 307
PRERELEASE_PATCH 0
\ No newline at end of file