Version 2.14.0-19.0.dev
Merge commit '2852408881936600ad881cb7ee19342054fabce3' into 'dev'
diff --git a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart b/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
index 78b2d09..6289553 100644
--- a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
@@ -15,7 +15,6 @@
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
-import 'package:analyzer/src/generated/source.dart' show SourceKind;
import 'package:collection/collection.dart';
class EditDartFix
@@ -215,23 +214,16 @@
if (pathsProcessed.contains(path)) continue;
var driver = server.getAnalysisDriver(path);
if (driver != null) {
- switch (await driver.getSourceKind(path)) {
- case SourceKind.PART:
- // Parts will either be found in a library, below, or if the library
- // isn't [isIncluded], will be picked up in the final loop.
- continue;
- case SourceKind.LIBRARY:
- var result = await driver.getResolvedLibrary2(path);
- if (result is ResolvedLibraryResult) {
- for (var unit in result.units!) {
- if (pathsToProcess.contains(unit.path) &&
- !pathsProcessed.contains(unit.path)) {
- await process(unit);
- pathsProcessed.add(unit.path!);
- }
- }
- break;
+ var result = await driver.getResolvedLibrary2(path);
+ if (result is ResolvedLibraryResult) {
+ for (var unit in result.units!) {
+ if (pathsToProcess.contains(unit.path) &&
+ !pathsProcessed.contains(unit.path)) {
+ await process(unit);
+ pathsProcessed.add(unit.path!);
}
+ }
+ break;
}
}
}
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 1447e55..0dca37a 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -36,6 +36,7 @@
show CompletionPerformance;
import 'package:analysis_server/src/services/refactoring/refactoring.dart';
import 'package:analyzer/dart/analysis/context_locator.dart';
+import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
@@ -244,7 +245,8 @@
/// analyzed in one of the analysis drivers to which the file was added,
/// otherwise in the first driver, otherwise `null` is returned.
LineInfo? getLineInfo(String path) {
- return getAnalysisDriver(path)?.getFileSync(path).lineInfo;
+ var result = getAnalysisDriver(path)?.getFileSync2(path);
+ return result is FileResult ? result.lineInfo : null;
}
/// Gets the version of a document known to the server, returning a
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 bf43bf5..b221c46 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
@@ -22,7 +22,6 @@
import 'package:analyzer/instrumentation/service.dart';
import 'package:analyzer/source/error_processor.dart';
import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
@@ -172,10 +171,6 @@
if (!file_paths.isDart(pathContext, path)) {
continue;
}
- var kind = await context.currentSession.getSourceKind(path);
- if (kind != SourceKind.LIBRARY) {
- continue;
- }
var library = await context.currentSession.getResolvedLibrary2(path);
if (library is ResolvedLibraryResult) {
await _fixErrorsInLibrary(library);
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 13fe6b3..9691934 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -17,6 +17,10 @@
Use `AnalysisSession.getParsedLibraryByElement2()` instead.
* Deprecated `AnalysisSession.getParsedUnit()`.
Use `AnalysisSession.getParsedUnit2()` instead.
+* Deprecated `AnalysisSession.getFile()` and `getSourceKind()`.
+ Use `AnalysisSession.getFile2()` instead.
+* Deprecated `AnalysisSession.getUnitElementSignature()`.
+ This method is not used by any known client, and will be removed.
## 1.4.0
* Deprecated `TypeProvider.nonSubtypableClasses`.
diff --git a/pkg/analyzer/lib/dart/analysis/results.dart b/pkg/analyzer/lib/dart/analysis/results.dart
index a79c4af..287c470 100644
--- a/pkg/analyzer/lib/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/dart/analysis/results.dart
@@ -82,7 +82,7 @@
/// parsed file is not required, so [ParsedUnitResult] is not necessary.
///
/// Clients may not extend, implement or mix-in this class.
-abstract class FileResult implements AnalysisResult {
+abstract class FileResult implements SomeFileResult, AnalysisResult {
/// Whether the file is a part.
/// If [state] is not [ResultState.VALID], throws [StateError].
bool get isPart;
@@ -100,6 +100,7 @@
implements
InvalidResult,
SomeErrorsResult,
+ SomeFileResult,
SomeParsedLibraryResult,
SomeParsedUnitResult,
SomeResolvedLibraryResult,
@@ -284,6 +285,15 @@
/// [ErrorsResult] represents a valid result.
abstract class SomeErrorsResult {}
+/// The result of computing some cheap information for a single file, when full
+/// parsed file is not required, so [ParsedUnitResult] is not necessary.
+///
+/// Clients may not extend, implement or mix-in this class.
+///
+/// There are existing implementations of this class.
+/// [FileResult] represents a valid result.
+abstract class SomeFileResult {}
+
/// The result of building the element model for a library.
///
/// Clients may not extend, implement or mix-in this class.
@@ -351,6 +361,7 @@
/// exported by the library. If the signature of a file has not changed, then
/// there have been no changes that would cause any files that depend on it
/// to need to be re-analyzed.
+ @Deprecated('This field is not used by clients and will be removed')
String get signature;
}
diff --git a/pkg/analyzer/lib/dart/analysis/session.dart b/pkg/analyzer/lib/dart/analysis/session.dart
index 8b8db65..2f6aa40 100644
--- a/pkg/analyzer/lib/dart/analysis/session.dart
+++ b/pkg/analyzer/lib/dart/analysis/session.dart
@@ -48,8 +48,13 @@
/// Return information about the file at the given absolute, normalized
/// [path].
+ @Deprecated('Use getFile2() instead')
FileResult getFile(String path);
+ /// Return information about the file at the given absolute, normalized
+ /// [path].
+ SomeFileResult getFile2(String path);
+
/// Return a future that will complete with the library element representing
/// the library with the given [uri].
@Deprecated('Use getLibraryByUri2() instead')
@@ -135,6 +140,7 @@
/// complete with [SourceKind.UNKNOWN].
///
/// TODO(migration): should not be nullable
+ @Deprecated('Use getFile2() instead')
Future<SourceKind?> getSourceKind(String path);
/// Return a future that will complete with information about the results of
@@ -158,6 +164,7 @@
/// exported by the library. If the signature of a file has not changed, then
/// there have been no changes that would cause any files that depend on it to
/// need to be re-analyzed.
+ @Deprecated('This method is not used and will be removed')
Future<String> getUnitElementSignature(String path);
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index fd284cf..37d2981 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -184,11 +184,11 @@
<String, List<Completer<AnalysisDriverUnitIndex>>>{};
/// The mapping from the files for which the unit element key was requested
- /// using [getUnitElementSignature] to the [Completer]s to report the result.
+ /// using `getUnitElementSignature` to the [Completer]s to report the result.
final _unitElementSignatureFiles = <String, List<Completer<String>>>{};
/// The mapping from the files for which the unit element key was requested
- /// using [getUnitElementSignature], and which were found to be parts without
+ /// using `getUnitElementSignature`, and which were found to be parts without
/// known libraries, to the [Completer]s to report the result.
final _unitElementSignatureParts = <String, List<Completer<String>>>{};
@@ -613,8 +613,20 @@
/// Return the [FileResult] for the Dart file with the given [path].
///
/// The [path] must be absolute and normalized.
+ @Deprecated('Use getFileSync2() instead')
FileResult getFileSync(String path) {
_throwIfNotAbsolutePath(path);
+ return getFileSync2(path) as FileResult;
+ }
+
+ /// Return the [FileResult] for the Dart file with the given [path].
+ ///
+ /// The [path] must be absolute and normalized.
+ SomeFileResult getFileSync2(String path) {
+ if (!_isAbsolutePath(path)) {
+ return InvalidPathResult();
+ }
+
FileState file = _fileTracker.getFile(path);
return FileResultImpl(
_currentSession, path, file.uri, file.lineInfo, file.isPart);
@@ -1032,6 +1044,7 @@
/// be analyzed, the [Future] completes with `null`.
///
/// The [path] must be absolute and normalized.
+ @Deprecated('Use getFileSync2() instead')
Future<SourceKind?> getSourceKind(String path) async {
_throwIfNotAbsolutePath(path);
if (file_paths.isDart(resourceProvider.pathContext, path)) {
@@ -1087,6 +1100,7 @@
/// The signature is based the APIs of the files of the library (including
/// the file itself) of the requested file and the transitive closure of files
/// imported and exported by the library.
+ @Deprecated('This method is not used and will be removed')
Future<String> getUnitElementSignature(String path) {
_throwIfNotAbsolutePath(path);
if (!_fsState.hasUri(path)) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/session.dart b/pkg/analyzer/lib/src/dart/analysis/session.dart
index fbc5371..c6cb0f7 100644
--- a/pkg/analyzer/lib/src/dart/analysis/session.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/session.dart
@@ -71,12 +71,19 @@
return _driver.getErrors2(path);
}
+ @Deprecated('Use getFile2() instead')
@override
FileResult getFile(String path) {
_checkConsistency();
return _driver.getFileSync(path);
}
+ @override
+ SomeFileResult getFile2(String path) {
+ _checkConsistency();
+ return _driver.getFileSync2(path);
+ }
+
@Deprecated('Use getLibraryByUri2() instead')
@override
Future<LibraryElement> getLibraryByUri(String uri) async {
@@ -190,6 +197,7 @@
return _driver.getResult2(path);
}
+ @Deprecated('Use getFile2() instead')
@override
Future<SourceKind?> getSourceKind(String path) {
_checkConsistency();
@@ -209,6 +217,7 @@
return _driver.getUnitElement2(path);
}
+ @Deprecated('This method is not used and will be removed')
@override
Future<String> getUnitElementSignature(String path) {
_checkConsistency();
diff --git a/pkg/analyzer/lib/src/dart/analysis/session_helper.dart b/pkg/analyzer/lib/src/dart/analysis/session_helper.dart
index 2b473c1..020af5d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/session_helper.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/session_helper.dart
@@ -70,11 +70,6 @@
return null;
}
- /// Return `true` if the file with the [path] is a part.
- bool isPart(String path) {
- return session.getFile(path).isPart;
- }
-
/// Return a newly resolved, or cached library with the given [path].
Future<ResolvedLibraryResult?> _getResolvedLibrary(String path) async {
var result = _resolvedLibraries[path];
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 87cdde7..1852dbe 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -1356,6 +1356,67 @@
expect(files, isNot(contains(c)));
}
+ test_getFileSync2_changedFile() async {
+ var a = convertPath('/test/lib/a.dart');
+ var b = convertPath('/test/lib/b.dart');
+
+ newFile(a, content: '');
+ newFile(b, content: r'''
+import 'a.dart';
+
+void f(A a) {}
+''');
+
+ // Ensure that [a.dart] library cycle is loaded.
+ // So, `a.dart` is in the library context.
+ await driver.getResultValid(a);
+
+ // Update the file, changing its API signature.
+ // Note that we don't call `changeFile`.
+ newFile(a, content: 'class A {}\n');
+
+ // Get the file.
+ // We have not called `changeFile(a)`, so we should not read the file.
+ // Moreover, doing this will create a new library cycle [a.dart].
+ // Library cycles are compared by their identity, so we would try to
+ // reload linked summary for [a.dart], and crash.
+ expect(driver.getFileSyncValid(a).lineInfo.lineCount, 1);
+
+ // We have not read `a.dart`, so `A` is still not declared.
+ expect((await driver.getResultValid(b)).errors, isNotEmpty);
+
+ // Notify the driver that the file was changed.
+ driver.changeFile(a);
+
+ // So, `class A {}` is declared now.
+ expect(driver.getFileSyncValid(a).lineInfo.lineCount, 2);
+ expect((await driver.getResultValid(b)).errors, isEmpty);
+ }
+
+ test_getFileSync2_library() async {
+ var path = convertPath('/test/lib/a.dart');
+ newFile(path);
+ var file = driver.getFileSyncValid(path);
+ expect(file.path, path);
+ expect(file.uri.toString(), 'package:test/a.dart');
+ expect(file.isPart, isFalse);
+ }
+
+ test_getFileSync2_notAbsolutePath() async {
+ var result = driver.getFileSync2('not_absolute.dart');
+ expect(result, isA<InvalidPathResult>());
+ }
+
+ test_getFileSync2_part() async {
+ var path = convertPath('/test/lib/a.dart');
+ newFile(path, content: 'part of lib;');
+ var file = driver.getFileSyncValid(path);
+ expect(file.path, path);
+ expect(file.uri.toString(), 'package:test/a.dart');
+ expect(file.isPart, isTrue);
+ }
+
+ @deprecated
test_getFileSync_changedFile() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
@@ -1393,6 +1454,7 @@
expect((await driver.getResultValid(b)).errors, isEmpty);
}
+ @deprecated
test_getFileSync_library() async {
var path = convertPath('/test/lib/a.dart');
newFile(path);
@@ -1402,12 +1464,14 @@
expect(file.isPart, isFalse);
}
+ @deprecated
test_getFileSync_notAbsolutePath() async {
expect(() {
driver.getFileSync('not_absolute.dart');
}, throwsArgumentError);
}
+ @deprecated
test_getFileSync_part() async {
var path = convertPath('/test/lib/a.dart');
newFile(path, content: 'part of lib;');
@@ -2089,6 +2153,7 @@
expect(result1.unit!, isNotNull);
}
+ @deprecated
test_getSourceKind_changedFile() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
@@ -2126,6 +2191,7 @@
expect((await driver.getResultValid(b)).errors, isEmpty);
}
+ @deprecated
test_getSourceKind_changeFile() async {
var path = convertPath('/test/lib/test.dart');
expect(await driver.getSourceKind(path), SourceKind.LIBRARY);
@@ -2139,29 +2205,34 @@
expect(await driver.getSourceKind(path), SourceKind.LIBRARY);
}
+ @deprecated
test_getSourceKind_doesNotExist() async {
var path = convertPath('/test/lib/test.dart');
expect(await driver.getSourceKind(path), SourceKind.LIBRARY);
}
+ @deprecated
test_getSourceKind_library() async {
var path = convertPath('/test/lib/test.dart');
newFile(path, content: 'class A {}');
expect(await driver.getSourceKind(path), SourceKind.LIBRARY);
}
+ @deprecated
test_getSourceKind_notAbsolutePath() async {
expect(() async {
await driver.getSourceKind('not_absolute.dart');
}, throwsArgumentError);
}
+ @deprecated
test_getSourceKind_notDartFile() async {
var path = convertPath('/test/lib/test.txt');
newFile(path, content: 'class A {}');
expect(await driver.getSourceKind(path), isNull);
}
+ @deprecated
test_getSourceKind_part() async {
var path = convertPath('/test/lib/test.dart');
newFile(path, content: 'part of lib; class A {}');
@@ -2276,27 +2347,6 @@
expect(signature2, isNot(signature));
}
- test_getUnitElementSignature2() async {
- var a = convertPath('/test/lib/a.dart');
-
- newFile(a, content: 'foo() {}');
-
- String signature = await driver.getUnitElementSignature(a);
- expect(signature, isNotNull);
-
- var unitResult = await driver.getUnitElement2(a);
- unitResult as UnitElementResult;
- expect(unitResult.path, a);
- expect(unitResult.signature, signature);
-
- modifyFile(a, 'bar() {}');
- driver.changeFile(a);
-
- String signature2 = await driver.getUnitElementSignature(a);
- expect(signature2, isNotNull);
- expect(signature2, isNot(signature));
- }
-
test_hasFilesToAnalyze() async {
// No files yet, nothing to analyze.
expect(driver.hasFilesToAnalyze, isFalse);
@@ -3315,6 +3365,7 @@
}
}
+ @deprecated
test_part_getUnitElementSignature() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
@@ -3966,6 +4017,10 @@
}
extension on AnalysisDriver {
+ FileResult getFileSyncValid(String path) {
+ return getFileSync2(path) as FileResult;
+ }
+
Future<ResolvedUnitResult> getResultValid(String path) async {
return await getResult2(path) as ResolvedUnitResult;
}
diff --git a/pkg/analyzer/test/src/dart/analysis/session_test.dart b/pkg/analyzer/test/src/dart/analysis/session_test.dart
index 5af5179..9d9e9a9 100644
--- a/pkg/analyzer/test/src/dart/analysis/session_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/session_test.dart
@@ -270,6 +270,29 @@
expect(errorsResult, isA<InvalidPathResult>());
}
+ test_getFile2_invalidPath_notAbsolute() async {
+ var errorsResult = session.getFile2('not_absolute.dart');
+ expect(errorsResult, isA<InvalidPathResult>());
+ }
+
+ test_getFileSync2_library() async {
+ var path = convertPath('/home/test/lib/a.dart');
+ newFile(path, content: '');
+ var file = session.getFileValid(path);
+ expect(file.path, path);
+ expect(file.uri.toString(), 'package:test/a.dart');
+ expect(file.isPart, isFalse);
+ }
+
+ test_getFileSync2_part() async {
+ var path = convertPath('/home/test/lib/a.dart');
+ newFile(path, content: 'part of lib;');
+ var file = session.getFileValid(path);
+ expect(file.path, path);
+ expect(file.uri.toString(), 'package:test/a.dart');
+ expect(file.isPart, isTrue);
+ }
+
@deprecated
test_getLibraryByUri() async {
newFile(testPath, content: r'''
@@ -942,6 +965,7 @@
expect(unitResult.libraryElement, isNotNull);
}
+ @deprecated
test_getSourceKind() async {
newFile(testPath, content: 'class C {}');
@@ -949,6 +973,7 @@
expect(kind, SourceKind.LIBRARY);
}
+ @deprecated
test_getSourceKind_part() async {
newFile(testPath, content: 'part of "a.dart";');
@@ -984,9 +1009,6 @@
expect(unitResult.path, testPath);
expect(unitResult.uri, Uri.parse('package:test/test.dart'));
expect(unitResult.element.types, hasLength(2));
-
- var signature = await session.getUnitElementSignature(testPath);
- expect(unitResult.signature, signature);
}
test_resourceProvider() async {
@@ -1003,6 +1025,10 @@
return getParsedLibrary2(path) as ParsedLibraryResult;
}
+ FileResult getFileValid(String path) {
+ return getFile2(path) as FileResult;
+ }
+
ParsedUnitResult getParsedUnitValid(String path) {
return getParsedUnit2(path) as ParsedUnitResult;
}
diff --git a/pkg/analyzer/test/src/services/available_declarations_test.dart b/pkg/analyzer/test/src/services/available_declarations_test.dart
index 6ba066f..ec8b732 100644
--- a/pkg/analyzer/test/src/services/available_declarations_test.dart
+++ b/pkg/analyzer/test/src/services/available_declarations_test.dart
@@ -3496,9 +3496,9 @@
newFile(a, content: 'class A {}');
newFile(b, content: 'class B {}');
newFile(c, content: 'class C {}');
- testAnalysisContext.currentSession.getFile(a);
- testAnalysisContext.currentSession.getFile(b);
- testAnalysisContext.currentSession.getFile(c);
+ testAnalysisContext.currentSession.getFile2(a);
+ testAnalysisContext.currentSession.getFile2(b);
+ testAnalysisContext.currentSession.getFile2(c);
var context = tracker.addContext(testAnalysisContext);
await _doAllTrackerWork();
diff --git a/pkg/analyzer_cli/lib/src/error_formatter.dart b/pkg/analyzer_cli/lib/src/error_formatter.dart
index 2301bf0..19fae89 100644
--- a/pkg/analyzer_cli/lib/src/error_formatter.dart
+++ b/pkg/analyzer_cli/lib/src/error_formatter.dart
@@ -312,10 +312,13 @@
for (var message in error.contextMessages) {
var session = result.session.analysisContext;
if (session is DriverBasedAnalysisContext) {
- var lineInfo = session.driver.getFileSync(message.filePath)?.lineInfo;
- var location = lineInfo.getLocation(message.offset);
- contextMessages.add(ContextMessage(message.filePath, message.message,
- location.lineNumber, location.columnNumber));
+ var fileResult = session.driver.getFileSync2(message.filePath);
+ if (fileResult is FileResult) {
+ var lineInfo = fileResult?.lineInfo;
+ var location = lineInfo.getLocation(message.offset);
+ contextMessages.add(ContextMessage(message.filePath, message.message,
+ location.lineNumber, location.columnNumber));
+ }
}
}
diff --git a/pkg/nnbd_migration/lib/migration_cli.dart b/pkg/nnbd_migration/lib/migration_cli.dart
index e90259e..accb1f77 100644
--- a/pkg/nnbd_migration/lib/migration_cli.dart
+++ b/pkg/nnbd_migration/lib/migration_cli.dart
@@ -1050,7 +1050,7 @@
bool get isPreviewServerRunning => _task?.isPreviewServerRunning ?? false;
LineInfo getLineInfo(String path) =>
- context.currentSession.getFile(path).lineInfo;
+ (context.currentSession.getFile2(path) as FileResult).lineInfo;
void prepareToRerun() {
var driver = context.driver;
@@ -1065,25 +1065,16 @@
var pathsProcessed = <String>{};
for (var path in pathsToProcess) {
if (pathsProcessed.contains(path)) continue;
- switch (await driver.getSourceKind(path)) {
- case SourceKind.PART:
- // Parts will either be found in a library, below, or if the library
- // isn't [isIncluded], will be picked up in the final loop.
- continue;
- break;
- case SourceKind.LIBRARY:
- var result = await driver.getResolvedLibrary2(path);
- if (result is ResolvedLibraryResult) {
- for (var unit in result.units) {
- if (!pathsProcessed.contains(unit.path)) {
- await process(unit);
- pathsProcessed.add(unit.path);
- }
- }
+ var result = await driver.getResolvedLibrary2(path);
+ // Parts will either be found in a library, below, or if the library
+ // isn't [isIncluded], will be picked up in the final loop.
+ if (result is ResolvedLibraryResult) {
+ for (var unit in result.units) {
+ if (!pathsProcessed.contains(unit.path)) {
+ await process(unit);
+ pathsProcessed.add(unit.path);
}
- break;
- default:
- break;
+ }
}
}
diff --git a/pkg/nnbd_migration/test/abstract_context.dart b/pkg/nnbd_migration/test/abstract_context.dart
index b5d1783..1eafda1c 100644
--- a/pkg/nnbd_migration/test/abstract_context.dart
+++ b/pkg/nnbd_migration/test/abstract_context.dart
@@ -5,6 +5,7 @@
import 'dart:convert';
import 'package:analyzer/dart/analysis/analysis_context.dart';
+import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/overlay_file_system.dart';
@@ -118,7 +119,8 @@
return _getContext(path).driver;
}
- LineInfo getLineInfo(String path) => session.getFile(path).lineInfo;
+ LineInfo getLineInfo(String path) =>
+ (session.getFile2(path) as FileResult).lineInfo;
void setUp() {
setupResourceProvider();
diff --git a/pkg/nnbd_migration/tool/trial_migration.dart b/pkg/nnbd_migration/tool/trial_migration.dart
index 4c14791..ae67ecc 100644
--- a/pkg/nnbd_migration/tool/trial_migration.dart
+++ b/pkg/nnbd_migration/tool/trial_migration.dart
@@ -65,7 +65,8 @@
context.contextRoot.analyzedFiles().where((s) => s.endsWith('.dart'));
files.addAll(localFiles);
var session = context.currentSession;
- LineInfo getLineInfo(String path) => session.getFile(path).lineInfo;
+ LineInfo getLineInfo(String path) =>
+ (session.getFile2(path) as FileResult).lineInfo;
var migration =
NullabilityMigration(listener, getLineInfo, permissive: true);
for (var file in localFiles) {
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 9d182ed..e429842 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -36,6 +36,15 @@
return classes.Length() == 0;
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+
+bool ClassFinalizer::ProcessPendingClasses() {
+ ASSERT(AllClassesFinalized());
+ return true;
+}
+
+#else
+
// Removes optimized code once we load more classes, since CHA based
// optimizations may have become invalid.
// Only methods which owner classes where subclasses can be invalid.
@@ -220,7 +229,6 @@
return true;
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::VerifyBootstrapClasses() {
if (FLAG_trace_class_finalization) {
OS::PrintErr("VerifyBootstrapClasses START.\n");
@@ -286,7 +294,6 @@
}
IsolateGroup::Current()->heap()->Verify();
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::FinalizeTypeParameters(const Class& cls,
FinalizationKind finalization) {
@@ -310,6 +317,8 @@
}
}
+#endif // defined(DART_PRECOMPILED_RUNTIME)
+
// This function reports a compilation error if the recursive 'type' T being
// finalized is a non-contractive type, i.e. if the induced type set S of P is
// not finite, where P is the instantiation of T with its own type parameters.
@@ -533,7 +542,11 @@
TrailPtr trail) {
ASSERT(arguments.Length() >= cls.NumTypeArguments());
if (!cls.is_type_finalized()) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
FinalizeTypeParameters(cls, kFinalize);
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
AbstractType& super_type = AbstractType::Handle(cls.super_type());
if (!super_type.IsNull()) {
@@ -851,6 +864,8 @@
return signature.ptr();
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
#if defined(TARGET_ARCH_X64)
static bool IsPotentialExactGeneric(const AbstractType& type) {
// TODO(dartbug.com/34170) Investigate supporting this for fields with types
@@ -956,6 +971,7 @@
cls = type.type_class();
}
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::FinalizeTypesInClass(const Class& cls) {
Thread* thread = Thread::Current();
@@ -965,6 +981,9 @@
return;
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
if (cls.is_type_finalized()) {
return;
@@ -1000,8 +1019,10 @@
cls.set_is_type_finalized();
RegisterClassInHierarchy(thread->zone(), cls);
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::RegisterClassInHierarchy(Zone* zone, const Class& cls) {
auto& type = AbstractType::Handle(zone, cls.super_type());
auto& other_cls = Class::Handle(zone);
@@ -1025,6 +1046,7 @@
other_cls.AddDirectImplementor(cls, /* is_mixin = */ i == mixin_index);
}
}
+#endif // defined(DART_PRECOMPILED_RUNTIME)
void ClassFinalizer::FinalizeClass(const Class& cls) {
ASSERT(cls.is_type_finalized());
@@ -1032,6 +1054,9 @@
return;
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
Thread* thread = Thread::Current();
HANDLESCOPE(thread);
@@ -1048,7 +1073,6 @@
}
#endif // defined(SUPPORT_TIMELINE)
-#if !defined(DART_PRECOMPILED_RUNTIME)
// If loading from a kernel, make sure that the class is fully loaded.
ASSERT(cls.IsTopLevel() || (cls.kernel_offset() > 0));
if (!cls.is_loaded()) {
@@ -1057,7 +1081,6 @@
return;
}
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Ensure super class is finalized.
const Class& super = Class::Handle(cls.SuperClass());
@@ -1084,8 +1107,11 @@
if (cls.IsTopLevel()) {
cls.set_is_allocate_finalized();
}
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
ErrorPtr ClassFinalizer::AllocateFinalizeClass(const Class& cls) {
ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
ASSERT(cls.is_finalized());
@@ -1261,6 +1287,8 @@
}
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
void ClassFinalizer::ReportError(const Error& error) {
Report::LongJump(error);
UNREACHABLE();
@@ -1276,6 +1304,8 @@
UNREACHABLE();
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
void ClassFinalizer::VerifyImplicitFieldOffsets() {
#ifdef DEBUG
Thread* thread = Thread::Current();
@@ -1661,9 +1691,6 @@
}
void ClassFinalizer::ClearAllCode(bool including_nonchanging_cids) {
-#ifdef DART_PRECOMPILED_RUNTIME
- UNREACHABLE();
-#else
auto const thread = Thread::Current();
auto const isolate_group = thread->isolate_group();
SafepointWriteRwLocker ml(thread, isolate_group->program_lock());
@@ -1705,7 +1732,8 @@
auto& null_code = Code::Handle(zone);
object_store->set_build_method_extractor_code(null_code);
}
-#endif // !DART_PRECOMPILED_RUNTIME
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
} // namespace dart
diff --git a/runtime/vm/class_finalizer.h b/runtime/vm/class_finalizer.h
index 623bdb5..db2b973 100644
--- a/runtime/vm/class_finalizer.h
+++ b/runtime/vm/class_finalizer.h
@@ -34,11 +34,13 @@
// Return false if we still have classes pending to be finalized.
static bool AllClassesFinalized();
+#if !defined(DART_PRECOMPILED_RUNTIME)
// Useful for sorting classes to make dispatch faster.
static void SortClasses();
static void RemapClassIds(intptr_t* old_to_new_cid);
static void RehashTypes();
static void ClearAllCode(bool including_nonchanging_cids = false);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Return whether processing pending classes (ObjectStore::pending_classes_)
// failed. The function returns true if the processing was successful.
@@ -52,12 +54,16 @@
// is an anonymous top level class).
static void FinalizeTypesInClass(const Class& cls);
+#if !defined(DART_PRECOMPILED_RUNTIME)
// Register class in the lists of direct subclasses and direct implementors.
static void RegisterClassInHierarchy(Zone* zone, const Class& cls);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Ensures members of the class are loaded, class layout is finalized and size
// registered in class table.
static void FinalizeClass(const Class& cls);
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
// Makes class instantiatable and usable by generated code.
static ErrorPtr AllocateFinalizeClass(const Class& cls);
@@ -67,7 +73,6 @@
// Returns Error::null() if there is no loading error.
static ErrorPtr LoadClassMembers(const Class& cls);
-#if !defined(DART_PRECOMPILED_RUNTIME)
// Verify that the classes have been properly prefinalized. This is
// needed during bootstrapping where the classes have been preloaded.
static void VerifyBootstrapClasses();
@@ -81,10 +86,13 @@
FinalizationKind finalization = kCanonicalize,
PendingTypes* pending_types = NULL);
+#if !defined(DART_PRECOMPILED_RUNTIME)
static void AllocateEnumValues(const Class& enum_cls);
static void FinalizeTypeParameters(
const Class& cls,
FinalizationKind finalization = kCanonicalize);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
static intptr_t ExpandAndFinalizeTypeArguments(const AbstractType& type,
PendingTypes* pending_types);
static void FinalizeTypeArguments(const Class& cls,
@@ -94,15 +102,20 @@
TrailPtr trail);
static void CheckRecursiveType(const AbstractType& type,
PendingTypes* pending_types);
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
static void FinalizeMemberTypes(const Class& cls);
static void PrintClassInformation(const Class& cls);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
static void ReportError(const Error& error);
static void ReportError(const char* format, ...) PRINTF_ATTRIBUTE(1, 2);
+#if !defined(DART_PRECOMPILED_RUNTIME)
// Verify implicit offsets recorded in the VM for direct access to fields of
// Dart instances (e.g: _TypedListView, _ByteDataView).
static void VerifyImplicitFieldOffsets();
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
};
} // namespace dart
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 8841d37b..89f9681 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -301,8 +301,10 @@
s->Write<int32_t>(Class::target_type_arguments_field_offset_in_words(cls));
s->Write<int16_t>(cls->untag()->num_type_arguments_);
s->Write<uint16_t>(cls->untag()->num_native_fields_);
- s->WriteTokenPosition(cls->untag()->token_pos_);
- s->WriteTokenPosition(cls->untag()->end_token_pos_);
+ if (s->kind() != Snapshot::kFullAOT) {
+ s->WriteTokenPosition(cls->untag()->token_pos_);
+ s->WriteTokenPosition(cls->untag()->end_token_pos_);
+ }
s->Write<uint32_t>(cls->untag()->state_bits_);
// In AOT, the bitmap of unboxed fields should also be serialized
@@ -395,8 +397,11 @@
#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->num_type_arguments_ = d->Read<int16_t>();
cls->untag()->num_native_fields_ = d->Read<uint16_t>();
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ ASSERT(d->kind() != Snapshot::kFullAOT);
cls->untag()->token_pos_ = d->ReadTokenPosition();
cls->untag()->end_token_pos_ = d->ReadTokenPosition();
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->state_bits_ = d->Read<uint32_t>();
if (FLAG_precompiled_mode) {
@@ -433,8 +438,11 @@
#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->num_type_arguments_ = d->Read<int16_t>();
cls->untag()->num_native_fields_ = d->Read<uint16_t>();
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ ASSERT(d->kind() != Snapshot::kFullAOT);
cls->untag()->token_pos_ = d->ReadTokenPosition();
cls->untag()->end_token_pos_ = d->ReadTokenPosition();
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
cls->untag()->state_bits_ = d->Read<uint32_t>();
table->AllocateIndex(class_id);
diff --git a/runtime/vm/compilation_trace.h b/runtime/vm/compilation_trace.h
index aa4a6b7..14996ec 100644
--- a/runtime/vm/compilation_trace.h
+++ b/runtime/vm/compilation_trace.h
@@ -10,6 +10,8 @@
#include "vm/program_visitor.h"
#include "vm/zone_text_buffer.h"
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
namespace dart {
class CompilationTraceSaver : public FunctionVisitor {
@@ -134,4 +136,6 @@
} // namespace dart
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
#endif // RUNTIME_VM_COMPILATION_TRACE_H_
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 5af8a8b..1337ee3 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -3330,12 +3330,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 52;
+ 48;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 88;
-static constexpr dart::compiler::target::word Class_super_type_offset = 44;
+ 84;
+static constexpr dart::compiler::target::word Class_super_type_offset = 40;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 100;
+ Class_host_type_arguments_field_offset_in_words_offset = 96;
static constexpr dart::compiler::target::word Closure_context_offset = 20;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 12;
@@ -3688,7 +3688,7 @@
static constexpr dart::compiler::target::word Array_header_size = 12;
static constexpr dart::compiler::target::word Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 124;
+static constexpr dart::compiler::target::word Class_InstanceSize = 120;
static constexpr dart::compiler::target::word Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word Code_InstanceSize = 76;
@@ -3860,12 +3860,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 104;
+ 96;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 164;
-static constexpr dart::compiler::target::word Class_super_type_offset = 88;
+ 156;
+static constexpr dart::compiler::target::word Class_super_type_offset = 80;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 176;
+ Class_host_type_arguments_field_offset_in_words_offset = 168;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -4224,7 +4224,7 @@
static constexpr dart::compiler::target::word Array_header_size = 24;
static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 200;
+static constexpr dart::compiler::target::word Class_InstanceSize = 192;
static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word Code_InstanceSize = 144;
@@ -4395,12 +4395,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 52;
+ 48;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 88;
-static constexpr dart::compiler::target::word Class_super_type_offset = 44;
+ 84;
+static constexpr dart::compiler::target::word Class_super_type_offset = 40;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 100;
+ Class_host_type_arguments_field_offset_in_words_offset = 96;
static constexpr dart::compiler::target::word Closure_context_offset = 20;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 12;
@@ -4750,7 +4750,7 @@
static constexpr dart::compiler::target::word Array_header_size = 12;
static constexpr dart::compiler::target::word Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 124;
+static constexpr dart::compiler::target::word Class_InstanceSize = 120;
static constexpr dart::compiler::target::word Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word Code_InstanceSize = 76;
@@ -4922,12 +4922,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 104;
+ 96;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 164;
-static constexpr dart::compiler::target::word Class_super_type_offset = 88;
+ 156;
+static constexpr dart::compiler::target::word Class_super_type_offset = 80;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 176;
+ Class_host_type_arguments_field_offset_in_words_offset = 168;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -5287,7 +5287,7 @@
static constexpr dart::compiler::target::word Array_header_size = 24;
static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word Class_InstanceSize = 200;
+static constexpr dart::compiler::target::word Class_InstanceSize = 192;
static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word Code_InstanceSize = 144;
@@ -5458,12 +5458,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 56;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 92;
-static constexpr dart::compiler::target::word Class_super_type_offset = 48;
+ 88;
+static constexpr dart::compiler::target::word Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 104;
+ Class_host_type_arguments_field_offset_in_words_offset = 100;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -5993,12 +5993,12 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 56;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
- 92;
-static constexpr dart::compiler::target::word Class_super_type_offset = 48;
+ 88;
+static constexpr dart::compiler::target::word Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- Class_host_type_arguments_field_offset_in_words_offset = 104;
+ Class_host_type_arguments_field_offset_in_words_offset = 100;
static constexpr dart::compiler::target::word Closure_context_offset = 40;
static constexpr dart::compiler::target::word
Closure_delayed_type_arguments_offset = 24;
@@ -6536,10 +6536,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 52;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 88;
+ AOT_Class_num_type_arguments_offset = 72;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 100;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 84;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 20;
@@ -6942,7 +6942,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 12;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 108;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 92;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 88;
@@ -7133,10 +7133,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 164;
+ AOT_Class_num_type_arguments_offset = 140;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 152;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -7542,7 +7542,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 160;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -7736,10 +7736,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 164;
+ AOT_Class_num_type_arguments_offset = 140;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 152;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -8146,7 +8146,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 160;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -8337,10 +8337,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 56;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 92;
+ AOT_Class_num_type_arguments_offset = 76;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 88;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -8746,7 +8746,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 96;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -8937,10 +8937,10 @@
static constexpr dart::compiler::target::word
AOT_Class_declaration_type_offset = 56;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 92;
+ AOT_Class_num_type_arguments_offset = 76;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 88;
static constexpr dart::compiler::target::word
AOT_SharedClassTable_class_heap_stats_table_offset = 0;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
@@ -9347,7 +9347,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 96;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
@@ -9537,12 +9537,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
4;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 52;
+ AOT_Class_declaration_type_offset = 48;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 88;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
+ AOT_Class_num_type_arguments_offset = 60;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 40;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 100;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 72;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 20;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 12;
@@ -9938,7 +9938,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 12;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 8;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 108;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 80;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 28;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 64;
@@ -10127,12 +10127,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 104;
+ AOT_Class_declaration_type_offset = 96;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 164;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
+ AOT_Class_num_type_arguments_offset = 116;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 80;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 128;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -10531,7 +10531,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 136;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
@@ -10723,12 +10723,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 104;
+ AOT_Class_declaration_type_offset = 96;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 164;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
+ AOT_Class_num_type_arguments_offset = 116;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 80;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 128;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -11128,7 +11128,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 136;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
@@ -11317,12 +11317,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 56;
+ AOT_Class_declaration_type_offset = 52;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 92;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
+ AOT_Class_num_type_arguments_offset = 64;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 76;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -11721,7 +11721,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 88;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
@@ -11910,12 +11910,12 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 56;
+ AOT_Class_declaration_type_offset = 52;
static constexpr dart::compiler::target::word
- AOT_Class_num_type_arguments_offset = 92;
-static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 48;
+ AOT_Class_num_type_arguments_offset = 64;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
static constexpr dart::compiler::target::word
- AOT_Class_host_type_arguments_field_offset_in_words_offset = 104;
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 76;
static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
static constexpr dart::compiler::target::word
AOT_Closure_delayed_type_arguments_offset = 24;
@@ -12315,7 +12315,7 @@
static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
-static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 112;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 88;
static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 4256646..fb463cf 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2829,8 +2829,8 @@
result ^= raw;
}
Object::VerifyBuiltinVtable<FakeObject>(FakeObject::kClassId);
- result.set_token_pos(TokenPosition::kNoSource);
- result.set_end_token_pos(TokenPosition::kNoSource);
+ NOT_IN_PRECOMPILED(result.set_token_pos(TokenPosition::kNoSource));
+ NOT_IN_PRECOMPILED(result.set_end_token_pos(TokenPosition::kNoSource));
result.set_instance_size(FakeObject::InstanceSize(),
compiler::target::RoundedAllocationSize(
TargetFakeObject::InstanceSize()));
@@ -2865,6 +2865,7 @@
return result.ptr();
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
static void ReportTooManyTypeArguments(const Class& cls) {
Report::MessageF(Report::kError, Script::Handle(cls.script()),
cls.token_pos(), Report::AtLocation,
@@ -2873,8 +2874,12 @@
String::Handle(cls.Name()).ToCString());
UNREACHABLE();
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
void Class::set_num_type_arguments(intptr_t value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
if (!Utils::IsInt(16, value)) {
ReportTooManyTypeArguments(*this);
}
@@ -2884,6 +2889,7 @@
DEBUG_ASSERT(old_value == kUnknownNumTypeArguments || old_value == value);
StoreNonPointer<int16_t, int16_t, std::memory_order_relaxed>(
&untag()->num_type_arguments_, value);
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
void Class::set_num_type_arguments_unsafe(intptr_t value) const {
@@ -3272,10 +3278,15 @@
return num_type_args;
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return 0;
+#else
num_type_args = ComputeNumTypeArguments();
ASSERT(num_type_args != kUnknownNumTypeArguments);
set_num_type_arguments(num_type_args);
return num_type_args;
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
static TypeArgumentsPtr InstantiateTypeArgumentsToBounds(
@@ -3943,6 +3954,15 @@
set_is_finalized();
}
+#if defined(DEBUG)
+static bool IsMutatorOrAtSafepoint() {
+ Thread* thread = Thread::Current();
+ return thread->IsMutatorThread() || thread->IsAtSafepoint();
+}
+#endif
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
class CHACodeArray : public WeakCodeReferences {
public:
explicit CHACodeArray(const Class& cls)
@@ -3976,13 +3996,6 @@
DISALLOW_COPY_AND_ASSIGN(CHACodeArray);
};
-#if defined(DEBUG)
-static bool IsMutatorOrAtSafepoint() {
- Thread* thread = Thread::Current();
- return thread->IsMutatorThread() || thread->IsAtSafepoint();
-}
-#endif
-
void Class::RegisterCHACode(const Code& code) {
if (FLAG_trace_cha) {
THR_Print("RegisterCHACode '%s' depends on class '%s'\n",
@@ -4013,6 +4026,20 @@
DisableCHAOptimizedCode(Class::Handle());
}
+ArrayPtr Class::dependent_code() const {
+ DEBUG_ASSERT(
+ IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
+ return untag()->dependent_code();
+}
+
+void Class::set_dependent_code(const Array& array) const {
+ DEBUG_ASSERT(
+ IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
+ untag()->set_dependent_code(array.ptr());
+}
+
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
bool Class::TraceAllocation(IsolateGroup* isolate_group) const {
#ifndef PRODUCT
auto class_table = isolate_group->shared_class_table();
@@ -4036,18 +4063,6 @@
#endif
}
-ArrayPtr Class::dependent_code() const {
- DEBUG_ASSERT(
- IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
- return untag()->dependent_code();
-}
-
-void Class::set_dependent_code(const Array& array) const {
- DEBUG_ASSERT(
- IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
- untag()->set_dependent_code(array.ptr());
-}
-
// Conventions:
// * For throwing a NSM in a class klass we use its runtime type as receiver,
// i.e., klass.RareType().
@@ -4377,6 +4392,10 @@
if (is_finalized()) {
return Error::null();
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return Error::null();
+#else
SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
if (is_finalized()) {
return Error::null();
@@ -4393,6 +4412,7 @@
}
}
return error.ptr();
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
// Ensure that code outdated by finalized class is cleaned up, new instance of
@@ -4419,7 +4439,11 @@
if (is_allocate_finalized()) {
return Error::null();
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
error ^= ClassFinalizer::AllocateFinalizeClass(*this);
+#endif // defined(DART_PRECOMPILED_RUNTIME)
return error.ptr();
}
@@ -4535,8 +4559,8 @@
// Here kIllegalCid means not-yet-assigned.
Object::VerifyBuiltinVtable<FakeInstance>(index == kIllegalCid ? kInstanceCid
: index);
- result.set_token_pos(TokenPosition::kNoSource);
- result.set_end_token_pos(TokenPosition::kNoSource);
+ NOT_IN_PRECOMPILED(result.set_token_pos(TokenPosition::kNoSource));
+ NOT_IN_PRECOMPILED(result.set_end_token_pos(TokenPosition::kNoSource));
const intptr_t host_instance_size = FakeInstance::InstanceSize();
const intptr_t target_instance_size = compiler::target::RoundedAllocationSize(
TargetFakeInstance::InstanceSize());
@@ -4583,7 +4607,7 @@
result.set_library(lib);
result.set_name(name);
result.set_script(script);
- result.set_token_pos(token_pos);
+ NOT_IN_PRECOMPILED(result.set_token_pos(token_pos));
// The size gets initialized to 0. Once the class gets finalized the class
// finalizer will set the correct size.
@@ -4941,6 +4965,7 @@
untag()->set_script(value.ptr());
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
void Class::set_token_pos(TokenPosition token_pos) const {
ASSERT(!token_pos.IsClassifying());
StoreNonPointer(&untag()->token_pos_, token_pos);
@@ -4950,6 +4975,7 @@
ASSERT(!token_pos.IsClassifying());
StoreNonPointer(&untag()->end_token_pos_, token_pos);
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
int32_t Class::SourceFingerprint() const {
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -5062,6 +5088,8 @@
untag()->set_interfaces(value.ptr());
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
void Class::AddDirectImplementor(const Class& implementor,
bool is_mixin) const {
ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
@@ -5120,6 +5148,8 @@
untag()->set_direct_subclasses(subclasses.ptr());
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
ArrayPtr Class::constants() const {
return untag()->constants();
}
@@ -5167,6 +5197,7 @@
return type.ptr();
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
void Class::set_allocation_stub(const Code& value) const {
// Never clear the stub as it may still be a target, but will be GC-d if
// not referenced.
@@ -5174,8 +5205,12 @@
ASSERT(untag()->allocation_stub() == Code::null());
untag()->set_allocation_stub(value.ptr());
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
void Class::DisableAllocationStub() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
{
const Code& existing_stub = Code::Handle(allocation_stub());
if (existing_stub.IsNull()) {
@@ -5193,6 +5228,7 @@
existing_stub.DisableStubCode();
// Disassociate the existing stub from class.
untag()->set_allocation_stub(Code::null());
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
bool Class::IsDartFunctionClass() const {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index b936691..6657bf0 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1053,10 +1053,29 @@
ScriptPtr script() const { return untag()->script(); }
void set_script(const Script& value) const;
- TokenPosition token_pos() const { return untag()->token_pos_; }
+ TokenPosition token_pos() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return TokenPosition::kNoSource;
+#else
+ return untag()->token_pos_;
+#endif // defined(DART_PRECOMPILED_RUNTIME)
+ }
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
void set_token_pos(TokenPosition value) const;
- TokenPosition end_token_pos() const { return untag()->end_token_pos_; }
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
+ TokenPosition end_token_pos() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return TokenPosition::kNoSource;
+#else
+ return untag()->end_token_pos_;
+#endif // defined(DART_PRECOMPILED_RUNTIME)
+ }
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
void set_end_token_pos(TokenPosition value) const;
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
int32_t SourceFingerprint() const;
@@ -1195,6 +1214,7 @@
}
void set_interfaces(const Array& value) const;
+#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
// Returns the list of classes directly implementing this class.
GrowableObjectArrayPtr direct_implementors() const {
DEBUG_ASSERT(
@@ -1204,9 +1224,14 @@
GrowableObjectArrayPtr direct_implementors_unsafe() const {
return untag()->direct_implementors();
}
+#endif // !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
void set_direct_implementors(const GrowableObjectArray& implementors) const;
void AddDirectImplementor(const Class& subclass, bool is_mixin) const;
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
// Returns the list of classes having this class as direct superclass.
GrowableObjectArrayPtr direct_subclasses() const {
DEBUG_ASSERT(
@@ -1216,8 +1241,12 @@
GrowableObjectArrayPtr direct_subclasses_unsafe() const {
return untag()->direct_subclasses();
}
+#endif // !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
void set_direct_subclasses(const GrowableObjectArray& subclasses) const;
void AddDirectSubclass(const Class& subclass) const;
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Check if this class represents the class of null.
bool IsNullClass() const { return id() == kNullCid; }
@@ -1438,8 +1467,10 @@
StoreNonPointer(&untag()->num_native_fields_, value);
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
CodePtr allocation_stub() const { return untag()->allocation_stub(); }
void set_allocation_stub(const Code& value) const;
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
intptr_t kernel_offset() const {
#if defined(DART_PRECOMPILED_RUNTIME)
@@ -1539,6 +1570,7 @@
static ClassPtr NewPointerClass(intptr_t class_id,
IsolateGroup* isolate_group);
+#if !defined(DART_PRECOMPILED_RUNTIME)
// Register code that has used CHA for optimization.
// TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class,
// leaf method, ...).
@@ -1555,6 +1587,7 @@
// are finalized.
ArrayPtr dependent_code() const;
void set_dependent_code(const Array& array) const;
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
bool TraceAllocation(IsolateGroup* isolate_group) const;
void SetTraceAllocation(bool trace_allocation) const;
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
index c5a7965..4bb663a 100644
--- a/runtime/vm/program_visitor.cc
+++ b/runtime/vm/program_visitor.cc
@@ -2,6 +2,8 @@
// 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.
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
#include "vm/program_visitor.h"
#include "vm/closure_functions_cache.h"
@@ -289,7 +291,6 @@
walker.VisitWorklist();
}
-#if !defined(DART_PRECOMPILED_RUNTIME)
// A base class for deduplication of objects. T is the type of canonical objects
// being stored, whereas S is a trait appropriate for a DirectChainedHashMap
// based set containing those canonical objects.
@@ -1349,10 +1350,8 @@
DedupInstructionsVisitor visitor(zone);
WalkProgram(zone, isolate_group, &visitor);
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
void ProgramVisitor::Dedup(Thread* thread) {
-#if !defined(DART_PRECOMPILED_RUNTIME)
auto const isolate_group = thread->isolate_group();
StackZone stack_zone(thread);
HANDLESCOPE(thread);
@@ -1394,7 +1393,6 @@
DedupInstructions(zone, isolate_group);
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
}
#if defined(DART_PRECOMPILER)
@@ -1560,6 +1558,8 @@
return visitor.hash();
}
-#endif // defined(DART_PRECOMPILED_RUNTIME)
+#endif // defined(DART_PRECOMPILER)
} // namespace dart
+
+#endif // defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/program_visitor.h b/runtime/vm/program_visitor.h
index b310625..fa57326 100644
--- a/runtime/vm/program_visitor.h
+++ b/runtime/vm/program_visitor.h
@@ -5,6 +5,8 @@
#ifndef RUNTIME_VM_PROGRAM_VISITOR_H_
#define RUNTIME_VM_PROGRAM_VISITOR_H_
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
#include "vm/allocation.h"
namespace dart {
@@ -104,7 +106,6 @@
#endif
private:
-#if !defined(DART_PRECOMPILED_RUNTIME)
static void BindStaticCalls(Zone* zone, IsolateGroup* isolate_group);
static void ShareMegamorphicBuckets(Zone* zone, IsolateGroup* isolate_group);
static void NormalizeAndDedupCompressedStackMaps(Zone* zone,
@@ -119,9 +120,10 @@
static void DedupCodeSourceMaps(Zone* zone, IsolateGroup* isolate_group);
static void DedupLists(Zone* zone, IsolateGroup* isolate_group);
static void DedupInstructions(Zone* zone, IsolateGroup* isolate_group);
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
};
} // namespace dart
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
#endif // RUNTIME_VM_PROGRAM_VISITOR_H_
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 7753a7a..308284a 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -905,7 +905,7 @@
VISIT_FROM(CompressedObjectPtr, name)
COMPRESSED_POINTER_FIELD(StringPtr, name)
- COMPRESSED_POINTER_FIELD(StringPtr, user_name)
+ NOT_IN_PRODUCT(COMPRESSED_POINTER_FIELD(StringPtr, user_name))
COMPRESSED_POINTER_FIELD(ArrayPtr, functions)
COMPRESSED_POINTER_FIELD(ArrayPtr, functions_hash_table)
COMPRESSED_POINTER_FIELD(ArrayPtr, fields)
@@ -922,26 +922,49 @@
COMPRESSED_POINTER_FIELD(TypePtr, declaration_type)
// Cache for dispatcher functions.
COMPRESSED_POINTER_FIELD(ArrayPtr, invocation_dispatcher_cache)
- // Stub code for allocation of instances.
- COMPRESSED_POINTER_FIELD(CodePtr, allocation_stub)
+
+#if !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
// Array of Class.
COMPRESSED_POINTER_FIELD(GrowableObjectArrayPtr, direct_implementors)
// Array of Class.
COMPRESSED_POINTER_FIELD(GrowableObjectArrayPtr, direct_subclasses)
+#endif // !defined(PRODUCT) || !defined(DART_PRECOMPILED_RUNTIME)
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ // Stub code for allocation of instances.
+ COMPRESSED_POINTER_FIELD(CodePtr, allocation_stub)
// CHA optimized codes.
COMPRESSED_POINTER_FIELD(ArrayPtr, dependent_code)
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
+#if defined(DART_PRECOMPILED_RUNTIME)
+#if defined(PRODUCT)
+ VISIT_TO(CompressedObjectPtr, invocation_dispatcher_cache)
+#else
+ VISIT_TO(CompressedObjectPtr, direct_subclasses)
+#endif // defined(PRODUCT)
+#else
VISIT_TO(CompressedObjectPtr, dependent_code)
+#endif // defined(DART_PRECOMPILED_RUNTIME)
+
CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
#if defined(PRODUCT)
- return reinterpret_cast<CompressedObjectPtr*>(&allocation_stub_);
-#endif
+ return reinterpret_cast<CompressedObjectPtr*>(
+ &invocation_dispatcher_cache_);
+#else
+ return reinterpret_cast<CompressedObjectPtr*>(&direct_subclasses_);
+#endif // defined(PRODUCT)
case Snapshot::kFull:
case Snapshot::kFullCore:
- return reinterpret_cast<CompressedObjectPtr*>(&direct_subclasses_);
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ return reinterpret_cast<CompressedObjectPtr*>(&allocation_stub_);
+#endif
case Snapshot::kFullJIT:
+#if !defined(DART_PRECOMPILED_RUNTIME)
return reinterpret_cast<CompressedObjectPtr*>(&dependent_code_);
+#endif
case Snapshot::kMessage:
case Snapshot::kNone:
case Snapshot::kInvalid:
@@ -951,8 +974,8 @@
return NULL;
}
- TokenPosition token_pos_;
- TokenPosition end_token_pos_;
+ NOT_IN_PRECOMPILED(TokenPosition token_pos_);
+ NOT_IN_PRECOMPILED(TokenPosition end_token_pos_);
classid_t id_; // Class Id, also index in the class table.
int16_t num_type_arguments_; // Number of type arguments in flattened vector.
@@ -977,9 +1000,7 @@
// Offset of the next instance field (target).
int32_t target_next_field_offset_in_words_;
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-#if !defined(DART_PRECOMPILED_RUNTIME)
uint32_t kernel_offset_;
#endif // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc
index 7329337..faea10f 100644
--- a/runtime/vm/raw_object_fields.cc
+++ b/runtime/vm/raw_object_fields.cc
@@ -10,7 +10,6 @@
#define COMMON_CLASSES_AND_FIELDS(F) \
F(Class, name_) \
- F(Class, user_name_) \
F(Class, functions_) \
F(Class, functions_hash_table_) \
F(Class, fields_) \
@@ -23,10 +22,6 @@
F(Class, constants_) \
F(Class, declaration_type_) \
F(Class, invocation_dispatcher_cache_) \
- F(Class, allocation_stub_) \
- F(Class, direct_implementors_) \
- F(Class, direct_subclasses_) \
- F(Class, dependent_code_) \
F(PatchClass, patched_class_) \
F(PatchClass, origin_class_) \
F(PatchClass, script_) \
@@ -197,15 +192,24 @@
#define AOT_CLASSES_AND_FIELDS(F)
+#define AOT_NON_PRODUCT_CLASSES_AND_FIELDS(F) \
+ F(Class, direct_implementors_) \
+ F(Class, direct_subclasses_)
+
#define JIT_CLASSES_AND_FIELDS(F) \
+ F(Class, allocation_stub_) \
+ F(Class, dependent_code_) \
+ F(Class, direct_implementors_) \
+ F(Class, direct_subclasses_) \
F(Code, active_instructions_) \
F(Code, deopt_info_array_) \
F(Code, static_calls_target_table_) \
F(ICData, receivers_static_type_) \
F(Function, unoptimized_code_) \
- F(Field, type_test_cache_) \
+ F(Field, type_test_cache_)
#define NON_PRODUCT_CLASSES_AND_FIELDS(F) \
+ F(Class, user_name_) \
F(ReceivePort, debug_name_) \
F(ReceivePort, allocation_location_)
@@ -240,6 +244,9 @@
#if defined(DART_PRECOMPILED_RUNTIME)
AOT_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY)
+#if !defined(PRODUCT)
+ AOT_NON_PRODUCT_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY)
+#endif
#else
JIT_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY)
#endif
diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc
index a78d1b0..0afa895 100644
--- a/runtime/vm/stub_code.cc
+++ b/runtime/vm/stub_code.cc
@@ -162,7 +162,6 @@
}
return static_calls_table.ptr();
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
CodePtr StubCode::GetAllocationStubForClass(const Class& cls) {
Thread* thread = Thread::Current();
@@ -179,7 +178,6 @@
return object_store->allocate_unhandled_exception_stub();
}
Code& stub = Code::Handle(zone, cls.allocation_stub());
-#if !defined(DART_PRECOMPILED_RUNTIME)
if (stub.IsNull()) {
compiler::ObjectPoolBuilder object_pool_builder;
Precompiler* precompiler = Precompiler::Instance();
@@ -247,7 +245,6 @@
}
#endif // !PRODUCT
}
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
return stub.ptr();
}
@@ -286,6 +283,7 @@
UNREACHABLE();
return Code::null();
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
#if !defined(TARGET_ARCH_IA32)
CodePtr StubCode::GetBuildMethodExtractorStub(
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index a946cd5..6dcedc5 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -61,8 +61,10 @@
VM_STUB_CODE_LIST(STUB_CODE_ACCESSOR);
#undef STUB_CODE_ACCESSOR
+#if !defined(DART_PRECOMPILED_RUNTIME)
static CodePtr GetAllocationStubForClass(const Class& cls);
static CodePtr GetAllocationStubForTypedData(classid_t class_id);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
#if !defined(TARGET_ARCH_IA32)
static CodePtr GetBuildMethodExtractorStub(compiler::ObjectPoolBuilder* pool);
diff --git a/tools/VERSION b/tools/VERSION
index 5392156..ca6b26c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 18
+PRERELEASE 19
PRERELEASE_PATCH 0
\ No newline at end of file