Version 2.13.0-0.0.dev
Merge commit '6ce8d74761b49ac545e6a6b0461dc2062d79c1e3' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index 70cfbb2..2b29fe4 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2021-01-16T20:34:15.774260",
+ "generated": "2021-02-04T09:42:25.936196",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -94,7 +94,7 @@
"name": "analyzer_plugin",
"rootUri": "../pkg/analyzer_plugin",
"packageUri": "lib/",
- "languageVersion": "2.3"
+ "languageVersion": "2.9"
},
{
"name": "analyzer_utilities",
@@ -117,7 +117,8 @@
{
"name": "async_helper",
"rootUri": "../pkg/async_helper",
- "packageUri": "lib/"
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
},
{
"name": "bazel_worker",
@@ -177,19 +178,19 @@
"name": "convert",
"rootUri": "../third_party/pkg/convert",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "crypto",
"rootUri": "../third_party/pkg/crypto",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "csslib",
"rootUri": "../third_party/pkg/csslib",
"packageUri": "lib/",
- "languageVersion": "2.11"
+ "languageVersion": "2.12"
},
{
"name": "dart2js_info",
@@ -254,7 +255,8 @@
{
"name": "expect",
"rootUri": "../pkg/expect",
- "packageUri": "lib/"
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
},
{
"name": "ffi",
@@ -269,6 +271,12 @@
"languageVersion": "2.12"
},
{
+ "name": "file_testing",
+ "rootUri": "../third_party/pkg/file/packages/file_testing",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
"name": "fixnum",
"rootUri": "../third_party/pkg/fixnum",
"packageUri": "lib/",
@@ -307,7 +315,7 @@
"name": "http",
"rootUri": "../third_party/pkg/http",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "http_io",
@@ -349,7 +357,7 @@
"name": "js",
"rootUri": "../pkg/js",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "js_ast",
@@ -390,7 +398,7 @@
"name": "logging",
"rootUri": "../third_party/pkg/logging",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "markdown",
@@ -408,7 +416,7 @@
"name": "meta",
"rootUri": "../pkg/meta",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "mime",
@@ -456,7 +464,7 @@
"name": "observatory",
"rootUri": "../runtime/observatory",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "observatory_2",
@@ -495,13 +503,13 @@
"name": "pedantic",
"rootUri": "../third_party/pkg/pedantic",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "pool",
"rootUri": "../third_party/pkg/pool",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "protobuf",
@@ -536,7 +544,8 @@
{
"name": "sdk_library_metadata",
"rootUri": "../sdk/lib/_internal/sdk_library_metadata",
- "packageUri": "lib/"
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
},
{
"name": "shelf",
@@ -560,7 +569,7 @@
"name": "shelf_static",
"rootUri": "../third_party/pkg/shelf_static",
"packageUri": "lib/",
- "languageVersion": "2.0"
+ "languageVersion": "2.3"
},
{
"name": "shelf_web_socket",
@@ -590,7 +599,7 @@
"name": "source_span",
"rootUri": "../third_party/pkg/source_span",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "sourcemap_testing",
@@ -608,13 +617,13 @@
"name": "stack_trace",
"rootUri": "../third_party/pkg/stack_trace",
"packageUri": "lib/",
- "languageVersion": "2.10"
+ "languageVersion": "2.12"
},
{
"name": "stagehand",
"rootUri": "../third_party/pkg/stagehand",
"packageUri": "lib/",
- "languageVersion": "2.8"
+ "languageVersion": "2.10"
},
{
"name": "status_file",
@@ -758,7 +767,7 @@
"name": "web_socket_channel",
"rootUri": "../third_party/pkg/web_socket_channel",
"packageUri": "lib/",
- "languageVersion": "2.0"
+ "languageVersion": "2.10"
},
{
"name": "webdriver",
@@ -773,4 +782,4 @@
"languageVersion": "2.12"
}
]
-}
+}
\ No newline at end of file
diff --git a/DEPS b/DEPS
index d1a47cc..9167b6a 100644
--- a/DEPS
+++ b/DEPS
@@ -71,7 +71,7 @@
"args_rev": "2c6a221f45e4e0ef447b5d09101bf8a52e1ccd36",
"async_rev": "695b3ac280f107c84adf7488743abfdfaaeea68f",
"bazel_worker_rev": "060c55a933d39798681a4f533b161b81dc48d77e",
- "benchmark_harness_rev": "ec6b646f5443faa871e126ac1ba248c94ca06257",
+ "benchmark_harness_rev": "c546dbd9f639f75cd2f75de8df2eb9f8ea15e8e7",
"boolean_selector_rev": "665e6921ab246569420376f827bff4585dff0b14",
"boringssl_gen_rev": "aaac86738c4f2d1bdf00f54d197f50f247ffee04",
"boringssl_rev" : "4dfd5af70191b068aebe567b8e29ce108cee85ce",
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 278145e..8c95cab 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -8,6 +8,7 @@
* Added `AnalysisContext.sdkRoot`.
* Removed `NullSafetyUnderstandingFlag`.
* Removed `functionTypeAliasElement` from `TypeSystem.instantiateToBounds2`.
+* Added `Annotation.typeArguments` in preparation for supporting #44838.
## 0.41.1
* Updated `PackageBuildWorkspace` that supports `package:build` to stop
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 471b883..80c8339 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -88,7 +88,12 @@
/// annotation*
///
/// annotation ::=
-/// '@' [Identifier] ('.' [SimpleIdentifier])? [ArgumentList]?
+/// '@' metadatum
+///
+/// metadatum ::=
+/// [Identifier]
+/// | qualifiedName
+/// | constructorDesignation argumentPart
///
/// Clients may not extend, implement or mix-in this class.
abstract class Annotation implements AstNode {
@@ -146,6 +151,14 @@
/// Set the period before the constructor name to the given [token].
set period(Token? token);
+
+ /// Returns the type arguments to the constructor being invoked, or `null` if
+ /// (a) this annotation is not the invocation of a constructor or (b) this
+ /// annotation does not specify type arguments explicitly.
+ ///
+ /// Note that type arguments are only valid if [Feature.generic_metadata] is
+ /// enabled.
+ TypeArgumentList? get typeArguments;
}
/// A list of arguments in the invocation of an executable element (that is, a
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index 55a558c..a73af79 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -20,8 +20,16 @@
/// [constructorName] can be `null` if the annotation is not referencing a
/// named constructor. The [arguments] can be `null` if the annotation is not
/// referencing a constructor.
- Annotation annotation(Token atSign, Identifier name, Token? period,
- SimpleIdentifier? constructorName, ArgumentList? arguments);
+ ///
+ /// Note that type arguments are only valid if [Feature.generic_metadata] is
+ /// enabled.
+ Annotation annotation(
+ {required Token atSign,
+ required Identifier name,
+ TypeArgumentList? typeArguments,
+ Token? period,
+ SimpleIdentifier? constructorName,
+ ArgumentList? arguments});
/// Returns a newly created list of arguments. The list of [arguments] can
/// be `null` if there are no arguments.
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index 8e3687f..030cecb 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -8,7 +8,7 @@
/// The current version of the Dart language (or, for non-stable releases, the
/// version of the language currently in the process of being developed).
-const _currentVersion = '2.12.0';
+const _currentVersion = '2.13.0';
/// A map containing information about all known experimental flags.
final _knownFeatures = <String, ExperimentalFeature>{
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 807f627..ed65241 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -180,6 +180,14 @@
/// the name of the field that is being referenced.
late IdentifierImpl _name;
+ /// The type arguments to the constructor being invoked, or `null` if (a) this
+ /// annotation is not the invocation of a constructor or (b) this annotation
+ /// does not specify type arguments explicitly.
+ ///
+ /// Note that type arguments are only valid if [Feature.generic_metadata] is
+ /// enabled.
+ TypeArgumentListImpl? _typeArguments;
+
/// The period before the constructor name, or `null` if this annotation is
/// not the invocation of a named constructor.
@override
@@ -206,9 +214,18 @@
/// [constructorName] can be `null` if the annotation is not referencing a
/// named constructor. The [arguments] can be `null` if the annotation is not
/// referencing a constructor.
- AnnotationImpl(this.atSign, IdentifierImpl name, this.period,
- SimpleIdentifierImpl? constructorName, ArgumentListImpl? arguments) {
+ ///
+ /// Note that type arguments are only valid if [Feature.generic_metadata] is
+ /// enabled.
+ AnnotationImpl(
+ this.atSign,
+ IdentifierImpl name,
+ TypeArgumentListImpl? typeArguments,
+ this.period,
+ SimpleIdentifierImpl? constructorName,
+ ArgumentListImpl? arguments) {
_name = _becomeParentOf(name)!;
+ _typeArguments = _becomeParentOf(typeArguments);
_constructorName = _becomeParentOf(constructorName);
_arguments = _becomeParentOf(arguments);
}
@@ -228,6 +245,7 @@
Iterable<SyntacticEntity> get childEntities => ChildEntities()
..add(atSign)
..add(_name)
+ ..add(_typeArguments)
..add(period)
..add(_constructorName)
..add(_arguments);
@@ -277,11 +295,21 @@
AstNode get parent => super.parent!;
@override
+ TypeArgumentList? get typeArguments => _typeArguments;
+
+ /// Sets the type arguments to the constructor being invoked to the given
+ /// [typeArguments].
+ set typeArguments(TypeArgumentList? typeArguments) {
+ _typeArguments = _becomeParentOf(typeArguments as TypeArgumentListImpl?);
+ }
+
+ @override
E? accept<E>(AstVisitor<E> visitor) => visitor.visitAnnotation(this);
@override
void visitChildren(AstVisitor visitor) {
_name.accept(visitor);
+ _typeArguments?.accept(visitor);
_constructorName?.accept(visitor);
_arguments?.accept(visitor);
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index 63e7e6a..b442314 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -17,11 +17,17 @@
AdjacentStringsImpl(strings);
@override
- Annotation annotation(Token atSign, Identifier name, Token? period,
- SimpleIdentifier? constructorName, ArgumentList? arguments) =>
+ Annotation annotation(
+ {required Token atSign,
+ required Identifier name,
+ TypeArgumentList? typeArguments,
+ Token? period,
+ SimpleIdentifier? constructorName,
+ ArgumentList? arguments}) =>
AnnotationImpl(
atSign,
name as IdentifierImpl,
+ typeArguments as TypeArgumentListImpl?,
period,
constructorName as SimpleIdentifierImpl?,
arguments as ArgumentListImpl?);
diff --git a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
index 24c111f..199a37f 100644
--- a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
@@ -136,6 +136,7 @@
void visitAnnotation(Annotation node) {
sink.write('@');
safelyVisitNode(node.name);
+ safelyVisitNode(node.typeArguments);
safelyVisitNodeWithPrefix(".", node.constructorName);
safelyVisitNode(node.arguments);
}
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 3f388e56b..d837988 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -113,11 +113,12 @@
@override
Annotation visitAnnotation(Annotation node) => astFactory.annotation(
- cloneToken(node.atSign),
- cloneNode(node.name),
- cloneNullableToken(node.period),
- cloneNullableNode(node.constructorName),
- cloneNullableNode(node.arguments));
+ atSign: cloneToken(node.atSign),
+ name: cloneNode(node.name),
+ typeArguments: cloneNullableNode(node.typeArguments),
+ period: cloneNullableToken(node.period),
+ constructorName: cloneNullableNode(node.constructorName),
+ arguments: cloneNullableNode(node.arguments));
@override
ArgumentList visitArgumentList(ArgumentList node) => astFactory.argumentList(
@@ -1214,6 +1215,7 @@
Annotation other = _other as Annotation;
return isEqualTokens(node.atSign, other.atSign) &&
isEqualNodes(node.name, other.name) &&
+ isEqualNodes(node.typeArguments, other.typeArguments) &&
isEqualTokens(node.period, other.period) &&
isEqualNodes(node.constructorName, other.constructorName) &&
isEqualNodes(node.arguments, other.arguments);
@@ -2657,6 +2659,9 @@
if (identical(node.arguments, _oldNode)) {
node.arguments = _newNode as ArgumentList;
return true;
+ } else if (identical(node.typeArguments, _oldNode)) {
+ (node as AnnotationImpl).typeArguments = _newNode as TypeArgumentList?;
+ return true;
} else if (identical(node.constructorName, _oldNode)) {
node.constructorName = _newNode as SimpleIdentifier;
return true;
@@ -4013,6 +4018,7 @@
if (_and(
_isEqualTokens(node.atSign, toNode.atSign),
_isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.typeArguments, toNode.typeArguments),
_isEqualTokens(node.period, toNode.period),
_isEqualNodes(node.constructorName, toNode.constructorName),
_isEqualNodes(node.arguments, toNode.arguments))) {
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 426cf7b..4c4dfb7 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1833,8 +1833,12 @@
periodBeforeName != null ? pop() as SimpleIdentifier : null;
pop(); // Type arguments, not allowed.
var name = pop() as Identifier;
- push(ast.annotation(atSign, name, periodBeforeName, constructorName,
- invocation?.argumentList));
+ push(ast.annotation(
+ atSign: atSign,
+ name: name,
+ period: periodBeforeName,
+ constructorName: constructorName,
+ arguments: invocation?.argumentList));
}
@override
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index d2f99c2..2815129 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -31,18 +31,20 @@
astFactory.adjacentStrings(strings);
static Annotation annotation(Identifier name) => astFactory.annotation(
- TokenFactory.tokenFromType(TokenType.AT), name, null, null, null);
+ atSign: TokenFactory.tokenFromType(TokenType.AT), name: name);
static Annotation annotation2(Identifier name,
- SimpleIdentifier? constructorName, ArgumentList arguments) =>
+ SimpleIdentifier? constructorName, ArgumentList arguments,
+ {TypeArgumentList? typeArguments}) =>
astFactory.annotation(
- TokenFactory.tokenFromType(TokenType.AT),
- name,
- constructorName == null
+ atSign: TokenFactory.tokenFromType(TokenType.AT),
+ name: name,
+ typeArguments: typeArguments,
+ period: constructorName == null
? null
: TokenFactory.tokenFromType(TokenType.PERIOD),
- constructorName,
- arguments);
+ constructorName: constructorName,
+ arguments: arguments);
static ArgumentList argumentList([List<Expression> arguments = const []]) =>
astFactory.argumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
index af79a1f..56f70a9 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -262,11 +262,11 @@
var constructorName = _readOptionalNode() as SimpleIdentifier?;
var arguments = _readOptionalNode() as ArgumentList?;
return astFactory.annotation(
- Tokens.AT,
- name,
- Tokens.PERIOD,
- constructorName,
- arguments,
+ atSign: Tokens.AT,
+ name: name,
+ period: Tokens.PERIOD,
+ constructorName: constructorName,
+ arguments: arguments,
);
}
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index 9f59914..f518e33 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -1372,6 +1372,12 @@
SimpleIdentifier? get(Annotation node) => node.constructorName;
}
+class Getter_NodeReplacerTest_test_annotation_4
+ implements NodeReplacerTest_Getter<Annotation, TypeArgumentList> {
+ @override
+ TypeArgumentList? get(Annotation node) => node.typeArguments;
+}
+
class Getter_NodeReplacerTest_test_asExpression
implements NodeReplacerTest_Getter<AsExpression, TypeAnnotation> {
@override
@@ -2627,6 +2633,18 @@
_assertReplace(node, Getter_NodeReplacerTest_test_annotation_2());
}
+ void test_annotation_generic() {
+ Annotation node = AstTestFactory.annotation2(
+ AstTestFactory.identifier3("C"),
+ AstTestFactory.identifier3("c"),
+ AstTestFactory.argumentList([AstTestFactory.integer(0)]),
+ typeArguments:
+ AstTestFactory.typeArgumentList2([AstTestFactory.typeName4('T')]));
+ _assertReplace(node, Getter_NodeReplacerTest_test_annotation());
+ _assertReplace(node, Getter_NodeReplacerTest_test_annotation_3());
+ _assertReplace(node, Getter_NodeReplacerTest_test_annotation_2());
+ }
+
void test_argumentList() {
ArgumentList node =
AstTestFactory.argumentList([AstTestFactory.integer(0)]);
diff --git a/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart b/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart
index bdcdd67..48e9a27 100644
--- a/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart
@@ -41,6 +41,15 @@
AstTestFactory.identifier3("c"), AstTestFactory.argumentList()));
}
+ void test_visitAnnotation_constructor_generic() {
+ _assertSource(
+ "@A<T>.c()",
+ AstTestFactory.annotation2(AstTestFactory.identifier3("A"),
+ AstTestFactory.identifier3("c"), AstTestFactory.argumentList(),
+ typeArguments: AstTestFactory.typeArgumentList2(
+ [AstTestFactory.typeName4('T')])));
+ }
+
void test_visitArgumentList() {
_assertSource(
"(a, b)",
diff --git a/pkg/analyzer/test/src/dart/ast/utilities_test.dart b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
index acca07b..1fd52fa 100644
--- a/pkg/analyzer/test/src/dart/ast/utilities_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
@@ -190,6 +190,37 @@
expect(toNode.element, same(element));
}
+ void test_visitAnnotation_generic() {
+ var annotationClassName = "A";
+ var annotationConstructorName = "named";
+ var argumentName = "x";
+ var fromNode = AstTestFactory.annotation2(
+ AstTestFactory.identifier3(annotationClassName),
+ AstTestFactory.identifier3(annotationConstructorName),
+ AstTestFactory.argumentList(
+ [AstTestFactory.identifier3(argumentName)])) as AnnotationImpl;
+ var elementA = ElementFactory.classElement2(annotationClassName, ['T']);
+ var element = ElementFactory.constructorElement(
+ elementA, annotationConstructorName, true, [typeProvider.dynamicType]);
+ fromNode.element = element;
+ var typeArgumentName = 'U';
+ var elementU = ElementFactory.classElement2(typeArgumentName);
+ fromNode.typeArguments =
+ AstTestFactory.typeArgumentList2([AstTestFactory.typeName(elementU)]);
+ var toNode = AstTestFactory.annotation2(
+ AstTestFactory.identifier3(annotationClassName),
+ AstTestFactory.identifier3(annotationConstructorName),
+ AstTestFactory.argumentList(
+ [AstTestFactory.identifier3(argumentName)])) as AnnotationImpl;
+ toNode.typeArguments = AstTestFactory.typeArgumentList2(
+ [AstTestFactory.typeName4(typeArgumentName)]);
+ ResolutionCopier.copyResolutionData(fromNode, toNode);
+ expect(toNode.element, same(element));
+ expect(
+ (toNode.typeArguments!.arguments.single as TypeName).name.staticElement,
+ same(elementU));
+ }
+
void test_visitAsExpression() {
AsExpression fromNode = AstTestFactory.asExpression(
AstTestFactory.identifier3("x"), AstTestFactory.typeName4("A"));
diff --git a/pkg/analyzer_utilities/pubspec.yaml b/pkg/analyzer_utilities/pubspec.yaml
index 7142157..a8426e4 100644
--- a/pkg/analyzer_utilities/pubspec.yaml
+++ b/pkg/analyzer_utilities/pubspec.yaml
@@ -3,7 +3,7 @@
publish_to: none
environment:
- sdk: '>=2.1.0 <3.0.0'
+ sdk: '>=2.12.0 <3.0.0'
dependencies:
analyzer:
diff --git a/pkg/async_helper/pubspec.yaml b/pkg/async_helper/pubspec.yaml
index 202f86b..f79d98f 100644
--- a/pkg/async_helper/pubspec.yaml
+++ b/pkg/async_helper/pubspec.yaml
@@ -10,7 +10,7 @@
the facilities provided in package:test.
environment:
- sdk: '>=2.0.0'
+ sdk: '>=2.12.0 <3.0.0'
dependencies:
expect:
diff --git a/pkg/expect/pubspec.yaml b/pkg/expect/pubspec.yaml
index 6a8f0bc..f84f8c9 100644
--- a/pkg/expect/pubspec.yaml
+++ b/pkg/expect/pubspec.yaml
@@ -9,7 +9,7 @@
test assertions.
environment:
- sdk: '>=2.0.0'
+ sdk: '>=2.12.0 <3.0.0'
dependencies:
meta:
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index f2f282f..1915787 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -27,18 +27,18 @@
}
const Version enableAlternativeInvalidationStrategyVersion =
- const Version(2, 12);
+ const Version(2, 13);
const Version enableConstantUpdate2018Version = const Version(2, 0);
const Version enableControlFlowCollectionsVersion = const Version(2, 0);
const Version enableExtensionMethodsVersion = const Version(2, 6);
-const Version enableGenericMetadataVersion = const Version(2, 12);
+const Version enableGenericMetadataVersion = const Version(2, 13);
const Version enableNonNullableVersion = const Version(2, 12);
-const Version enableNonfunctionTypeAliasesVersion = const Version(2, 12);
+const Version enableNonfunctionTypeAliasesVersion = const Version(2, 13);
const Version enableSetLiteralsVersion = const Version(2, 0);
const Version enableSpreadCollectionsVersion = const Version(2, 0);
-const Version enableTripleShiftVersion = const Version(2, 12);
-const Version enableValueClassVersion = const Version(2, 12);
-const Version enableVarianceVersion = const Version(2, 12);
+const Version enableTripleShiftVersion = const Version(2, 13);
+const Version enableValueClassVersion = const Version(2, 13);
+const Version enableVarianceVersion = const Version(2, 13);
ExperimentalFlag parseExperimentalFlag(String flag) {
switch (flag) {
@@ -101,33 +101,33 @@
};
const Map<ExperimentalFlag, Version> experimentEnabledVersion = {
- ExperimentalFlag.alternativeInvalidationStrategy: const Version(2, 12),
+ ExperimentalFlag.alternativeInvalidationStrategy: const Version(2, 13),
ExperimentalFlag.constantUpdate2018: const Version(2, 0),
ExperimentalFlag.controlFlowCollections: const Version(2, 0),
ExperimentalFlag.extensionMethods: const Version(2, 6),
- ExperimentalFlag.genericMetadata: const Version(2, 12),
+ ExperimentalFlag.genericMetadata: const Version(2, 13),
ExperimentalFlag.nonNullable: const Version(2, 12),
- ExperimentalFlag.nonfunctionTypeAliases: const Version(2, 12),
+ ExperimentalFlag.nonfunctionTypeAliases: const Version(2, 13),
ExperimentalFlag.setLiterals: const Version(2, 0),
ExperimentalFlag.spreadCollections: const Version(2, 0),
- ExperimentalFlag.tripleShift: const Version(2, 12),
- ExperimentalFlag.valueClass: const Version(2, 12),
- ExperimentalFlag.variance: const Version(2, 12),
+ ExperimentalFlag.tripleShift: const Version(2, 13),
+ ExperimentalFlag.valueClass: const Version(2, 13),
+ ExperimentalFlag.variance: const Version(2, 13),
};
const Map<ExperimentalFlag, Version> experimentReleasedVersion = {
- ExperimentalFlag.alternativeInvalidationStrategy: const Version(2, 12),
+ ExperimentalFlag.alternativeInvalidationStrategy: const Version(2, 13),
ExperimentalFlag.constantUpdate2018: const Version(2, 0),
ExperimentalFlag.controlFlowCollections: const Version(2, 0),
ExperimentalFlag.extensionMethods: const Version(2, 6),
- ExperimentalFlag.genericMetadata: const Version(2, 12),
+ ExperimentalFlag.genericMetadata: const Version(2, 13),
ExperimentalFlag.nonNullable: const Version(2, 10),
- ExperimentalFlag.nonfunctionTypeAliases: const Version(2, 12),
+ ExperimentalFlag.nonfunctionTypeAliases: const Version(2, 13),
ExperimentalFlag.setLiterals: const Version(2, 0),
ExperimentalFlag.spreadCollections: const Version(2, 0),
- ExperimentalFlag.tripleShift: const Version(2, 12),
- ExperimentalFlag.valueClass: const Version(2, 12),
- ExperimentalFlag.variance: const Version(2, 12),
+ ExperimentalFlag.tripleShift: const Version(2, 13),
+ ExperimentalFlag.valueClass: const Version(2, 13),
+ ExperimentalFlag.variance: const Version(2, 13),
};
const AllowedExperimentalFlags defaultAllowedExperimentalFlags =
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 3bf29c0..ef8334f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -111,7 +111,8 @@
import '../source/value_kinds.dart';
-import '../type_inference/type_inferrer.dart' show TypeInferrer;
+import '../type_inference/type_inferrer.dart'
+ show TypeInferrer, InferredFunctionBody;
import '../type_inference/type_promotion.dart'
show TypePromoter, TypePromotionFact, TypePromotionScope;
@@ -450,8 +451,11 @@
}
@override
- void registerVariableDeclaration(VariableDeclaration variable) {
+ VariableDeclaration createVariableDeclarationForValue(Expression expression) {
+ VariableDeclaration variable =
+ forest.createVariableDeclarationForValue(expression);
typeInferrer?.assignedVariables?.declare(variable);
+ return variable;
}
@override
@@ -989,9 +993,16 @@
builder.fileUri);
}
+ InferredFunctionBody inferredFunctionBody;
if (body != null) {
- body = typeInferrer?.inferFunctionBody(this, member.charOffset,
- _computeReturnTypeContext(member), asyncModifier, body);
+ inferredFunctionBody = typeInferrer?.inferFunctionBody(
+ this,
+ member.charOffset,
+ _computeReturnTypeContext(member),
+ asyncModifier,
+ body);
+ body = inferredFunctionBody.body;
+ builder.function.futureValueType = inferredFunctionBody.futureValueType;
libraryBuilder.loader.transformPostInference(body, transformSetLiterals,
transformCollections, libraryBuilder.library);
}
@@ -1423,10 +1434,10 @@
typeInferrer?.flowAnalysis?.declare(formals[i].variable, true);
}
}
- Statement inferredStatement = typeInferrer?.inferFunctionBody(
+ InferredFunctionBody inferredFunctionBody = typeInferrer?.inferFunctionBody(
this, fileOffset, const DynamicType(), AsyncMarker.Sync, fakeReturn);
assert(
- fakeReturn == inferredStatement,
+ fakeReturn == inferredFunctionBody.body,
"Previously implicit assumption about inferFunctionBody "
"not returning anything different.");
@@ -1696,8 +1707,7 @@
reportMissingNonNullableSupport(token);
}
VariableDeclaration variable =
- forest.createVariableDeclarationForValue(expression);
- registerVariableDeclaration(variable);
+ createVariableDeclarationForValue(expression);
push(new Cascade(variable, isNullAware: isNullAware)
..fileOffset = expression.fileOffset);
push(_createReadOnlyVariableAccess(variable, token, expression.fileOffset,
@@ -6318,8 +6328,7 @@
if (isNullAware) {
VariableDeclaration variable =
- forest.createVariableDeclarationForValue(receiver);
- registerVariableDeclaration(variable);
+ createVariableDeclarationForValue(receiver);
return new NullAwareMethodInvocation(
variable,
forest.createMethodInvocation(
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index 5fe56fe..353fd1db 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -406,12 +406,11 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
VariableDeclaration read =
- _helper.forest.createVariableDeclarationForValue(_createRead());
- _helper.registerVariableDeclaration(read);
+ _helper.createVariableDeclarationForValue(_createRead());
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
- .createVariableDeclarationForValue(_createWrite(offset, binary));
+ VariableDeclaration write =
+ _helper.createVariableDeclarationForValue(_createWrite(offset, binary));
return new LocalPostIncDec(read, write)..fileOffset = offset;
}
@@ -534,16 +533,14 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
- VariableDeclaration read = _helper.forest.createVariableDeclarationForValue(
+ _helper.createVariableDeclarationForValue(receiver);
+ VariableDeclaration read = _helper.createVariableDeclarationForValue(
_forest.createPropertyGet(fileOffset,
_helper.createVariableGet(variable, receiver.fileOffset), name));
- _helper.registerVariableDeclaration(read);
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
- .createVariableDeclarationForValue(_helper.forest.createPropertySet(
+ VariableDeclaration write = _helper.createVariableDeclarationForValue(
+ _helper.forest.createPropertySet(
fileOffset,
_helper.createVariableGet(variable, receiver.fileOffset),
name,
@@ -696,15 +693,13 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
_reportNonNullableInNullAwareWarningIfNeeded();
- VariableDeclaration read = _helper.forest.createVariableDeclarationForValue(
+ VariableDeclaration read = _helper.createVariableDeclarationForValue(
_forest.createPropertyGet(
fileOffset, _forest.createThisExpression(fileOffset), name));
- _helper.registerVariableDeclaration(read);
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
- .createVariableDeclarationForValue(
- _createWrite(fileOffset, binary, forEffect: true));
+ VariableDeclaration write = _helper.createVariableDeclarationForValue(
+ _createWrite(fileOffset, binary, forEffect: true));
return new PropertyPostIncDec.onReadOnly(read, write)..fileOffset = offset;
}
@@ -741,7 +736,7 @@
NullAwarePropertyAccessGenerator(ExpressionGeneratorHelper helper,
Token token, this.receiverExpression, this.name)
: this.receiver =
- helper.forest.createVariableDeclarationForValue(receiverExpression),
+ helper.createVariableDeclarationForValue(receiverExpression),
super(helper, token);
@override
@@ -755,8 +750,7 @@
@override
Expression buildSimpleRead() {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiverExpression);
- _helper.registerVariableDeclaration(variable);
+ _helper.createVariableDeclarationForValue(receiverExpression);
PropertyGet read = _forest.createPropertyGet(
fileOffset,
_helper.createVariableGet(variable, receiverExpression.fileOffset,
@@ -769,8 +763,7 @@
@override
Expression buildAssignment(Expression value, {bool voidContext = false}) {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiverExpression);
- _helper.registerVariableDeclaration(variable);
+ _helper.createVariableDeclarationForValue(receiverExpression);
PropertySet read = _helper.forest.createPropertySet(
fileOffset,
_helper.createVariableGet(variable, receiverExpression.fileOffset,
@@ -904,11 +897,10 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
VariableDeclaration read =
- _helper.forest.createVariableDeclarationForValue(_createRead());
- _helper.registerVariableDeclaration(read);
+ _helper.createVariableDeclarationForValue(_createRead());
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
+ VariableDeclaration write = _helper
.createVariableDeclarationForValue(_createWrite(fileOffset, binary));
return new StaticPostIncDec(read, write)..fileOffset = offset;
}
@@ -983,8 +975,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
@@ -1004,8 +995,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
@@ -1027,8 +1017,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
@@ -1056,8 +1045,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
@@ -1488,12 +1476,11 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
VariableDeclaration read =
- _helper.forest.createVariableDeclarationForValue(_createRead());
- _helper.registerVariableDeclaration(read);
+ _helper.createVariableDeclarationForValue(_createRead());
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
- .createVariableDeclarationForValue(_createWrite(offset, binary));
+ VariableDeclaration write =
+ _helper.createVariableDeclarationForValue(_createWrite(offset, binary));
return new StaticPostIncDec(read, write)..fileOffset = offset;
}
@@ -1758,12 +1745,11 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
VariableDeclaration read =
- _helper.forest.createVariableDeclarationForValue(_createRead());
+ _helper.createVariableDeclarationForValue(_createRead());
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
- .createVariableDeclarationForValue(
- _createWrite(fileOffset, binary, forEffect: true));
+ VariableDeclaration write = _helper.createVariableDeclarationForValue(
+ _createWrite(fileOffset, binary, forEffect: true));
return new PropertyPostIncDec.onReadOnly(read, write)..fileOffset = offset;
}
@@ -1999,8 +1985,7 @@
Expression buildSimpleRead() {
if (isNullAware) {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ _helper.createVariableDeclarationForValue(receiver);
return new NullAwareExtension(
variable,
_createRead(_helper.createVariableGet(variable, variable.fileOffset,
@@ -2032,8 +2017,7 @@
Expression buildAssignment(Expression value, {bool voidContext: false}) {
if (isNullAware) {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ _helper.createVariableDeclarationForValue(receiver);
return new NullAwareExtension(
variable,
_createWrite(
@@ -2067,8 +2051,7 @@
{bool voidContext: false}) {
if (isNullAware) {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ _helper.createVariableDeclarationForValue(receiver);
Expression read = _createRead(_helper.createVariableGet(
variable, receiver.fileOffset,
forNullGuardedAccess: true));
@@ -2100,7 +2083,7 @@
bool isPostIncDec: false}) {
if (isNullAware) {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiver);
+ _helper.createVariableDeclarationForValue(receiver);
Expression binary = _helper.forest.createBinary(
offset,
_createRead(_helper.createVariableGet(variable, receiver.fileOffset,
@@ -2134,15 +2117,14 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
} else if (isNullAware) {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiver);
- VariableDeclaration read = _helper.forest
- .createVariableDeclarationForValue(_createRead(
- _helper.createVariableGet(variable, receiver.fileOffset,
- forNullGuardedAccess: true)));
+ _helper.createVariableDeclarationForValue(receiver);
+ VariableDeclaration read = _helper.createVariableDeclarationForValue(
+ _createRead(_helper.createVariableGet(variable, receiver.fileOffset,
+ forNullGuardedAccess: true)));
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
- .createVariableDeclarationForValue(_createWrite(
+ VariableDeclaration write = _helper.createVariableDeclarationForValue(
+ _createWrite(
fileOffset,
_helper.createVariableGet(variable, receiver.fileOffset,
forNullGuardedAccess: true),
@@ -2154,16 +2136,14 @@
..fileOffset = fileOffset;
} else {
VariableDeclaration variable =
- _helper.forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
- VariableDeclaration read = _helper.forest
- .createVariableDeclarationForValue(_createRead(
+ _helper.createVariableDeclarationForValue(receiver);
+ VariableDeclaration read = _helper.createVariableDeclarationForValue(
+ _createRead(
_helper.createVariableGet(variable, receiver.fileOffset)));
- _helper.registerVariableDeclaration(read);
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
- VariableDeclaration write = _helper.forest
- .createVariableDeclarationForValue(_createWrite(fileOffset,
+ VariableDeclaration write = _helper.createVariableDeclarationForValue(
+ _createWrite(fileOffset,
_helper.createVariableGet(variable, receiver.fileOffset), binary,
forEffect: voidContext)
..fileOffset = fileOffset);
@@ -2178,9 +2158,7 @@
VariableDeclaration receiverVariable;
Expression receiverExpression = receiver;
if (isNullAware) {
- receiverVariable =
- _helper.forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(receiverVariable);
+ receiverVariable = _helper.createVariableDeclarationForValue(receiver);
receiverExpression = _helper.createVariableGet(
receiverVariable, receiverVariable.fileOffset,
forNullGuardedAccess: true);
@@ -2354,8 +2332,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
@@ -2385,7 +2362,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
@@ -2420,8 +2397,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
- _helper.registerVariableDeclaration(variable);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
@@ -2455,7 +2431,7 @@
VariableDeclaration variable;
Expression receiverValue;
if (isNullAware) {
- variable = _forest.createVariableDeclarationForValue(receiver);
+ variable = _helper.createVariableDeclarationForValue(receiver);
receiverValue = _helper.createVariableGet(variable, fileOffset,
forNullGuardedAccess: true);
} else {
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
index 9a41855..8d03df8 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
@@ -154,6 +154,9 @@
void reportDuplicatedDeclaration(
Builder existing, String name, int charOffset);
+ /// Creates a synthetic variable declaration for the value of [expression].
+ VariableDeclaration createVariableDeclarationForValue(Expression expression);
+
/// Creates a [VariableGet] of the [variable] using [charOffset] as the file
/// offset of the created node.
Expression createVariableGet(VariableDeclaration variable, int charOffset,
@@ -163,6 +166,4 @@
///
/// This is needed for type promotion.
void registerVariableAssignment(VariableDeclaration variable);
-
- void registerVariableDeclaration(VariableDeclaration variable);
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart b/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart
index 78dc0c5..e162fa2 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart
@@ -33,6 +33,8 @@
/// the unknown type.
DartType get yieldContext;
+ DartType get futureValueType;
+
factory ClosureContext(TypeInferrerImpl inferrer, AsyncMarker asyncMarker,
DartType returnContext, bool needToInferReturnType) {
assert(returnContext != null);
@@ -55,15 +57,20 @@
yieldContext, declaredReturnType, needToInferReturnType);
}
} else if (isAsync) {
+ DartType futureValueType;
if (inferrer.isNonNullableByDefault) {
returnContext = inferrer.wrapFutureOrType(
inferrer.computeFutureValueTypeSchema(returnContext));
+ if (!needToInferReturnType) {
+ futureValueType =
+ computeFutureValueType(inferrer.coreTypes, declaredReturnType);
+ }
} else {
returnContext = inferrer.wrapFutureOrType(
inferrer.typeSchemaEnvironment.flatten(returnContext));
}
- return new _AsyncClosureContext(
- returnContext, declaredReturnType, needToInferReturnType);
+ return new _AsyncClosureContext(returnContext, declaredReturnType,
+ needToInferReturnType, futureValueType);
} else {
return new _SyncClosureContext(
returnContext, declaredReturnType, needToInferReturnType);
@@ -137,6 +144,9 @@
/// being inferred.
List<DartType> _returnExpressionTypes;
+ @override
+ DartType get futureValueType => null;
+
_SyncClosureContext(this._returnContext, this._declaredReturnType,
this._needToInferReturnType) {
if (_needToInferReturnType) {
@@ -480,8 +490,10 @@
/// being inferred.
List<DartType> _returnExpressionTypes;
+ DartType futureValueType;
+
_AsyncClosureContext(this._returnContext, this._declaredReturnType,
- this._needToInferReturnType) {
+ this._needToInferReturnType, this.futureValueType) {
if (_needToInferReturnType) {
_returnStatements = [];
_returnExpressionTypes = [];
@@ -491,8 +503,8 @@
void _checkValidReturn(TypeInferrerImpl inferrer, DartType returnType,
ReturnStatement statement, DartType expressionType) {
if (inferrer.isNonNullableByDefault) {
- DartType futureValueType =
- computeFutureValueType(inferrer.coreTypes, returnType);
+ assert(
+ futureValueType != null, "Future value type has not been computed.");
if (statement.expression == null) {
// It is a compile-time error if s is `return;`, unless T_v is void,
@@ -788,6 +800,10 @@
}
}
+ if (inferrer.isNonNullableByDefault) {
+ futureValueType =
+ computeFutureValueType(inferrer.coreTypes, inferredType);
+ }
for (int i = 0; i < _returnStatements.length; ++i) {
_checkValidReturn(inferrer, inferredType, _returnStatements[i],
_returnExpressionTypes[i]);
@@ -871,6 +887,9 @@
/// being inferred.
List<DartType> _yieldElementTypes;
+ @override
+ DartType get futureValueType => null;
+
_SyncStarClosureContext(this._yieldElementContext, this._declaredReturnType,
this._needToInferReturnType) {
if (_needToInferReturnType) {
@@ -996,6 +1015,9 @@
/// being inferred.
List<DartType> _yieldElementTypes;
+ @override
+ DartType get futureValueType => null;
+
_AsyncStarClosureContext(this._yieldElementContext, this._declaredReturnType,
this._needToInferReturnType) {
if (_needToInferReturnType) {
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index cfdc40c..c3c6475 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -149,7 +149,7 @@
InferenceHelper helper, DartType declaredType, Expression initializer);
/// Performs type inference on the given function body.
- Statement inferFunctionBody(InferenceHelper helper, int fileOffset,
+ InferredFunctionBody inferFunctionBody(InferenceHelper helper, int fileOffset,
DartType returnType, AsyncMarker asyncMarker, Statement body);
/// Performs type inference on the given constructor initializer.
@@ -1909,7 +1909,7 @@
}
@override
- Statement inferFunctionBody(InferenceHelper helper, int fileOffset,
+ InferredFunctionBody inferFunctionBody(InferenceHelper helper, int fileOffset,
DartType returnType, AsyncMarker asyncMarker, Statement body) {
assert(body != null);
assert(closureContext == null);
@@ -1924,10 +1924,17 @@
}
result =
closureContext.handleImplicitReturn(this, body, result, fileOffset);
+ DartType futureValueType = closureContext.futureValueType;
+ assert(
+ !(isNonNullableByDefault &&
+ asyncMarker == AsyncMarker.Async &&
+ futureValueType == null),
+ "No future value type computed.");
closureContext = null;
this.helper = null;
flowAnalysis.finish();
- return result.hasChanged ? result.statement : body;
+ return new InferredFunctionBody(
+ result.hasChanged ? result.statement : body, futureValueType);
}
InvocationInferenceResult inferInvocation(DartType typeContext, int offset,
@@ -2531,6 +2538,12 @@
}
bodyResult = closureContext.handleImplicitReturn(
this, function.body, bodyResult, fileOffset);
+ function.futureValueType = closureContext.futureValueType;
+ assert(
+ !(isNonNullableByDefault &&
+ function.asyncMarker == AsyncMarker.Async &&
+ function.futureValueType == null),
+ "No future value type computed.");
if (bodyResult.hasChanged) {
function.body = bodyResult.statement..parent = function;
@@ -4819,3 +4832,10 @@
namedParameters: functionType.namedParameters,
typeParameters: functionType.typeParameters);
}
+
+class InferredFunctionBody {
+ final Statement body;
+ final DartType futureValueType;
+
+ InferredFunctionBody(this.body, this.futureValueType);
+}
diff --git a/pkg/front_end/test/static_types/data/for_in.dart b/pkg/front_end/test/static_types/data/for_in.dart
index 9282e55..922bee5 100644
--- a/pkg/front_end/test/static_types/data/for_in.dart
+++ b/pkg/front_end/test/static_types/data/for_in.dart
@@ -48,6 +48,7 @@
}
}
+/*cfe:nnbd.member: asyncForInDynamicStream:futureValueType=dynamic*/
asyncForInDynamicStream(dynamic stream) async {
/*current: dynamic*/
await for (var e in
@@ -58,6 +59,7 @@
}
}
+/*cfe:nnbd.member: asyncForInDynamic:futureValueType=dynamic*/
asyncForInDynamic(Stream<dynamic> stream) async {
/*current: dynamic*/
await for (var e in
@@ -68,6 +70,7 @@
}
}
+/*cfe:nnbd.member: asyncForInInt:futureValueType=dynamic*/
asyncForInInt(Stream<int> stream) async {
/*cfe.current: int*/
/*cfe:nnbd.current: int!*/
@@ -81,6 +84,7 @@
}
}
+/*cfe:nnbd.member: asyncForInIntToNum:futureValueType=dynamic*/
asyncForInIntToNum(Stream<int> stream) async {
/*cfe.current: int*/
/*cfe:nnbd.current: int!*/
@@ -115,6 +119,7 @@
Iterator<int> get iterator;
}
+/*cfe:nnbd.member: customStream:futureValueType=dynamic*/
customStream(CustomStream stream) async {
/*cfe.current: num*/
/*cfe:nnbd.current: num!*/
@@ -153,6 +158,7 @@
CustomIterator get iterator;
}
+/*cfe:nnbd.member: customStreamIterator:futureValueType=dynamic*/
customStreamIterator(StreamWithCustomIterator stream) async {
/*cfe.current: num*/
/*cfe:nnbd.current: num!*/
@@ -177,6 +183,7 @@
}
}
+/*cfe:nnbd.member: genericStream:futureValueType=void*/
void genericStream<T extends Stream<T>>(T x) async {
/*cfe.current: T*/
/*cfe:nnbd.current: T!*/
diff --git a/pkg/front_end/test/static_types/data/future_value_type.dart b/pkg/front_end/test/static_types/data/future_value_type.dart
new file mode 100644
index 0000000..f9ba684
--- /dev/null
+++ b/pkg/front_end/test/static_types/data/future_value_type.dart
@@ -0,0 +1,112 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+/*cfe.library: nnbd=false*/
+
+/*cfe:nnbd.library: nnbd=true*/
+
+import 'dart:async';
+
+/*cfe:nnbd.member: declaredFutureInt:futureValueType=int!*/
+Future<int> declaredFutureInt() async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+}
+
+/*cfe:nnbd.member: declaredFutureOrInt:futureValueType=int!*/
+FutureOr<int> declaredFutureOrInt() async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+}
+
+/*cfe:nnbd.member: declaredObject:futureValueType=Object?*/
+Object declaredObject() async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+}
+
+/*cfe:nnbd.member: omitted:futureValueType=dynamic*/
+omitted() async {}
+
+/*cfe:nnbd.member: method:futureValueType=dynamic*/
+method() async {
+ /*cfe:nnbd.futureValueType=int!*/
+ Future<int> declaredLocalFutureInt() async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ }
+
+ /*cfe:nnbd.futureValueType=int!*/
+ FutureOr<int> declaredLocalFutureOrInt() async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ }
+
+ /*cfe:nnbd.futureValueType=Object?*/
+ Object declaredLocalObject() async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ }
+
+ /*cfe:nnbd.futureValueType=Null*/ omittedLocal() async {}
+
+ Future<int> inferredCalledFutureInt =
+ /*cfe.Future<int> Function()*/
+ /*cfe:nnbd.Future<int!>! Function()!,futureValueType=int!*/
+ () async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ }
+ /*cfe.invoke: Future<int>*/
+ /*cfe:nnbd.invoke: Future<int!>!*/
+ ();
+
+ FutureOr<int> inferredCalledFutureOrInt =
+ /*cfe.Future<int> Function()*/
+ /*cfe:nnbd.Future<int!>! Function()!,futureValueType=int!*/
+ () async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ }
+ /*cfe.invoke: Future<int>*/
+ /*cfe:nnbd.invoke: Future<int!>!*/
+ ();
+
+ Future<int> Function() inferredFutureInt =
+ /*cfe.Future<int> Function()*/
+ /*cfe:nnbd.Future<int!>! Function()!,futureValueType=int!*/
+ () async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ };
+
+ FutureOr<int> Function() inferredFutureOrInt =
+ /*cfe.Future<int> Function()*/
+ /*cfe:nnbd.Future<int!>! Function()!,futureValueType=int!*/
+ () async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ };
+
+ Object Function() inferredInt =
+ /*cfe.Future<int> Function()*/
+ /*cfe:nnbd.Future<int!>! Function()!,futureValueType=int!*/
+ () async {
+ return
+ /*cfe.int*/ /*cfe:nnbd.int!*/ 0;
+ };
+
+ Object Function() inferredNull =
+ /*cfe.Future<Null> Function()*/
+ /*cfe:nnbd.Future<Null>! Function()!,futureValueType=Null*/
+ () async {
+ return
+ /*Null*/ null;
+ };
+
+ Object Function() inferredEmpty =
+ /*cfe.Future<Null> Function()*/
+ /*cfe:nnbd.Future<Null>! Function()!,futureValueType=Null*/
+ () async {};
+}
diff --git a/pkg/front_end/test/static_types/static_type_test.dart b/pkg/front_end/test/static_types/static_type_test.dart
index c90118c..53a9ee2 100644
--- a/pkg/front_end/test/static_types/static_type_test.dart
+++ b/pkg/front_end/test/static_types/static_type_test.dart
@@ -104,12 +104,24 @@
}
@override
+ String computeMemberValue(Id id, Member node) {
+ if (node is Procedure && node.function.futureValueType != null) {
+ return 'futureValueType=${typeToText(node.function.futureValueType)}';
+ }
+ return null;
+ }
+
+ @override
String computeNodeValue(Id id, TreeNode node) {
if (isSkippedExpression(node)) {
return null;
}
if (node is Expression) {
DartType type = node.getStaticType(_staticTypeContext);
+ if (node is FunctionExpression && node.function.futureValueType != null) {
+ return '${typeToText(type)},'
+ 'futureValueType=${typeToText(node.function.futureValueType)}';
+ }
return typeToText(type);
} else if (node is Arguments) {
if (node.types.isNotEmpty) {
@@ -121,6 +133,10 @@
node, node.iterable.getStaticType(_staticTypeContext));
return typeToText(type);
}
+ } else if (node is FunctionDeclaration) {
+ if (node.function.futureValueType != null) {
+ return 'futureValueType=${typeToText(node.function.futureValueType)}';
+ }
}
return null;
}
diff --git a/pkg/front_end/testcases/general/issue44654.dart b/pkg/front_end/testcases/general/issue44654.dart
new file mode 100644
index 0000000..83abcab
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44654.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// @dart = 2.9
+
+void test2() {
+ String string = null;
+ if (string?.isNotEmpty) ;
+}
+
+void main() {
+ try {
+ test2();
+ } catch (e, s) {
+ checkFirstLineHasPosition(s);
+ }
+}
+
+void checkFirstLineHasPosition(StackTrace stackTrace) {
+ String firstLine = '$stackTrace'
+ .split('\n')
+ .firstWhere((String line) => line.startsWith('#0'));
+ int lastParen = firstLine.lastIndexOf(')');
+ if (lastParen != -1) {
+ int secondColon = firstLine.lastIndexOf(':', lastParen - 1);
+ if (secondColon != -1) {
+ int firstColon = firstLine.lastIndexOf(':', secondColon - 1);
+ String lineText = firstLine.substring(firstColon + 1, secondColon);
+ String posText = firstLine.substring(secondColon + 1, lastParen);
+ int line = int.tryParse(lineText);
+ int pos = int.tryParse(posText);
+ if (line != null && pos != null) {
+ print('Found position $line:$pos');
+ return;
+ }
+ }
+ }
+ throw 'No position found in "$firstLine"';
+}
diff --git a/pkg/front_end/testcases/general/issue44654.dart.outline.expect b/pkg/front_end/testcases/general/issue44654.dart.outline.expect
new file mode 100644
index 0000000..1fa8f3a
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44654.dart.outline.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method test2() → void
+ ;
+static method main() → void
+ ;
+static method checkFirstLineHasPosition(core::StackTrace* stackTrace) → void
+ ;
diff --git a/pkg/front_end/testcases/general/issue44654.dart.strong.expect b/pkg/front_end/testcases/general/issue44654.dart.strong.expect
new file mode 100644
index 0000000..20db53d
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44654.dart.strong.expect
@@ -0,0 +1,37 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method test2() → void {
+ core::String* string = null;
+ if(let final core::String* #t1 = string in #t1.{core::String::==}(null) ?{core::bool*} null : #t1.{core::String::isNotEmpty})
+ ;
+}
+static method main() → void {
+ try {
+ self::test2();
+ }
+ on dynamic catch(final dynamic e, final core::StackTrace* s) {
+ self::checkFirstLineHasPosition(s);
+ }
+}
+static method checkFirstLineHasPosition(core::StackTrace* stackTrace) → void {
+ core::String* firstLine = "${stackTrace}".{core::String::split}("
+").{core::Iterable::firstWhere}((core::String* line) → core::bool* => line.{core::String::startsWith}("#0"));
+ core::int* lastParen = firstLine.{core::String::lastIndexOf}(")");
+ if(!lastParen.{core::num::==}(1.{core::int::unary-}())) {
+ core::int* secondColon = firstLine.{core::String::lastIndexOf}(":", lastParen.{core::num::-}(1));
+ if(!secondColon.{core::num::==}(1.{core::int::unary-}())) {
+ core::int* firstColon = firstLine.{core::String::lastIndexOf}(":", secondColon.{core::num::-}(1));
+ core::String* lineText = firstLine.{core::String::substring}(firstColon.{core::num::+}(1), secondColon);
+ core::String* posText = firstLine.{core::String::substring}(secondColon.{core::num::+}(1), lastParen);
+ core::int* line = core::int::tryParse(lineText);
+ core::int* pos = core::int::tryParse(posText);
+ if(!line.{core::num::==}(null) && !pos.{core::num::==}(null)) {
+ core::print("Found position ${line}:${pos}");
+ return;
+ }
+ }
+ }
+ throw "No position found in \"${firstLine}\"";
+}
diff --git a/pkg/front_end/testcases/general/issue44654.dart.strong.transformed.expect b/pkg/front_end/testcases/general/issue44654.dart.strong.transformed.expect
new file mode 100644
index 0000000..dee713e
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44654.dart.strong.transformed.expect
@@ -0,0 +1,43 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method test2() → void {
+ core::String* string = null;
+ if(let final core::String* #t1 = string in #t1.{core::String::==}(null) ?{core::bool*} null : #t1.{core::String::isNotEmpty})
+ ;
+}
+static method main() → void {
+ try {
+ self::test2();
+ }
+ on dynamic catch(final dynamic e, final core::StackTrace* s) {
+ self::checkFirstLineHasPosition(s);
+ }
+}
+static method checkFirstLineHasPosition(core::StackTrace* stackTrace) → void {
+ core::String* firstLine = "${stackTrace}".{core::String::split}("
+").{core::Iterable::firstWhere}((core::String* line) → core::bool* => line.{core::String::startsWith}("#0"));
+ core::int* lastParen = firstLine.{core::String::lastIndexOf}(")");
+ if(!lastParen.{core::num::==}(1.{core::int::unary-}())) {
+ core::int* secondColon = firstLine.{core::String::lastIndexOf}(":", lastParen.{core::num::-}(1));
+ if(!secondColon.{core::num::==}(1.{core::int::unary-}())) {
+ core::int* firstColon = firstLine.{core::String::lastIndexOf}(":", secondColon.{core::num::-}(1));
+ core::String* lineText = firstLine.{core::String::substring}(firstColon.{core::num::+}(1), secondColon);
+ core::String* posText = firstLine.{core::String::substring}(secondColon.{core::num::+}(1), lastParen);
+ core::int* line = core::int::tryParse(lineText);
+ core::int* pos = core::int::tryParse(posText);
+ if(!line.{core::num::==}(null) && !pos.{core::num::==}(null)) {
+ core::print("Found position ${line}:${pos}");
+ return;
+ }
+ }
+ }
+ throw "No position found in \"${firstLine}\"";
+}
+
+
+Extra constant evaluation status:
+Evaluated: MethodInvocation @ org-dartlang-testcase:///issue44654.dart:25:20 -> IntConstant(-1)
+Evaluated: MethodInvocation @ org-dartlang-testcase:///issue44654.dart:27:24 -> IntConstant(-1)
+Extra constant evaluation: evaluated: 63, effectively constant: 2
diff --git a/pkg/front_end/testcases/general/issue44654.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue44654.dart.textual_outline.expect
new file mode 100644
index 0000000..a95637c
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44654.dart.textual_outline.expect
@@ -0,0 +1,4 @@
+// @dart = 2.9
+void test2() {}
+void main() {}
+void checkFirstLineHasPosition(StackTrace stackTrace) {}
diff --git a/pkg/front_end/testcases/general/issue44654.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue44654.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..95b5598
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44654.dart.textual_outline_modelled.expect
@@ -0,0 +1,4 @@
+// @dart = 2.9
+void checkFirstLineHasPosition(StackTrace stackTrace) {}
+void main() {}
+void test2() {}
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 0b27f74..def8457 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -9,7 +9,6 @@
# general/platform_invalid_uris/main: SemiFuzzFailure # semi fuzz fails but isn't currently enabled by default.
extensions/call_methods: TypeCheckError
-extensions/compounds: Crash # assert error
extensions/extension_setter_error: TypeCheckError
extensions/instance_access_of_static: RuntimeError
extensions/invalid_explicit_access: RuntimeError
@@ -178,8 +177,6 @@
nnbd/no_support_for_old_null_aware_index_access_syntax: RuntimeError # Expected.
nnbd/nullable_object_access: TypeCheckError
nnbd/nullable_receiver: TypeCheckError
-nnbd/null_shorting_explicit_extension: Crash # assert error
-nnbd/null_shorting_index: Crash # assert error
nnbd/potentially_nullable_access: TypeCheckError
none/equals: TypeCheckError
none/method_invocation: TypeCheckError
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index 2a84b11..b5e4768 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -7,7 +7,6 @@
# Kernel files are produced by compiling Dart code via Fasta.
extensions/call_methods: TypeCheckError
-extensions/compounds: Crash # assert error
extensions/extension_setter_error: TypeCheckError
extensions/instance_access_of_static: RuntimeError
extensions/invalid_explicit_access: RuntimeError
@@ -178,8 +177,6 @@
nnbd/no_support_for_old_null_aware_index_access_syntax: RuntimeError # Expected.
nnbd/nullable_object_access: TypeCheckError
nnbd/nullable_receiver: TypeCheckError
-nnbd/null_shorting_explicit_extension: Crash # assert error
-nnbd/null_shorting_index: Crash # assert error
nnbd/potentially_nullable_access: TypeCheckError
none/equals: TypeCheckError
none/method_invocation: TypeCheckError
diff --git a/pkg/front_end/testcases/weak.status b/pkg/front_end/testcases/weak.status
index 663cb4e..fa279da 100644
--- a/pkg/front_end/testcases/weak.status
+++ b/pkg/front_end/testcases/weak.status
@@ -5,7 +5,6 @@
# Status file for the weak_suite.dart test suite.
extensions/call_methods: TypeCheckError
-extensions/compounds: Crash # assert error
extensions/extension_setter_error: TypeCheckError
extensions/instance_access_of_static: RuntimeError
extensions/invalid_explicit_access: RuntimeError
@@ -65,8 +64,6 @@
nnbd/no_support_for_old_null_aware_index_access_syntax: RuntimeError # Expected.
nnbd/nullable_object_access: TypeCheckError
nnbd/nullable_receiver: TypeCheckError
-nnbd/null_shorting_explicit_extension: Crash # assert error
-nnbd/null_shorting_index: Crash # assert error
nnbd/potentially_nullable_access: TypeCheckError
nnbd_mixed/bad_mixins: TypeCheckError
nnbd_mixed/covariant_from_opt_in: TypeCheckError
@@ -85,7 +82,6 @@
nnbd_mixed/issue41567: TypeCheckError
nnbd_mixed/messages_with_types_opt_in: TypeCheckError
nnbd_mixed/messages_with_types_opt_out: TypeCheckError
-nnbd_mixed/no_null_shorting_explicit_extension: Crash # assert error
none/equals: TypeCheckError
none/method_invocation: TypeCheckError
none/operator: TypeCheckError
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 6e71d73..529d2c76 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -147,7 +147,7 @@
type ComponentFile {
UInt32 magic = 0x90ABCDEF;
- UInt32 formatVersion = 54;
+ UInt32 formatVersion = 55;
Byte[10] shortSdkHash;
List<String> problemsAsJson; // Described in problems.md.
Library[] libraries;
@@ -510,6 +510,7 @@
List<VariableDeclarationPlain> positionalParameters;
List<VariableDeclarationPlain> namedParameters;
DartType returnType;
+ Option<DartType> futureValueType;
Option<Statement> body;
}
@@ -1063,6 +1064,7 @@
type Let extends Expression {
Byte tag = 53;
+ FileOffset fileOffset;
VariableDeclarationPlain variable;
Expression body;
}
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 65796ed..4bb433a33 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -2899,6 +2899,19 @@
DartType returnType; // Not null.
Statement _body;
+ /// The future value type of this is an async function, otherwise `null`.
+ ///
+ /// The future value type is the element type returned by an async function.
+ /// For instance
+ ///
+ /// Future<Foo> method1() async => new Foo();
+ /// FutureOr<Foo> method2() async => new Foo();
+ ///
+ /// here the return types are `Future<Foo>` and `FutureOr<Foo>` for `method1`
+ /// and `method2`, respectively, but the future value type is in both cases
+ /// `Foo`.
+ DartType futureValueType;
+
void Function() lazyBuilder;
void _buildLazy() {
@@ -2926,7 +2939,8 @@
int requiredParameterCount,
this.returnType: const DynamicType(),
this.asyncMarker: AsyncMarker.Sync,
- this.dartAsyncMarker})
+ this.dartAsyncMarker,
+ this.futureValueType})
: this.positionalParameters =
positionalParameters ?? <VariableDeclaration>[],
this.requiredParameterCount =
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index bc9cb92..732e8e6 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -1686,6 +1686,7 @@
List<VariableDeclaration> positional = readAndPushVariableDeclarationList();
List<VariableDeclaration> named = readAndPushVariableDeclarationList();
DartType returnType = readDartType();
+ DartType futureValueType = readDartTypeOption();
int oldLabelStackBase = labelStackBase;
int oldSwitchCaseStackBase = switchCaseStackBase;
@@ -1708,7 +1709,8 @@
namedParameters: named,
returnType: returnType,
asyncMarker: asyncMarker,
- dartAsyncMarker: dartAsyncMarker)
+ dartAsyncMarker: dartAsyncMarker,
+ futureValueType: futureValueType)
..fileOffset = offset
..fileEndOffset = endOffset;
@@ -2404,12 +2406,13 @@
}
Expression _readLet() {
+ int offset = readOffset();
VariableDeclaration variable = readVariableDeclaration();
int stackHeight = variableStack.length;
pushVariableDeclaration(variable);
Expression body = readExpression();
variableStack.length = stackHeight;
- return new Let(variable, body);
+ return new Let(variable, body)..fileOffset = offset;
}
Expression _readBlockExpression() {
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index d706a36..25c299b 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -1384,6 +1384,7 @@
writeVariableDeclarationList(node.positionalParameters);
writeVariableDeclarationList(node.namedParameters);
writeNode(node.returnType);
+ writeOptionalNode(node.futureValueType);
writeOptionalNode(node.body);
_labelIndexer = oldLabels;
_switchCaseIndexer = oldCases;
@@ -1899,6 +1900,7 @@
@override
void visitLet(Let node) {
writeByte(Tag.Let);
+ writeOffset(node.fileOffset);
_variableIndexer ??= new VariableIndexer();
_variableIndexer.pushScope();
writeVariableDeclaration(node.variable);
diff --git a/pkg/kernel/lib/binary/tag.dart b/pkg/kernel/lib/binary/tag.dart
index 410617c..4653eec 100644
--- a/pkg/kernel/lib/binary/tag.dart
+++ b/pkg/kernel/lib/binary/tag.dart
@@ -173,7 +173,7 @@
/// Internal version of kernel binary format.
/// Bump it when making incompatible changes in kernel binaries.
/// Keep in sync with runtime/vm/kernel_binary.h, pkg/kernel/binary.md.
- static const int BinaryFormatVersion = 54;
+ static const int BinaryFormatVersion = 55;
}
abstract class ConstantTag {
diff --git a/pkg/kernel/lib/default_language_version.dart b/pkg/kernel/lib/default_language_version.dart
index 8dbbe5b..5b39ec4 100644
--- a/pkg/kernel/lib/default_language_version.dart
+++ b/pkg/kernel/lib/default_language_version.dart
@@ -11,4 +11,4 @@
import "ast.dart";
-Version defaultLanguageVersion = const Version(2, 12);
+Version defaultLanguageVersion = const Version(2, 13);
diff --git a/pkg/kernel/lib/verifier.dart b/pkg/kernel/lib/verifier.dart
index e40ab133..cdd2f22 100644
--- a/pkg/kernel/lib/verifier.dart
+++ b/pkg/kernel/lib/verifier.dart
@@ -413,6 +413,13 @@
bool savedInCatchBlock = inCatchBlock;
AsyncMarker savedAsyncMarker = currentAsyncMarker;
currentAsyncMarker = node.asyncMarker;
+ if (!isOutline &&
+ currentMember.isNonNullableByDefault &&
+ node.asyncMarker == AsyncMarker.Async &&
+ node.futureValueType == null) {
+ problem(node,
+ "No future value type set for async function in opt-in library.");
+ }
inCatchBlock = false;
visitWithLocalScope(node);
inCatchBlock = savedInCatchBlock;
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index d2d9a4f..a245378 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -666,7 +666,7 @@
ThrowLanguageError("no library handler registered");
}
- NoReloadScope no_reload(isolate, thread);
+ NoReloadScope no_reload(isolate->group(), thread);
// Canonicalize library URI.
String& canonical_uri = String::Handle(zone);
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 0266392..345f9b2 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -3509,6 +3509,10 @@
DECLARE_INSTRUCTION(ReachabilityFence)
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ return kNoRepresentation;
+ }
+
Value* value() const { return inputs_[0]; }
virtual bool ComputeCanDeoptimize() const { return false; }
diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc
index d4b806d..8a6897e 100644
--- a/runtime/vm/compiler/backend/il_arm64.cc
+++ b/runtime/vm/compiler/backend/il_arm64.cc
@@ -4152,9 +4152,11 @@
const Register result = locs()->out(0).reg();
ASSERT(value != result);
compiler::Label done;
- __ SmiUntag(result, value);
+ __ sbfx(result, value, kSmiTagSize,
+ Utils::Minimum(static_cast<intptr_t>(32), kSmiBits));
__ BranchIfSmi(value, &done);
- __ LoadFieldFromOffset(result, value, Mint::value_offset());
+ __ LoadFieldFromOffset(result, value, Mint::value_offset(),
+ compiler::kFourBytes);
__ Bind(&done);
}
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index fbced06..9856b71 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -3667,9 +3667,9 @@
return BuildFunctionNode(TokenPosition::kNoSource, StringIndex());
}
-Fragment StreamingFlowGraphBuilder::BuildLet(TokenPosition* position) {
- if (position != NULL) *position = TokenPosition::kNoSource;
-
+Fragment StreamingFlowGraphBuilder::BuildLet(TokenPosition* p) {
+ const TokenPosition position = ReadPosition(); // read position.
+ if (p != nullptr) *p = position;
Fragment instructions = BuildVariableDeclaration(); // read variable.
instructions += BuildExpression(); // read body.
return instructions;
diff --git a/runtime/vm/compiler/frontend/kernel_fingerprints.cc b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
index a736b8e..9f7415c 100644
--- a/runtime/vm/compiler/frontend/kernel_fingerprints.cc
+++ b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
@@ -507,6 +507,7 @@
CalculateFunctionNodeFingerprint(); // read function node.
return;
case kLet:
+ ReadPosition(); // read position.
CalculateVariableDeclarationFingerprint(); // read variable declaration.
CalculateExpressionFingerprint(); // read expression.
return;
@@ -754,6 +755,7 @@
CalculateListOfVariableDeclarationsFingerprint(); // read positionals
CalculateListOfVariableDeclarationsFingerprint(); // read named
CalculateDartTypeFingerprint(); // read return type.
+ CalculateOptionalDartTypeFingerprint(); // read future value type.
if (ReadTag() == kSomething) {
CalculateStatementFingerprint(); // Read body.
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index d7fe4f9..7474941 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -897,6 +897,10 @@
helper_->SkipDartType(); // read return type.
if (++next_read_ == field) return;
FALL_THROUGH;
+ case kFutureValueType:
+ helper_->SkipOptionalDartType(); // read future value type.
+ if (++next_read_ == field) return;
+ FALL_THROUGH;
case kBody:
if (helper_->ReadTag() == kSomething)
helper_->SkipStatement(); // read body.
@@ -2444,6 +2448,7 @@
SkipFunctionNode(); // read function node.
return;
case kLet:
+ ReadPosition(); // read position.
SkipVariableDeclaration(); // read variable declaration.
SkipExpression(); // read expression.
return;
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.h b/runtime/vm/compiler/frontend/kernel_translation_helper.h
index 9eaf327..b76603a 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.h
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.h
@@ -270,6 +270,7 @@
kPositionalParameters,
kNamedParameters,
kReturnType,
+ kFutureValueType,
kBody,
kEnd,
};
@@ -1167,12 +1168,11 @@
KernelReaderHelper(Zone* zone,
TranslationHelper* translation_helper,
- const uint8_t* data_buffer,
- intptr_t buffer_length,
+ const ProgramBinary& binary,
intptr_t data_program_offset)
: zone_(zone),
translation_helper_(*translation_helper),
- reader_(data_buffer, buffer_length),
+ reader_(binary),
script_(Script::Handle(zone_)),
data_program_offset_(data_program_offset) {}
diff --git a/runtime/vm/compiler/frontend/scope_builder.cc b/runtime/vm/compiler/frontend/scope_builder.cc
index 11f7de3..32f02f5 100644
--- a/runtime/vm/compiler/frontend/scope_builder.cc
+++ b/runtime/vm/compiler/frontend/scope_builder.cc
@@ -856,6 +856,7 @@
EnterScope(offset);
+ helper_.ReadPosition(); // read position.
VisitVariableDeclaration(); // read variable declaration.
VisitExpression(); // read expression.
diff --git a/runtime/vm/compiler/jit/jit_call_specializer.cc b/runtime/vm/compiler/jit/jit_call_specializer.cc
index 873174d..814a0fc 100644
--- a/runtime/vm/compiler/jit/jit_call_specializer.cc
+++ b/runtime/vm/compiler/jit/jit_call_specializer.cc
@@ -188,8 +188,16 @@
}
}
if (!unboxed_field) {
+ // TODO(http://dartbug.com/36097): Once we support optimized compiles with
+ // --enable-isolate-groups we could deoptimize dependent code right here -
+ // which involves stopping mutators.
+ // We could also continue to bailout of the compilation and let any
+ // mutator do the work in it's lazy compile slow path. The benefit of this
+ // would be to avoid stopping mutator here.
+ // The latter is better for single-isolate scenarios, we should measure
+ // and then decide which approach to take.
if (Compiler::IsBackgroundCompilation()) {
- isolate()->AddDeoptimizingBoxedField(field);
+ isolate_group()->AddDeoptimizingBoxedField(field);
Compiler::AbortBackgroundCompilation(
DeoptId::kNone, "Unboxing instance field while compiling");
UNREACHABLE();
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index 6822001..348954f 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -12,372 +12,372 @@
// When adding a new function, add a 0 as the fingerprint and run the build in
// debug mode to get the correct fingerprint from the mismatch error.
#define OTHER_RECOGNIZED_LIST(V) \
- V(::, identical, ObjectIdentical, 0x19eb7f33) \
- V(ClassID, getID, ClassIDgetID, 0x4d140cb3) \
- V(Object, Object., ObjectConstructor, 0x89c467da) \
- V(List, ., ListFactory, 0x1892cc51) \
- V(_List, ., ObjectArrayAllocate, 0x4c9d39e2) \
- V(_List, []=, ObjectArraySetIndexed, 0xa06ee8ae) \
- V(_GrowableList, []=, GrowableArraySetIndexed, 0xa06ee8ae) \
- V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 0x30688af4) \
- V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 0x31c4acea) \
- V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 0x4885450f) \
- V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 0x4a06a579) \
- V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 0x335cdbca) \
- V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 0x33a21d3b) \
- V(_TypedList, _getInt64, ByteArrayBaseGetInt64, 0x10a56ebf) \
- V(_TypedList, _getUint64, ByteArrayBaseGetUint64, 0x46a02819) \
- V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 0xe425bcd3) \
- V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 0xf3595200) \
- V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, 0xb3cc1803) \
- V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, 0xbe4aee59) \
- V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0x89b17e2a) \
- V(_TypedList, _setUint8, ByteArrayBaseSetUint8, 0x5781f1d0) \
- V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0x630e7aaf) \
- V(_TypedList, _setUint16, ByteArrayBaseSetUint16, 0x764a82d7) \
- V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0x6602e5c8) \
- V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0x618ede3a) \
- V(_TypedList, _setInt64, ByteArrayBaseSetInt64, 0x70f58a02) \
- V(_TypedList, _setUint64, ByteArrayBaseSetUint64, 0x826f6c8d) \
- V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x2761c274) \
- V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x1b858d66) \
- V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x9e2320c0) \
- V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0xfa1f5cf1) \
- V(ByteData, ., ByteDataFactory, 0x1a2bee78) \
- V(_ByteDataView, get:offsetInBytes, ByteDataViewOffsetInBytes, 0x3915c92a) \
- V(_ByteDataView, get:_typedData, ByteDataViewTypedData, 0x487f857c) \
- V(_TypedListView, get:offsetInBytes, TypedDataViewOffsetInBytes, 0x3915c92a) \
- V(_TypedListView, get:_typedData, TypedDataViewTypedData, 0x487f857c) \
- V(_ByteDataView, ._, TypedData_ByteDataView_factory, 0xbdff93f4) \
- V(_Int8ArrayView, ._, TypedData_Int8ArrayView_factory, 0x955093e6) \
- V(_Uint8ArrayView, ._, TypedData_Uint8ArrayView_factory, 0x666697bb) \
+ V(::, identical, ObjectIdentical, 0x04168315) \
+ V(ClassID, getID, ClassIDgetID, 0xbe1d6669) \
+ V(Object, Object., ObjectConstructor, 0xab6d6cfa) \
+ V(List, ., ListFactory, 0xbc820cf9) \
+ V(_List, ., ObjectArrayAllocate, 0xd693eee6) \
+ V(_List, []=, ObjectArraySetIndexed, 0xac001598) \
+ V(_GrowableList, []=, GrowableArraySetIndexed, 0xac001598) \
+ V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 0x1623dc34) \
+ V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 0x177ffe2a) \
+ V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 0x2e40964f) \
+ V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 0x2fc1f6b9) \
+ V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 0x19182d0a) \
+ V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 0x195d6e7b) \
+ V(_TypedList, _getInt64, ByteArrayBaseGetInt64, 0xf660bfff) \
+ V(_TypedList, _getUint64, ByteArrayBaseGetUint64, 0x2c5b7959) \
+ V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 0xe8f6a107) \
+ V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 0xf82a3634) \
+ V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, 0xaf2d0ce5) \
+ V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, 0x5573740b) \
+ V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0xe18943a2) \
+ V(_TypedList, _setUint8, ByteArrayBaseSetUint8, 0xaf59b748) \
+ V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0xbae64027) \
+ V(_TypedList, _setUint16, ByteArrayBaseSetUint16, 0xce22484f) \
+ V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0xbddaab40) \
+ V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0xb966a3b2) \
+ V(_TypedList, _setInt64, ByteArrayBaseSetInt64, 0xc8cd4f7a) \
+ V(_TypedList, _setUint64, ByteArrayBaseSetUint64, 0xda473205) \
+ V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x2f362de0) \
+ V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x2359f8d2) \
+ V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x38c6295a) \
+ V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0x5ce9025b) \
+ V(ByteData, ., ByteDataFactory, 0xd12ef748) \
+ V(_ByteDataView, get:offsetInBytes, ByteDataViewOffsetInBytes, 0x60cef22c) \
+ V(_ByteDataView, get:_typedData, ByteDataViewTypedData, 0xb9d15ffa) \
+ V(_TypedListView, get:offsetInBytes, TypedDataViewOffsetInBytes, 0x60cef22c) \
+ V(_TypedListView, get:_typedData, TypedDataViewTypedData, 0xb9d15ffa) \
+ V(_ByteDataView, ._, TypedData_ByteDataView_factory, 0x3187137c) \
+ V(_Int8ArrayView, ._, TypedData_Int8ArrayView_factory, 0x445611ca) \
+ V(_Uint8ArrayView, ._, TypedData_Uint8ArrayView_factory, 0x96008895) \
V(_Uint8ClampedArrayView, ._, TypedData_Uint8ClampedArrayView_factory, \
- 0x0f265d67) \
- V(_Int16ArrayView, ._, TypedData_Int16ArrayView_factory, 0x95778bb5) \
- V(_Uint16ArrayView, ._, TypedData_Uint16ArrayView_factory, 0xc9d1b27e) \
- V(_Int32ArrayView, ._, TypedData_Int32ArrayView_factory, 0x609fa957) \
- V(_Uint32ArrayView, ._, TypedData_Uint32ArrayView_factory, 0x0b0ff42f) \
- V(_Int64ArrayView, ._, TypedData_Int64ArrayView_factory, 0xbd01a661) \
- V(_Uint64ArrayView, ._, TypedData_Uint64ArrayView_factory, 0x9c964453) \
- V(_Float32ArrayView, ._, TypedData_Float32ArrayView_factory, 0x9a39e22c) \
- V(_Float64ArrayView, ._, TypedData_Float64ArrayView_factory, 0x78a432f9) \
- V(_Float32x4ArrayView, ._, TypedData_Float32x4ArrayView_factory, 0x85e58030) \
- V(_Int32x4ArrayView, ._, TypedData_Int32x4ArrayView_factory, 0x5132754b) \
- V(_Float64x2ArrayView, ._, TypedData_Float64x2ArrayView_factory, 0x9d86a6cc) \
- V(Int8List, ., TypedData_Int8Array_factory, 0x934e97a2) \
- V(Uint8List, ., TypedData_Uint8Array_factory, 0x7eea24fb) \
- V(Uint8ClampedList, ., TypedData_Uint8ClampedArray_factory, 0xba98ab35) \
- V(Int16List, ., TypedData_Int16Array_factory, 0x54af9dd7) \
- V(Uint16List, ., TypedData_Uint16Array_factory, 0xc3859080) \
- V(Int32List, ., TypedData_Int32Array_factory, 0x3e52ca0a) \
- V(Uint32List, ., TypedData_Uint32Array_factory, 0xdbbb093f) \
- V(Int64List, ., TypedData_Int64Array_factory, 0x560fc11b) \
- V(Uint64List, ., TypedData_Uint64Array_factory, 0x02b7f232) \
- V(Float32List, ., TypedData_Float32Array_factory, 0xdf9d206c) \
- V(Float64List, ., TypedData_Float64Array_factory, 0x321abc79) \
- V(Float32x4List, ., TypedData_Float32x4Array_factory, 0xa0de94a2) \
- V(Int32x4List, ., TypedData_Int32x4Array_factory, 0xfe46a6fc) \
- V(Float64x2List, ., TypedData_Float64x2Array_factory, 0xfac00c80) \
- V(::, _toClampedUint8, ConvertIntToClampedUint8, 0x84e4b390) \
+ 0x05397869) \
+ V(_Int16ArrayView, ._, TypedData_Int16ArrayView_factory, 0x490e13db) \
+ V(_Uint16ArrayView, ._, TypedData_Uint16ArrayView_factory, 0x9ff8c632) \
+ V(_Int32ArrayView, ._, TypedData_Int32ArrayView_factory, 0xe2e9aa79) \
+ V(_Uint32ArrayView, ._, TypedData_Uint32ArrayView_factory, 0x8682baa1) \
+ V(_Int64ArrayView, ._, TypedData_Int64ArrayView_factory, 0x12c74eaf) \
+ V(_Uint64ArrayView, ._, TypedData_Uint64ArrayView_factory, 0x25c66efd) \
+ V(_Float32ArrayView, ._, TypedData_Float32ArrayView_factory, 0xdc968c44) \
+ V(_Float64ArrayView, ._, TypedData_Float64ArrayView_factory, 0xcb765517) \
+ V(_Float32x4ArrayView, ._, TypedData_Float32x4ArrayView_factory, 0x665eaec0) \
+ V(_Int32x4ArrayView, ._, TypedData_Int32x4ArrayView_factory, 0x04b05d05) \
+ V(_Float64x2ArrayView, ._, TypedData_Float64x2ArrayView_factory, 0x42e25ba4) \
+ V(Int8List, ., TypedData_Int8Array_factory, 0x660dd888) \
+ V(Uint8List, ., TypedData_Uint8Array_factory, 0xede3f64f) \
+ V(Uint8ClampedList, ., TypedData_Uint8ClampedArray_factory, 0x28063755) \
+ V(Int16List, ., TypedData_Int16Array_factory, 0xd0cd98f3) \
+ V(Uint16List, ., TypedData_Uint16Array_factory, 0x3cb5fb6a) \
+ V(Int32List, ., TypedData_Int32Array_factory, 0x1b8ff320) \
+ V(Uint32List, ., TypedData_Uint32Array_factory, 0x2b2f9a8b) \
+ V(Int64List, ., TypedData_Int64Array_factory, 0xfb71de2f) \
+ V(Uint64List, ., TypedData_Uint64Array_factory, 0xe3cfcff8) \
+ V(Float32List, ., TypedData_Float32Array_factory, 0xa39068fe) \
+ V(Float64List, ., TypedData_Float64Array_factory, 0xa0c64e91) \
+ V(Float32x4List, ., TypedData_Float32x4Array_factory, 0x0a7d7b88) \
+ V(Int32x4List, ., TypedData_Int32x4Array_factory, 0x5a17b46e) \
+ V(Float64x2List, ., TypedData_Float64x2Array_factory, 0xeccaff6a) \
+ V(::, _toClampedUint8, ConvertIntToClampedUint8, 0x6f65a4d0) \
V(::, copyRangeFromUint8ListToOneByteString, \
- CopyRangeFromUint8ListToOneByteString, 0xeb5abaa9) \
- V(_StringBase, _interpolate, StringBaseInterpolate, 0xe8ece5a1) \
- V(_IntegerImplementation, toDouble, IntegerToDouble, 0x33d887fc) \
- V(_Double, _add, DoubleAdd, 0x1ba15967) \
- V(_Double, _sub, DoubleSub, 0x5982426e) \
- V(_Double, _mul, DoubleMul, 0x50d3bdac) \
- V(_Double, _div, DoubleDiv, 0x59b82dd1) \
- V(::, min, MathMin, 0xa24c3a83) \
- V(::, max, MathMax, 0x8552d67e) \
- V(::, _doublePow, MathDoublePow, 0x9441cc3a) \
- V(::, _intPow, MathIntPow, 0x409dd978) \
- V(Float32x4, _Float32x4FromDoubles, Float32x4FromDoubles, 0x790497df) \
- V(Float32x4, Float32x4.zero, Float32x4Zero, 0x9657735e) \
- V(Float32x4, _Float32x4Splat, Float32x4Splat, 0xb0d7702d) \
- V(Float32x4, Float32x4.fromInt32x4Bits, Int32x4ToFloat32x4, 0xda38dd92) \
- V(Float32x4, Float32x4.fromFloat64x2, Float64x2ToFloat32x4, 0xe41a2079) \
- V(_Float32x4, shuffle, Float32x4Shuffle, 0xac90c309) \
- V(_Float32x4, shuffleMix, Float32x4ShuffleMix, 0x3d6d7e46) \
- V(_Float32x4, get:signMask, Float32x4GetSignMask, 0x54b1e8e8) \
- V(_Float32x4, equal, Float32x4Equal, 0xc9591626) \
- V(_Float32x4, greaterThan, Float32x4GreaterThan, 0xd74ba62f) \
- V(_Float32x4, greaterThanOrEqual, Float32x4GreaterThanOrEqual, 0xd36c8a67) \
- V(_Float32x4, lessThan, Float32x4LessThan, 0xcf1699cd) \
- V(_Float32x4, lessThanOrEqual, Float32x4LessThanOrEqual, 0xcb757bf0) \
- V(_Float32x4, notEqual, Float32x4NotEqual, 0xe94d5df3) \
- V(_Float32x4, min, Float32x4Min, 0x04e45812) \
- V(_Float32x4, max, Float32x4Max, 0xe713d9e3) \
- V(_Float32x4, scale, Float32x4Scale, 0xde622d94) \
- V(_Float32x4, sqrt, Float32x4Sqrt, 0xa7982e0e) \
- V(_Float32x4, reciprocalSqrt, Float32x4ReciprocalSqrt, 0xa0792594) \
- V(_Float32x4, reciprocal, Float32x4Reciprocal, 0x96f355ce) \
- V(_Float32x4, unary-, Float32x4Negate, 0xa94cf76e) \
- V(_Float32x4, abs, Float32x4Abs, 0xade7b1a4) \
- V(_Float32x4, clamp, Float32x4Clamp, 0x57c0dbb9) \
- V(_Float32x4, _withX, Float32x4WithX, 0xddc28541) \
- V(_Float32x4, _withY, Float32x4WithY, 0xd66499d5) \
- V(_Float32x4, _withZ, Float32x4WithZ, 0xd2811432) \
- V(_Float32x4, _withW, Float32x4WithW, 0xcfde07ed) \
- V(Float64x2, _Float64x2FromDoubles, Float64x2FromDoubles, 0x9f0a0865) \
- V(Float64x2, Float64x2.zero, Float64x2Zero, 0x30a0af88) \
- V(Float64x2, _Float64x2Splat, Float64x2Splat, 0xe169544e) \
- V(Float64x2, Float64x2.fromFloat32x4, Float32x4ToFloat64x2, 0x7ad848fa) \
- V(_Float64x2, get:x, Float64x2GetX, 0xf36ac93a) \
- V(_Float64x2, get:y, Float64x2GetY, 0xe0fc245d) \
- V(_Float64x2, unary-, Float64x2Negate, 0x43963398) \
- V(_Float64x2, abs, Float64x2Abs, 0x4830edce) \
- V(_Float64x2, sqrt, Float64x2Sqrt, 0x41e16a38) \
- V(_Float64x2, get:signMask, Float64x2GetSignMask, 0x54b1e8e8) \
- V(_Float64x2, scale, Float64x2Scale, 0x78ab69be) \
- V(_Float64x2, _withX, Float64x2WithX, 0x780bc16b) \
- V(_Float64x2, _withY, Float64x2WithY, 0x70add5ff) \
- V(_Float64x2, min, Float64x2Min, 0xb4f56252) \
- V(_Float64x2, max, Float64x2Max, 0x9724e423) \
- V(Int32x4, _Int32x4FromInts, Int32x4FromInts, 0x533214b0) \
- V(Int32x4, _Int32x4FromBools, Int32x4FromBools, 0x17964f48) \
- V(Int32x4, Int32x4.fromFloat32x4Bits, Float32x4ToInt32x4, 0xca709e11) \
- V(_Int32x4, get:flagX, Int32x4GetFlagX, 0x998cbdb6) \
- V(_Int32x4, get:flagY, Int32x4GetFlagY, 0xb4fcf496) \
- V(_Int32x4, get:flagZ, Int32x4GetFlagZ, 0xc2a68fe9) \
- V(_Int32x4, get:flagW, Int32x4GetFlagW, 0xcbc6a22a) \
- V(_Int32x4, get:signMask, Int32x4GetSignMask, 0x54b1e8e8) \
- V(_Int32x4, shuffle, Int32x4Shuffle, 0xa9398c21) \
- V(_Int32x4, shuffleMix, Int32x4ShuffleMix, 0x0a889276) \
- V(_Int32x4, select, Int32x4Select, 0x48be097c) \
- V(_Int32x4, _withFlagX, Int32x4WithFlagX, 0x7f4a63d1) \
- V(_Int32x4, _withFlagY, Int32x4WithFlagY, 0x703aff14) \
- V(_Int32x4, _withFlagZ, Int32x4WithFlagZ, 0x6f70ebc2) \
- V(_Int32x4, _withFlagW, Int32x4WithFlagW, 0x7a9f5cc6) \
- V(_HashVMBase, get:_index, LinkedHashMap_getIndex, 0xf6b408ce) \
- V(_HashVMBase, set:_index, LinkedHashMap_setIndex, 0xb0967252) \
- V(_HashVMBase, get:_data, LinkedHashMap_getData, 0xe81ec483) \
- V(_HashVMBase, set:_data, LinkedHashMap_setData, 0x719e1187) \
- V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, 0x1f4f6aeb) \
- V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, 0xa209d2ef) \
- V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, 0x27559e9a) \
- V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, 0xaa10069e) \
- V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, 0x29549b9e) \
- V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, 0xac0f03a2) \
- V(_WeakProperty, get:key, WeakProperty_getKey, 0x16b8624c) \
- V(_WeakProperty, set:key, WeakProperty_setKey, 0x8b5df091) \
- V(_WeakProperty, get:value, WeakProperty_getValue, 0x0baa0898) \
- V(_WeakProperty, set:value, WeakProperty_setValue, 0x804f96dd) \
- V(::, _classRangeCheck, ClassRangeCheck, 0x071d2ec8) \
- V(::, _abi, FfiAbi, 0x54918e73) \
- V(::, _asFunctionInternal, FfiAsFunctionInternal, 0x2d4e5e32) \
- V(::, _nativeCallbackFunction, FfiNativeCallbackFunction, 0x68db1afc) \
- V(::, _loadInt8, FfiLoadInt8, 0x3b38d254) \
- V(::, _loadInt16, FfiLoadInt16, 0x187823ab) \
- V(::, _loadInt32, FfiLoadInt32, 0x1a563241) \
- V(::, _loadInt64, FfiLoadInt64, 0x0b23b221) \
- V(::, _loadUint8, FfiLoadUint8, 0x0d820f4f) \
- V(::, _loadUint16, FfiLoadUint16, 0x390a4f68) \
- V(::, _loadUint32, FfiLoadUint32, 0x22a282d3) \
- V(::, _loadUint64, FfiLoadUint64, 0x3139f04a) \
- V(::, _loadIntPtr, FfiLoadIntPtr, 0x180da6bc) \
- V(::, _loadFloat, FfiLoadFloat, 0x05f7e3e7) \
- V(::, _loadDouble, FfiLoadDouble, 0x042b25a3) \
- V(::, _loadPointer, FfiLoadPointer, 0x117833fa) \
- V(::, _storeInt8, FfiStoreInt8, 0xdaa635d2) \
- V(::, _storeInt16, FfiStoreInt16, 0xd3a379f8) \
- V(::, _storeInt32, FfiStoreInt32, 0xf73bb323) \
- V(::, _storeInt64, FfiStoreInt64, 0xed299440) \
- V(::, _storeUint8, FfiStoreUint8, 0x00c359bc) \
- V(::, _storeUint16, FfiStoreUint16, 0xde5331a4) \
- V(::, _storeUint32, FfiStoreUint32, 0xe12d6f8b) \
- V(::, _storeUint64, FfiStoreUint64, 0xde2eb8ff) \
- V(::, _storeIntPtr, FfiStoreIntPtr, 0x0357ed6e) \
- V(::, _storeFloat, FfiStoreFloat, 0xafddd150) \
- V(::, _storeDouble, FfiStoreDouble, 0x8df26d36) \
- V(::, _storePointer, FfiStorePointer, 0xf3b14e97) \
- V(::, _fromAddress, FfiFromAddress, 0x811e2220) \
- V(Pointer, get:address, FfiGetAddress, 0x55255ebc) \
- V(::, reachabilityFence, ReachabilityFence, 0xde1dc5bd) \
- V(_Utf8Decoder, _scan, Utf8DecoderScan, 0xb35ced99) \
- V(_Future, timeout, FutureTimeout, 0x6ad7d1ef) \
- V(Future, wait, FutureWait, 0x264aacc2) \
- V(_RootZone, runUnary, RootZoneRunUnary, 0x76e41d34) \
- V(_FutureListener, handleValue, FutureListenerHandleValue, 0x73894d16) \
+ CopyRangeFromUint8ListToOneByteString, 0x8302f9d9) \
+ V(_StringBase, _interpolate, StringBaseInterpolate, 0xec019c89) \
+ V(_IntegerImplementation, toDouble, IntegerToDouble, 0x97728b46) \
+ V(_Double, _add, DoubleAdd, 0xea666327) \
+ V(_Double, _sub, DoubleSub, 0x28474c2e) \
+ V(_Double, _mul, DoubleMul, 0x1f98c76c) \
+ V(_Double, _div, DoubleDiv, 0x287d3791) \
+ V(::, min, MathMin, 0x1cee3d43) \
+ V(::, max, MathMax, 0xbf7a293e) \
+ V(::, _doublePow, MathDoublePow, 0x701a00c4) \
+ V(::, _intPow, MathIntPow, 0x9e2bb83a) \
+ V(Float32x4, _Float32x4FromDoubles, Float32x4FromDoubles, 0x1845792b) \
+ V(Float32x4, Float32x4.zero, Float32x4Zero, 0xd3b64002) \
+ V(Float32x4, _Float32x4Splat, Float32x4Splat, 0x13a552c3) \
+ V(Float32x4, Float32x4.fromInt32x4Bits, Int32x4ToFloat32x4, 0x7ed59542) \
+ V(Float32x4, Float32x4.fromFloat64x2, Float64x2ToFloat32x4, 0x50be8d8d) \
+ V(_Float32x4, shuffle, Float32x4Shuffle, 0xa7f1b7eb) \
+ V(_Float32x4, shuffleMix, Float32x4ShuffleMix, 0x79a0c2cc) \
+ V(_Float32x4, get:signMask, Float32x4GetSignMask, 0x7c6b11ea) \
+ V(_Float32x4, equal, Float32x4Equal, 0x445aed76) \
+ V(_Float32x4, greaterThan, Float32x4GreaterThan, 0x524d7d7f) \
+ V(_Float32x4, greaterThanOrEqual, Float32x4GreaterThanOrEqual, 0x4e6e61b7) \
+ V(_Float32x4, lessThan, Float32x4LessThan, 0x4a18711d) \
+ V(_Float32x4, lessThanOrEqual, Float32x4LessThanOrEqual, 0x46775340) \
+ V(_Float32x4, notEqual, Float32x4NotEqual, 0x644f3543) \
+ V(_Float32x4, min, Float32x4Min, 0xe41e9e92) \
+ V(_Float32x4, max, Float32x4Max, 0xc64e2063) \
+ V(_Float32x4, scale, Float32x4Scale, 0xa3b74802) \
+ V(_Float32x4, sqrt, Float32x4Sqrt, 0xe4f6fab2) \
+ V(_Float32x4, reciprocalSqrt, Float32x4ReciprocalSqrt, 0xddd7f238) \
+ V(_Float32x4, reciprocal, Float32x4Reciprocal, 0xd4522272) \
+ V(_Float32x4, unary-, Float32x4Negate, 0xe6abc412) \
+ V(_Float32x4, abs, Float32x4Abs, 0xeb467e48) \
+ V(_Float32x4, clamp, Float32x4Clamp, 0x77cd71dd) \
+ V(_Float32x4, _withX, Float32x4WithX, 0xa3179faf) \
+ V(_Float32x4, _withY, Float32x4WithY, 0x9bb9b443) \
+ V(_Float32x4, _withZ, Float32x4WithZ, 0x97d62ea0) \
+ V(_Float32x4, _withW, Float32x4WithW, 0x9533225b) \
+ V(Float64x2, _Float64x2FromDoubles, Float64x2FromDoubles, 0xd858e051) \
+ V(Float64x2, Float64x2.zero, Float64x2Zero, 0x82948918) \
+ V(Float64x2, _Float64x2Splat, Float64x2Splat, 0x5b136bc4) \
+ V(Float64x2, Float64x2.fromFloat32x4, Float32x4ToFloat64x2, 0x6ea79c66) \
+ V(_Float64x2, get:x, Float64x2GetX, 0x3a398530) \
+ V(_Float64x2, get:y, Float64x2GetY, 0x27cae053) \
+ V(_Float64x2, unary-, Float64x2Negate, 0x958a0d28) \
+ V(_Float64x2, abs, Float64x2Abs, 0x9a24c75e) \
+ V(_Float64x2, sqrt, Float64x2Sqrt, 0x93d543c8) \
+ V(_Float64x2, get:signMask, Float64x2GetSignMask, 0x7c6b11ea) \
+ V(_Float64x2, scale, Float64x2Scale, 0x52959118) \
+ V(_Float64x2, _withX, Float64x2WithX, 0x51f5e8c5) \
+ V(_Float64x2, _withY, Float64x2WithY, 0x4a97fd59) \
+ V(_Float64x2, min, Float64x2Min, 0x362edc52) \
+ V(_Float64x2, max, Float64x2Max, 0x185e5e23) \
+ V(Int32x4, _Int32x4FromInts, Int32x4FromInts, 0xa900bd30) \
+ V(Int32x4, _Int32x4FromBools, Int32x4FromBools, 0xf56c8fc8) \
+ V(Int32x4, Int32x4.fromFloat32x4Bits, Float32x4ToInt32x4, 0x45727561) \
+ V(_Int32x4, get:flagX, Int32x4GetFlagX, 0xc29f03d8) \
+ V(_Int32x4, get:flagY, Int32x4GetFlagY, 0xde0f3ab8) \
+ V(_Int32x4, get:flagZ, Int32x4GetFlagZ, 0xebb8d60b) \
+ V(_Int32x4, get:flagW, Int32x4GetFlagW, 0xf4d8e84c) \
+ V(_Int32x4, get:signMask, Int32x4GetSignMask, 0x7c6b11ea) \
+ V(_Int32x4, shuffle, Int32x4Shuffle, 0x406211d3) \
+ V(_Int32x4, shuffleMix, Int32x4ShuffleMix, 0x4fe8349c) \
+ V(_Int32x4, select, Int32x4Select, 0x68ca9fa0) \
+ V(_Int32x4, _withFlagX, Int32x4WithFlagX, 0xb7df0063) \
+ V(_Int32x4, _withFlagY, Int32x4WithFlagY, 0xa8cf9ba6) \
+ V(_Int32x4, _withFlagZ, Int32x4WithFlagZ, 0xa8058854) \
+ V(_Int32x4, _withFlagW, Int32x4WithFlagW, 0xb333f958) \
+ V(_HashVMBase, get:_index, LinkedHashMap_getIndex, 0x882671dc) \
+ V(_HashVMBase, set:_index, LinkedHashMap_setIndex, 0xa2be9418) \
+ V(_HashVMBase, get:_data, LinkedHashMap_getData, 0x780e14ad) \
+ V(_HashVMBase, set:_data, LinkedHashMap_setData, 0xb6a5c369) \
+ V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, 0x470893ed) \
+ V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, 0xb3c887a9) \
+ V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, 0x4f0ec79c) \
+ V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, 0xbbcebb58) \
+ V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, 0x510dc4a0) \
+ V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, 0xbdcdb85c) \
+ V(_WeakProperty, get:key, WeakProperty_getKey, 0xde00e462) \
+ V(_WeakProperty, set:key, WeakProperty_setKey, 0x963a095f) \
+ V(_WeakProperty, get:value, WeakProperty_getValue, 0xd2f28aae) \
+ V(_WeakProperty, set:value, WeakProperty_setValue, 0x8b2bafab) \
+ V(::, _classRangeCheck, ClassRangeCheck, 0x5fd51e68) \
+ V(::, _abi, FfiAbi, 0x7c4ab775) \
+ V(::, _asFunctionInternal, FfiAsFunctionInternal, 0xbbcb235a) \
+ V(::, _nativeCallbackFunction, FfiNativeCallbackFunction, 0x3ff5ae9c) \
+ V(::, _loadInt8, FfiLoadInt8, 0xa54bed8c) \
+ V(::, _loadInt16, FfiLoadInt16, 0x828b3ee3) \
+ V(::, _loadInt32, FfiLoadInt32, 0x84694d79) \
+ V(::, _loadInt64, FfiLoadInt64, 0x7536cd59) \
+ V(::, _loadUint8, FfiLoadUint8, 0x77952a87) \
+ V(::, _loadUint16, FfiLoadUint16, 0xa31d6aa0) \
+ V(::, _loadUint32, FfiLoadUint32, 0x8cb59e0b) \
+ V(::, _loadUint64, FfiLoadUint64, 0x9b4d0b82) \
+ V(::, _loadIntPtr, FfiLoadIntPtr, 0x8220c1f4) \
+ V(::, _loadFloat, FfiLoadFloat, 0x8f209213) \
+ V(::, _loadDouble, FfiLoadDouble, 0x8d53d3cf) \
+ V(::, _loadPointer, FfiLoadPointer, 0xc50e1486) \
+ V(::, _storeInt8, FfiStoreInt8, 0x000b2742) \
+ V(::, _storeInt16, FfiStoreInt16, 0xf9086b68) \
+ V(::, _storeInt32, FfiStoreInt32, 0x1ca0a493) \
+ V(::, _storeInt64, FfiStoreInt64, 0x128e85b0) \
+ V(::, _storeUint8, FfiStoreUint8, 0x26284b2c) \
+ V(::, _storeUint16, FfiStoreUint16, 0x03b82314) \
+ V(::, _storeUint32, FfiStoreUint32, 0x069260fb) \
+ V(::, _storeUint64, FfiStoreUint64, 0x0393aa6f) \
+ V(::, _storeIntPtr, FfiStoreIntPtr, 0x28bcdede) \
+ V(::, _storeFloat, FfiStoreFloat, 0x853f68b4) \
+ V(::, _storeDouble, FfiStoreDouble, 0x6354049a) \
+ V(::, _storePointer, FfiStorePointer, 0x0cfd005b) \
+ V(::, _fromAddress, FfiFromAddress, 0xfd8cb1cc) \
+ V(Pointer, get:address, FfiGetAddress, 0x7cde87be) \
+ V(::, reachabilityFence, ReachabilityFence, 0x619235c1) \
+ V(_Utf8Decoder, _scan, Utf8DecoderScan, 0x4983e111) \
+ V(_Future, timeout, FutureTimeout, 0xc83eaf79) \
+ V(Future, wait, FutureWait, 0x99cfb096) \
+ V(_RootZone, runUnary, RootZoneRunUnary, 0x966a802c) \
+ V(_FutureListener, handleValue, FutureListenerHandleValue, 0x165b47c4) \
// List of intrinsics:
// (class-name, function-name, intrinsification method, fingerprint).
#define CORE_LIB_INTRINSIC_LIST(V) \
- V(_Smi, ~, Smi_bitNegate, 0x5a9bcc19) \
- V(_Smi, get:bitLength, Smi_bitLength, 0x52fbe3e9) \
- V(_Smi, _bitAndFromSmi, Smi_bitAndFromSmi, 0x7818c386) \
- V(_BigIntImpl, _lsh, Bigint_lsh, 0xb7f65896) \
- V(_BigIntImpl, _rsh, Bigint_rsh, 0x3922f42b) \
- V(_BigIntImpl, _absAdd, Bigint_absAdd, 0x295e93f3) \
- V(_BigIntImpl, _absSub, Bigint_absSub, 0x273f7af1) \
- V(_BigIntImpl, _mulAdd, Bigint_mulAdd, 0xba45f6ad) \
- V(_BigIntImpl, _sqrAdd, Bigint_sqrAdd, 0x2db11c6b) \
+ V(_Smi, ~, Smi_bitNegate, 0x8254f51b) \
+ V(_Smi, get:bitLength, Smi_bitLength, 0x7ab50ceb) \
+ V(_Smi, _bitAndFromSmi, Smi_bitAndFromSmi, 0xaf07a450) \
+ V(_BigIntImpl, _lsh, Bigint_lsh, 0x3f8b105e) \
+ V(_BigIntImpl, _rsh, Bigint_rsh, 0x117ed3f3) \
+ V(_BigIntImpl, _absAdd, Bigint_absAdd, 0xd55235d1) \
+ V(_BigIntImpl, _absSub, Bigint_absSub, 0xe4a9dacf) \
+ V(_BigIntImpl, _mulAdd, Bigint_mulAdd, 0x6dab2009) \
+ V(_BigIntImpl, _sqrAdd, Bigint_sqrAdd, 0x4ea2b411) \
V(_BigIntImpl, _estimateQuotientDigit, Bigint_estimateQuotientDigit, \
- 0x3c62c74c) \
- V(_BigIntMontgomeryReduction, _mulMod, Montgomery_mulMod, 0x091127d0) \
- V(_Double, >, Double_greaterThan, 0xc4a96c0f) \
- V(_Double, >=, Double_greaterEqualThan, 0x335a31b3) \
- V(_Double, <, Double_lessThan, 0x059b1fd8) \
- V(_Double, <=, Double_lessEqualThan, 0xeb04cf95) \
- V(_Double, ==, Double_equal, 0x094145f1) \
- V(_Double, +, Double_add, 0x74e922bb) \
- V(_Double, -, Double_sub, 0x67d62f0c) \
- V(_Double, *, Double_mul, 0xa95d3909) \
- V(_Double, /, Double_div, 0x9f8bc745) \
- V(_Double, get:hashCode, Double_hashCode, 0x4e27a791) \
- V(_Double, get:_identityHashCode, Double_identityHash, 0x1fec3c4f) \
- V(_Double, get:isNaN, Double_getIsNaN, 0xab76c0f1) \
- V(_Double, get:isInfinite, Double_getIsInfinite, 0x9be885b0) \
- V(_Double, get:isNegative, Double_getIsNegative, 0xab5f0a6f) \
- V(_Double, _mulFromInteger, Double_mulFromInteger, 0x88ace077) \
- V(_Double, .fromInteger, DoubleFromInteger, 0x0f908a15) \
- V(_GrowableList, ._withData, GrowableArray_Allocate, 0x1947d8a1) \
- V(_RegExp, _ExecuteMatch, RegExp_ExecuteMatch, 0xd8114d5f) \
- V(_RegExp, _ExecuteMatchSticky, RegExp_ExecuteMatchSticky, 0xd0dd0025) \
- V(Object, ==, ObjectEquals, 0xd3f5f95a) \
- V(Object, get:runtimeType, ObjectRuntimeType, 0x81775ebd) \
- V(Object, _haveSameRuntimeType, ObjectHaveSameRuntimeType, 0xe61da79f) \
- V(_StringBase, get:hashCode, String_getHashCode, 0x4e27ab52) \
- V(_StringBase, get:_identityHashCode, String_identityHash, 0x1fec4010) \
- V(_StringBase, get:isEmpty, StringBaseIsEmpty, 0xfda61c55) \
- V(_StringBase, _substringMatches, StringBaseSubstringMatches, 0xf07e5912) \
- V(_StringBase, [], StringBaseCharAt, 0x6c55f9a1) \
- V(_OneByteString, get:hashCode, OneByteString_getHashCode, 0x4e27ab52) \
+ 0x898ea14c) \
+ V(_BigIntMontgomeryReduction, _mulMod, Montgomery_mulMod, 0x0d038dd0) \
+ V(_Double, >, Double_greaterThan, 0xe450adaf) \
+ V(_Double, >=, Double_greaterEqualThan, 0xbc280c13) \
+ V(_Double, <, Double_lessThan, 0x39643178) \
+ V(_Double, <=, Double_lessEqualThan, 0x73d2a9f5) \
+ V(_Double, ==, Double_equal, 0xaca03d47) \
+ V(_Double, +, Double_add, 0x11250707) \
+ V(_Double, -, Double_sub, 0x04121358) \
+ V(_Double, *, Double_mul, 0x45991d55) \
+ V(_Double, /, Double_div, 0x3bc7ab91) \
+ V(_Double, get:hashCode, Double_hashCode, 0x75e0d093) \
+ V(_Double, get:_identityHashCode, Double_identityHash, 0x47a56551) \
+ V(_Double, get:isNaN, Double_getIsNaN, 0xd4890713) \
+ V(_Double, get:isInfinite, Double_getIsInfinite, 0xc4facbd2) \
+ V(_Double, get:isNegative, Double_getIsNegative, 0xd4715091) \
+ V(_Double, _mulFromInteger, Double_mulFromInteger, 0xf9e516ab) \
+ V(_Double, .fromInteger, DoubleFromInteger, 0x7d0fd999) \
+ V(_GrowableList, ._withData, GrowableArray_Allocate, 0xa32d060b) \
+ V(_RegExp, _ExecuteMatch, RegExp_ExecuteMatch, 0x9911d549) \
+ V(_RegExp, _ExecuteMatchSticky, RegExp_ExecuteMatchSticky, 0x91dd880f) \
+ V(Object, ==, ObjectEquals, 0x46587030) \
+ V(Object, get:runtimeType, ObjectRuntimeType, 0x0381c851) \
+ V(Object, _haveSameRuntimeType, ObjectHaveSameRuntimeType, 0xce4e6295) \
+ V(_StringBase, get:hashCode, String_getHashCode, 0x75e0d454) \
+ V(_StringBase, get:_identityHashCode, String_identityHash, 0x47a56912) \
+ V(_StringBase, get:isEmpty, StringBaseIsEmpty, 0x9ce63f77) \
+ V(_StringBase, _substringMatches, StringBaseSubstringMatches, 0x03fdc6ce) \
+ V(_StringBase, [], StringBaseCharAt, 0xd06fc6bf) \
+ V(_OneByteString, get:hashCode, OneByteString_getHashCode, 0x75e0d454) \
V(_OneByteString, _substringUncheckedNative, \
- OneByteString_substringUnchecked, 0xd81afdbe) \
- V(_OneByteString, ==, OneByteString_equality, 0x483ef8d2) \
- V(_TwoByteString, ==, TwoByteString_equality, 0x483ef8d2) \
- V(_Type, get:hashCode, Type_getHashCode, 0x4e27ab52) \
- V(_Type, ==, Type_equality, 0xd3f5f1d8) \
- V(_FunctionType, get:hashCode, FunctionType_getHashCode, 0x4e27ab52) \
- V(_FunctionType, ==, FunctionType_equality, 0xd3f5f1d8) \
- V(::, _getHash, Object_getHash, 0x1d1372ac) \
- V(::, _setHash, Object_setHash, 0x77e0bb27) \
+ OneByteString_substringUnchecked, 0x9b18195e) \
+ V(_OneByteString, ==, OneByteString_equality, 0xb50039a8) \
+ V(_TwoByteString, ==, TwoByteString_equality, 0xb50039a8) \
+ V(_Type, get:hashCode, Type_getHashCode, 0x75e0d454) \
+ V(_Type, ==, Type_equality, 0x465868ae) \
+ V(_FunctionType, get:hashCode, FunctionType_getHashCode, 0x75e0d454) \
+ V(_FunctionType, ==, FunctionType_equality, 0x465868ae) \
+ V(::, _getHash, Object_getHash, 0xc60ff758) \
+ V(::, _setHash, Object_setHash, 0x8f2a5b0b) \
#define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \
V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \
- 0x4965932b) \
- V(_IntegerImplementation, +, Integer_add, 0xaf966f4f) \
+ 0x2f20e46b) \
+ V(_IntegerImplementation, +, Integer_add, 0xd561008f) \
V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \
- 0x0fb6011f) \
- V(_IntegerImplementation, -, Integer_sub, 0xa39f7e40) \
+ 0xf571525f) \
+ V(_IntegerImplementation, -, Integer_sub, 0xc96a0f80) \
V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \
- 0x171d38be) \
- V(_IntegerImplementation, *, Integer_mul, 0x870ed2dd) \
+ 0xfcd889fe) \
+ V(_IntegerImplementation, *, Integer_mul, 0xacd9641d) \
V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \
- 0x3e1e1d4b) \
- V(_IntegerImplementation, ~/, Integer_truncDivide, 0xaade713f) \
- V(_IntegerImplementation, unary-, Integer_negate, 0x8c0ec194) \
+ 0x23d96e8b) \
+ V(_IntegerImplementation, ~/, Integer_truncDivide, 0xdda49e7f) \
+ V(_IntegerImplementation, unary-, Integer_negate, 0xf7a9a696) \
V(_IntegerImplementation, _bitAndFromInteger, Integer_bitAndFromInteger, \
- 0x398f434f) \
- V(_IntegerImplementation, &, Integer_bitAnd, 0xd8a76af3) \
+ 0x1f4a948f) \
+ V(_IntegerImplementation, &, Integer_bitAnd, 0x8b9d7c33) \
V(_IntegerImplementation, _bitOrFromInteger, Integer_bitOrFromInteger, \
- 0x2b1d2027) \
- V(_IntegerImplementation, |, Integer_bitOr, 0xdc51e4ab) \
+ 0x10d87167) \
+ V(_IntegerImplementation, |, Integer_bitOr, 0x8f47f5eb) \
V(_IntegerImplementation, _bitXorFromInteger, Integer_bitXorFromInteger, \
- 0x1c5cefeb) \
- V(_IntegerImplementation, ^, Integer_bitXor, 0x2542adb2) \
+ 0x0218412b) \
+ V(_IntegerImplementation, ^, Integer_bitXor, 0xd838bef2) \
V(_IntegerImplementation, _greaterThanFromInteger, \
- Integer_greaterThanFromInt, 0x838ddcc3) \
- V(_IntegerImplementation, >, Integer_greaterThan, 0x0c62013f) \
- V(_IntegerImplementation, ==, Integer_equal, 0x881c9ddc) \
+ Integer_greaterThanFromInt, 0x6aa24b23) \
+ V(_IntegerImplementation, >, Integer_greaterThan, 0x402b12df) \
+ V(_IntegerImplementation, ==, Integer_equal, 0x509c9146) \
V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \
- 0x89faaa62) \
- V(_IntegerImplementation, <, Integer_lessThan, 0x059b1fd8) \
- V(_IntegerImplementation, <=, Integer_lessEqualThan, 0xeb04cf95) \
- V(_IntegerImplementation, >=, Integer_greaterEqualThan, 0x335a31b3) \
- V(_IntegerImplementation, <<, Integer_shl, 0xc378efa5) \
- V(_IntegerImplementation, >>, Integer_sar, 0xe029aa4a) \
- V(_Double, toInt, DoubleToInteger, 0x3fb5f3e6) \
+ 0x710f18c2) \
+ V(_IntegerImplementation, <, Integer_lessThan, 0x39643178) \
+ V(_IntegerImplementation, <=, Integer_lessEqualThan, 0x73d2a9f5) \
+ V(_IntegerImplementation, >=, Integer_greaterEqualThan, 0xbc280c13) \
+ V(_IntegerImplementation, <<, Integer_shl, 0x766f00e5) \
+ V(_IntegerImplementation, >>, Integer_sar, 0x931fbb8a) \
+ V(_Double, toInt, DoubleToInteger, 0x676f1ce8) \
#define MATH_LIB_INTRINSIC_LIST(V) \
- V(::, sqrt, MathSqrt, 0x1d97494a) \
- V(_Random, _nextState, Random_nextState, 0x7e5ba345) \
+ V(::, sqrt, MathSqrt, 0x58c2a87e) \
+ V(_Random, _nextState, Random_nextState, 0x7207677d) \
#define GRAPH_MATH_LIB_INTRINSIC_LIST(V) \
- V(::, sin, MathSin, 0xb89b1cb1) \
- V(::, cos, MathCos, 0x82a25065) \
- V(::, tan, MathTan, 0x65b9839b) \
- V(::, asin, MathAsin, 0x7e24237c) \
- V(::, acos, MathAcos, 0xc484d233) \
- V(::, atan, MathAtan, 0xb6c154e6) \
- V(::, atan2, MathAtan2, 0x8e6e8a7b) \
+ V(::, sin, MathSin, 0xf3c67be5) \
+ V(::, cos, MathCos, 0xbdcdaf99) \
+ V(::, tan, MathTan, 0xa0e4e2cf) \
+ V(::, asin, MathAsin, 0xb94f82b0) \
+ V(::, acos, MathAcos, 0xffb03167) \
+ V(::, atan, MathAtan, 0xf1ecb41a) \
+ V(::, atan2, MathAtan2, 0xff585505) \
#define GRAPH_TYPED_DATA_INTRINSICS_LIST(V) \
- V(_Int8List, [], Int8ArrayGetIndexed, 0x0cc3b782) \
- V(_Int8List, []=, Int8ArraySetIndexed, 0xbbb0b00b) \
- V(_Uint8List, [], Uint8ArrayGetIndexed, 0x723c3b42) \
- V(_Uint8List, []=, Uint8ArraySetIndexed, 0x083fbbcf) \
- V(_ExternalUint8Array, [], ExternalUint8ArrayGetIndexed, 0x723c3b42) \
- V(_ExternalUint8Array, []=, ExternalUint8ArraySetIndexed, 0x083fbbcf) \
- V(_Uint8ClampedList, [], Uint8ClampedArrayGetIndexed, 0x723c3b42) \
- V(_Uint8ClampedList, []=, Uint8ClampedArraySetIndexed, 0xfe3f716f) \
+ V(_Int8List, [], Int8ArrayGetIndexed, 0x281e2e42) \
+ V(_Int8List, []=, Int8ArraySetIndexed, 0x7eb45f63) \
+ V(_Uint8List, [], Uint8ArrayGetIndexed, 0x8d96b202) \
+ V(_Uint8List, []=, Uint8ArraySetIndexed, 0xcb436b27) \
+ V(_ExternalUint8Array, [], ExternalUint8ArrayGetIndexed, 0x8d96b202) \
+ V(_ExternalUint8Array, []=, ExternalUint8ArraySetIndexed, 0xcb436b27) \
+ V(_Uint8ClampedList, [], Uint8ClampedArrayGetIndexed, 0x8d96b202) \
+ V(_Uint8ClampedList, []=, Uint8ClampedArraySetIndexed, 0xc14320c7) \
V(_ExternalUint8ClampedArray, [], ExternalUint8ClampedArrayGetIndexed, \
- 0x723c3b42) \
+ 0x8d96b202) \
V(_ExternalUint8ClampedArray, []=, ExternalUint8ClampedArraySetIndexed, \
- 0xfe3f716f) \
- V(_Int16List, [], Int16ArrayGetIndexed, 0xecc216e2) \
- V(_Int16List, []=, Int16ArraySetIndexed, 0x4c307396) \
- V(_Uint16List, [], Uint16ArrayGetIndexed, 0xd09af2e2) \
- V(_Uint16List, []=, Uint16ArraySetIndexed, 0x34731b0d) \
- V(_Int32List, [], Int32ArrayGetIndexed, 0xee5fbc81) \
- V(_Int32List, []=, Int32ArraySetIndexed, 0x2a64f035) \
- V(_Uint32List, [], Uint32ArrayGetIndexed, 0x3db22221) \
- V(_Uint32List, []=, Uint32ArraySetIndexed, 0x160864b5) \
- V(_Int64List, [], Int64ArrayGetIndexed, 0x272816c1) \
- V(_Int64List, []=, Int64ArraySetIndexed, 0x53c7e8d3) \
- V(_Uint64List, [], Uint64ArrayGetIndexed, 0x63ec7c41) \
- V(_Uint64List, []=, Uint64ArraySetIndexed, 0x1f295a0b) \
- V(_Float64List, [], Float64ArrayGetIndexed, 0x4a2c55fc) \
- V(_Float64List, []=, Float64ArraySetIndexed, 0x07ada825) \
- V(_Float32List, [], Float32ArrayGetIndexed, 0x202a571c) \
- V(_Float32List, []=, Float32ArraySetIndexed, 0x62fc0553) \
- V(_Float32x4List, [], Float32x4ArrayGetIndexed, 0x96b1f063) \
- V(_Float32x4List, []=, Float32x4ArraySetIndexed, 0x4897982e) \
- V(_Int32x4List, [], Int32x4ArrayGetIndexed, 0x9cc8b9ab) \
- V(_Int32x4List, []=, Int32x4ArraySetIndexed, 0x7307018e) \
- V(_Float64x2List, [], Float64x2ArrayGetIndexed, 0x674f0479) \
- V(_Float64x2List, []=, Float64x2ArraySetIndexed, 0x73d783c2) \
- V(_TypedList, get:length, TypedListLength, 0x3097c769) \
- V(_TypedListView, get:length, TypedListViewLength, 0x3097c769) \
- V(_ByteDataView, get:length, ByteDataViewLength, 0x3097c769) \
- V(_Float32x4, get:x, Float32x4ShuffleX, 0xf36ac93a) \
- V(_Float32x4, get:y, Float32x4ShuffleY, 0xe0fc245d) \
- V(_Float32x4, get:z, Float32x4ShuffleZ, 0x16c78ff3) \
- V(_Float32x4, get:w, Float32x4ShuffleW, 0xf907d475) \
- V(_Float32x4, *, Float32x4Mul, 0x06163607) \
- V(_Float32x4, /, Float32x4Div, 0xe164e8e2) \
- V(_Float32x4, -, Float32x4Sub, 0xfdf825ca) \
- V(_Float32x4, +, Float32x4Add, 0xd8bf5b59) \
- V(_Float64x2, *, Float64x2Mul, 0xb6273c86) \
- V(_Float64x2, /, Float64x2Div, 0x9175f322) \
- V(_Float64x2, -, Float64x2Sub, 0xae092c49) \
- V(_Float64x2, +, Float64x2Add, 0x88d061d8) \
+ 0xc14320c7) \
+ V(_Int16List, [], Int16ArrayGetIndexed, 0x081c8da2) \
+ V(_Int16List, []=, Int16ArraySetIndexed, 0x0f3422ee) \
+ V(_Uint16List, [], Uint16ArrayGetIndexed, 0xebf569a2) \
+ V(_Uint16List, []=, Uint16ArraySetIndexed, 0xf776ca65) \
+ V(_Int32List, [], Int32ArrayGetIndexed, 0x09ba3341) \
+ V(_Int32List, []=, Int32ArraySetIndexed, 0xed689f8d) \
+ V(_Uint32List, [], Uint32ArrayGetIndexed, 0x590c98e1) \
+ V(_Uint32List, []=, Uint32ArraySetIndexed, 0xd90c140d) \
+ V(_Int64List, [], Int64ArrayGetIndexed, 0x42828d81) \
+ V(_Int64List, []=, Int64ArraySetIndexed, 0xd7ba387b) \
+ V(_Uint64List, [], Uint64ArrayGetIndexed, 0x7f46f301) \
+ V(_Uint64List, []=, Uint64ArraySetIndexed, 0xa31ba9b3) \
+ V(_Float64List, [], Float64ArrayGetIndexed, 0x5fa1c248) \
+ V(_Float64List, []=, Float64ArraySetIndexed, 0x6ad3ba59) \
+ V(_Float32List, [], Float32ArrayGetIndexed, 0x359fc368) \
+ V(_Float32List, []=, Float32ArraySetIndexed, 0xc6221787) \
+ V(_Float32x4List, [], Float32x4ArrayGetIndexed, 0xdf87c0c1) \
+ V(_Float32x4List, []=, Float32x4ArraySetIndexed, 0x889551f4) \
+ V(_Int32x4List, [], Int32x4ArrayGetIndexed, 0x75703b39) \
+ V(_Int32x4List, []=, Int32x4ArraySetIndexed, 0x952ee084) \
+ V(_Float64x2List, [], Float64x2ArrayGetIndexed, 0xdc2fab6b) \
+ V(_Float64x2List, []=, Float64x2ArraySetIndexed, 0x0884bf1c) \
+ V(_TypedList, get:length, TypedListLength, 0x5850f06b) \
+ V(_TypedListView, get:length, TypedListViewLength, 0x5850f06b) \
+ V(_ByteDataView, get:length, ByteDataViewLength, 0x5850f06b) \
+ V(_Float32x4, get:x, Float32x4ShuffleX, 0x3a398530) \
+ V(_Float32x4, get:y, Float32x4ShuffleY, 0x27cae053) \
+ V(_Float32x4, get:z, Float32x4ShuffleZ, 0x5d964be9) \
+ V(_Float32x4, get:w, Float32x4ShuffleW, 0x3fd6906b) \
+ V(_Float32x4, *, Float32x4Mul, 0xe5507c87) \
+ V(_Float32x4, /, Float32x4Div, 0xc09f2f62) \
+ V(_Float32x4, -, Float32x4Sub, 0xdd326c4a) \
+ V(_Float32x4, +, Float32x4Add, 0xb7f9a1d9) \
+ V(_Float64x2, *, Float64x2Mul, 0x3760b686) \
+ V(_Float64x2, /, Float64x2Div, 0x12af6d22) \
+ V(_Float64x2, -, Float64x2Sub, 0x2f42a649) \
+ V(_Float64x2, +, Float64x2Add, 0x0a09dbd8) \
#define GRAPH_CORE_INTRINSICS_LIST(V) \
- V(_List, get:length, ObjectArrayLength, 0x3097c769) \
- V(_List, [], ObjectArrayGetIndexed, 0x78f4f491) \
- V(_List, _setIndexed, ObjectArraySetIndexedUnchecked, 0xf233cfd8) \
- V(_ImmutableList, get:length, ImmutableArrayLength, 0x3097c769) \
- V(_ImmutableList, [], ImmutableArrayGetIndexed, 0x78f4f491) \
- V(_GrowableList, get:length, GrowableArrayLength, 0x3097c769) \
- V(_GrowableList, get:_capacity, GrowableArrayCapacity, 0x55e672f0) \
- V(_GrowableList, _setData, GrowableArraySetData, 0x9388253f) \
- V(_GrowableList, _setLength, GrowableArraySetLength, 0xba5d44fc) \
- V(_GrowableList, [], GrowableArrayGetIndexed, 0x78f4f491) \
- V(_GrowableList, _setIndexed, GrowableArraySetIndexedUnchecked, 0x5d4f1d17) \
- V(_StringBase, get:length, StringBaseLength, 0x3097c769) \
- V(_OneByteString, codeUnitAt, OneByteStringCodeUnitAt, 0x323db7d0) \
- V(_TwoByteString, codeUnitAt, TwoByteStringCodeUnitAt, 0x323db7d0) \
+ V(_List, get:length, ObjectArrayLength, 0x5850f06b) \
+ V(_List, [], ObjectArrayGetIndexed, 0x57b029cf) \
+ V(_List, _setIndexed, ObjectArraySetIndexedUnchecked, 0x02f293ae) \
+ V(_ImmutableList, get:length, ImmutableArrayLength, 0x5850f06b) \
+ V(_ImmutableList, [], ImmutableArrayGetIndexed, 0x57b029cf) \
+ V(_GrowableList, get:length, GrowableArrayLength, 0x5850f06b) \
+ V(_GrowableList, get:_capacity, GrowableArrayCapacity, 0x7d9f9bf2) \
+ V(_GrowableList, _setData, GrowableArraySetData, 0xbdda401b) \
+ V(_GrowableList, _setLength, GrowableArraySetLength, 0xcc1bf9b6) \
+ V(_GrowableList, [], GrowableArrayGetIndexed, 0x57b029cf) \
+ V(_GrowableList, _setIndexed, GrowableArraySetIndexedUnchecked, 0xfb40ee4f) \
+ V(_StringBase, get:length, StringBaseLength, 0x5850f06b) \
+ V(_OneByteString, codeUnitAt, OneByteStringCodeUnitAt, 0x17f90910) \
+ V(_TwoByteString, codeUnitAt, TwoByteStringCodeUnitAt, 0x17f90910) \
V(_ExternalOneByteString, codeUnitAt, ExternalOneByteStringCodeUnitAt, \
- 0x323db7d0) \
+ 0x17f90910) \
V(_ExternalTwoByteString, codeUnitAt, ExternalTwoByteStringCodeUnitAt, \
- 0x323db7d0) \
- V(_Double, unary-, DoubleFlipSignBit, 0xf66a4c35) \
- V(_Double, truncateToDouble, DoubleTruncate, 0x1c05c6a2) \
- V(_Double, roundToDouble, DoubleRound, 0x0f7b0a49) \
- V(_Double, floorToDouble, DoubleFloor, 0x0de60b91) \
- V(_Double, ceilToDouble, DoubleCeil, 0x184d0f22) \
- V(_Double, _modulo, DoubleMod, 0x2eee8a6e)
+ 0x17f90910) \
+ V(_Double, unary-, DoubleFlipSignBit, 0x3d39082b) \
+ V(_Double, truncateToDouble, DoubleTruncate, 0x62d48298) \
+ V(_Double, roundToDouble, DoubleRound, 0x5649c63f) \
+ V(_Double, floorToDouble, DoubleFloor, 0x54b4c787) \
+ V(_Double, ceilToDouble, DoubleCeil, 0x5f1bcb18) \
+ V(_Double, _modulo, DoubleMod, 0xfdb3942e)
#define GRAPH_INTRINSICS_LIST(V) \
GRAPH_CORE_INTRINSICS_LIST(V) \
@@ -385,16 +385,16 @@
GRAPH_MATH_LIB_INTRINSIC_LIST(V) \
#define DEVELOPER_LIB_INTRINSIC_LIST(V) \
- V(_UserTag, makeCurrent, UserTag_makeCurrent, 0xc0abd700) \
- V(::, _getDefaultTag, UserTag_defaultTag, 0xd0ebe717) \
- V(::, _getCurrentTag, Profiler_getCurrentTag, 0xd5bcef00) \
- V(::, _isDartStreamEnabled, Timeline_isDartStreamEnabled, 0xa0686991) \
+ V(_UserTag, makeCurrent, UserTag_makeCurrent, 0x5bd9b88e) \
+ V(::, _getDefaultTag, UserTag_defaultTag, 0x6c19c8a5) \
+ V(::, _getCurrentTag, Profiler_getCurrentTag, 0x70ead08e) \
+ V(::, _isDartStreamEnabled, Timeline_isDartStreamEnabled, 0xc97aafb3) \
#define INTERNAL_LIB_INTRINSIC_LIST(V) \
- V(::, allocateOneByteString, AllocateOneByteString, 0x3a5d74f6) \
- V(::, allocateTwoByteString, AllocateTwoByteString, 0x4222b093) \
- V(::, writeIntoOneByteString, WriteIntoOneByteString, 0xa2337709) \
- V(::, writeIntoTwoByteString, WriteIntoTwoByteString, 0x99887dd2) \
+ V(::, allocateOneByteString, AllocateOneByteString, 0x9e774214) \
+ V(::, allocateTwoByteString, AllocateTwoByteString, 0xa63c7db1) \
+ V(::, writeIntoOneByteString, WriteIntoOneByteString, 0xd8729161) \
+ V(::, writeIntoTwoByteString, WriteIntoTwoByteString, 0xcfc7982a) \
#define ALL_INTRINSICS_NO_INTEGER_LIB_LIST(V) \
CORE_LIB_INTRINSIC_LIST(V) \
@@ -413,64 +413,64 @@
// A list of core functions that internally dispatch based on received id.
#define POLYMORPHIC_TARGET_LIST(V) \
- V(_StringBase, [], StringBaseCharAt, 0x6c55f9a1) \
- V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 0x30688af4) \
- V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 0x31c4acea) \
- V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 0x4885450f) \
- V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 0x4a06a579) \
- V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 0x335cdbca) \
- V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 0x33a21d3b) \
- V(_TypedList, _getInt64, ByteArrayBaseGetInt64, 0x10a56ebf) \
- V(_TypedList, _getUint64, ByteArrayBaseGetUint64, 0x46a02819) \
- V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 0xe425bcd3) \
- V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 0xf3595200) \
- V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, 0xb3cc1803) \
- V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, 0xbe4aee59) \
- V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0x89b17e2a) \
- V(_TypedList, _setUint8, ByteArrayBaseSetInt8, 0x5781f1d0) \
- V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0x630e7aaf) \
- V(_TypedList, _setUint16, ByteArrayBaseSetInt16, 0x764a82d7) \
- V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0x6602e5c8) \
- V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0x618ede3a) \
- V(_TypedList, _setInt64, ByteArrayBaseSetInt64, 0x70f58a02) \
- V(_TypedList, _setUint64, ByteArrayBaseSetUint64, 0x826f6c8d) \
- V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x2761c274) \
- V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x1b858d66) \
- V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x9e2320c0) \
- V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0xfa1f5cf1) \
- V(Object, get:runtimeType, ObjectRuntimeType, 0x81775ebd)
+ V(_StringBase, [], StringBaseCharAt, 0xd06fc6bf) \
+ V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 0x1623dc34) \
+ V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 0x177ffe2a) \
+ V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 0x2e40964f) \
+ V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 0x2fc1f6b9) \
+ V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 0x19182d0a) \
+ V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 0x195d6e7b) \
+ V(_TypedList, _getInt64, ByteArrayBaseGetInt64, 0xf660bfff) \
+ V(_TypedList, _getUint64, ByteArrayBaseGetUint64, 0x2c5b7959) \
+ V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 0xe8f6a107) \
+ V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 0xf82a3634) \
+ V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, 0xaf2d0ce5) \
+ V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, 0x5573740b) \
+ V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0xe18943a2) \
+ V(_TypedList, _setUint8, ByteArrayBaseSetInt8, 0xaf59b748) \
+ V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0xbae64027) \
+ V(_TypedList, _setUint16, ByteArrayBaseSetInt16, 0xce22484f) \
+ V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0xbddaab40) \
+ V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0xb966a3b2) \
+ V(_TypedList, _setInt64, ByteArrayBaseSetInt64, 0xc8cd4f7a) \
+ V(_TypedList, _setUint64, ByteArrayBaseSetUint64, 0xda473205) \
+ V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x2f362de0) \
+ V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x2359f8d2) \
+ V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x38c6295a) \
+ V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0x5ce9025b) \
+ V(Object, get:runtimeType, ObjectRuntimeType, 0x0381c851)
// List of recognized list factories:
// (factory-name-symbol, class-name-string, constructor-name-string,
// result-cid, fingerprint).
#define RECOGNIZED_LIST_FACTORY_LIST(V) \
- V(_ListFactory, _List, ., kArrayCid, 0x4c9d39e2) \
- V(_ListFilledFactory, _List, .filled, kArrayCid, 0xaf758106) \
- V(_ListGenerateFactory, _List, .generate, kArrayCid, 0xff53e115) \
+ V(_ListFactory, _List, ., kArrayCid, 0xd693eee6) \
+ V(_ListFilledFactory, _List, .filled, kArrayCid, 0x4c76526a) \
+ V(_ListGenerateFactory, _List, .generate, kArrayCid, 0x4f848337) \
V(_GrowableListFactory, _GrowableList, ., kGrowableObjectArrayCid, \
- 0xa61fbeb9) \
+ 0x434de9b9) \
V(_GrowableListFilledFactory, _GrowableList, .filled, \
- kGrowableObjectArrayCid, 0x27a28286) \
+ kGrowableObjectArrayCid, 0x261b3cc2) \
V(_GrowableListGenerateFactory, _GrowableList, .generate, \
- kGrowableObjectArrayCid, 0x60b98295) \
+ kGrowableObjectArrayCid, 0x0c7be78f) \
V(_GrowableListWithData, _GrowableList, ._withData, kGrowableObjectArrayCid, \
- 0x1947d8a1) \
- V(_Int8ArrayFactory, Int8List, ., kTypedDataInt8ArrayCid, 0x934e97a2) \
- V(_Uint8ArrayFactory, Uint8List, ., kTypedDataUint8ArrayCid, 0x7eea24fb) \
+ 0xa32d060b) \
+ V(_Int8ArrayFactory, Int8List, ., kTypedDataInt8ArrayCid, 0x660dd888) \
+ V(_Uint8ArrayFactory, Uint8List, ., kTypedDataUint8ArrayCid, 0xede3f64f) \
V(_Uint8ClampedArrayFactory, Uint8ClampedList, ., \
- kTypedDataUint8ClampedArrayCid, 0xba98ab35) \
- V(_Int16ArrayFactory, Int16List, ., kTypedDataInt16ArrayCid, 0x54af9dd7) \
- V(_Uint16ArrayFactory, Uint16List, ., kTypedDataUint16ArrayCid, 0xc3859080) \
- V(_Int32ArrayFactory, Int32List, ., kTypedDataInt32ArrayCid, 0x3e52ca0a) \
- V(_Uint32ArrayFactory, Uint32List, ., kTypedDataUint32ArrayCid, 0xdbbb093f) \
- V(_Int64ArrayFactory, Int64List, ., kTypedDataInt64ArrayCid, 0x560fc11b) \
- V(_Uint64ArrayFactory, Uint64List, ., kTypedDataUint64ArrayCid, 0x02b7f232) \
+ kTypedDataUint8ClampedArrayCid, 0x28063755) \
+ V(_Int16ArrayFactory, Int16List, ., kTypedDataInt16ArrayCid, 0xd0cd98f3) \
+ V(_Uint16ArrayFactory, Uint16List, ., kTypedDataUint16ArrayCid, 0x3cb5fb6a) \
+ V(_Int32ArrayFactory, Int32List, ., kTypedDataInt32ArrayCid, 0x1b8ff320) \
+ V(_Uint32ArrayFactory, Uint32List, ., kTypedDataUint32ArrayCid, 0x2b2f9a8b) \
+ V(_Int64ArrayFactory, Int64List, ., kTypedDataInt64ArrayCid, 0xfb71de2f) \
+ V(_Uint64ArrayFactory, Uint64List, ., kTypedDataUint64ArrayCid, 0xe3cfcff8) \
V(_Float64ArrayFactory, Float64List, ., kTypedDataFloat64ArrayCid, \
- 0x321abc79) \
+ 0xa0c64e91) \
V(_Float32ArrayFactory, Float32List, ., kTypedDataFloat32ArrayCid, \
- 0xdf9d206c) \
+ 0xa39068fe) \
V(_Float32x4ArrayFactory, Float32x4List, ., kTypedDataFloat32x4ArrayCid, \
- 0xa0de94a2)
+ 0x0a7d7b88)
// clang-format on
diff --git a/runtime/vm/compiler/runtime_api.cc b/runtime/vm/compiler/runtime_api.cc
index 1e8aa18..88539e8 100644
--- a/runtime/vm/compiler/runtime_api.cc
+++ b/runtime/vm/compiler/runtime_api.cc
@@ -202,7 +202,7 @@
}
int32_t CreateJitCookie() {
- return static_cast<int32_t>(Isolate::Current()->random()->NextUInt32());
+ return static_cast<int32_t>(IsolateGroup::Current()->random()->NextUInt32());
}
word TypedDataElementSizeInBytes(classid_t cid) {
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 44237ab4..964497c 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -978,10 +978,6 @@
const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag());
I->set_current_tag(default_tag);
- if (FLAG_keep_code) {
- I->set_deoptimized_code_array(
- GrowableObjectArray::Handle(GrowableObjectArray::New()));
- }
return Error::null();
}
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index bd3b5d4..e9464e3 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -1194,7 +1194,7 @@
}
Thread* thread = Thread::Current();
- NoReloadScope no_reload_scope(thread->isolate(), thread);
+ NoReloadScope no_reload_scope(thread->isolate_group(), thread);
return DartLibraryCalls::InstanceCreate(library, *class_name,
*constructor_name, arguments);
}
diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc
index 1fffd1a..fd0fe59 100644
--- a/runtime/vm/experimental_features.cc
+++ b/runtime/vm/experimental_features.cc
@@ -6,7 +6,7 @@
// Instead modify 'tools/experimental_features.yaml' and run
// 'dart tools/generate_experimental_flags.dart' to update.
//
-// Current version: 2.12.0
+// Current version: 2.13.0
#include "vm/experimental_features.h"
diff --git a/runtime/vm/experimental_features.h b/runtime/vm/experimental_features.h
index 797b0d2..8efd29e 100644
--- a/runtime/vm/experimental_features.h
+++ b/runtime/vm/experimental_features.h
@@ -6,7 +6,7 @@
// Instead modify 'tools/experimental_features.yaml' and run
// 'dart tools/generate_experimental_flags.dart' to update.
//
-// Current version: 2.12.0
+// Current version: 2.13.0
#ifndef RUNTIME_VM_EXPERIMENTAL_FEATURES_H_
#define RUNTIME_VM_EXPERIMENTAL_FEATURES_H_
diff --git a/runtime/vm/heap/weak_code.cc b/runtime/vm/heap/weak_code.cc
index 85bf634..3699319 100644
--- a/runtime/vm/heap/weak_code.cc
+++ b/runtime/vm/heap/weak_code.cc
@@ -76,24 +76,20 @@
// Deoptimize stacks and disable code with mutators stopped.
isolate_group->RunWithStoppedMutators([&]() {
Code& code = Code::Handle();
- Thread* current = isolate_group->thread_registry()->active_list();
- while (current != NULL) {
- // Disable all code on stack.
- {
- DartFrameIterator iterator(
- current, StackFrameIterator::kAllowCrossThreadIteration);
- StackFrame* frame = iterator.NextFrame();
- while (frame != NULL) {
- code = frame->LookupDartCode();
- if (IsOptimizedCode(code_objects, code)) {
- ReportDeoptimization(code);
- DeoptimizeAt(code, frame);
- }
- frame = iterator.NextFrame();
+ isolate_group->ForEachIsolate([&](Isolate* isolate) {
+ DartFrameIterator iterator(
+ isolate->mutator_thread(),
+ StackFrameIterator::kAllowCrossThreadIteration);
+ StackFrame* frame = iterator.NextFrame();
+ while (frame != nullptr) {
+ code = frame->LookupDartCode();
+ if (IsOptimizedCode(code_objects, code)) {
+ ReportDeoptimization(code);
+ DeoptimizeAt(isolate, code, frame);
}
+ frame = iterator.NextFrame();
}
- current = current->next();
- }
+ });
// Switch functions that use dependent code to unoptimized code.
WeakProperty& weak_property = WeakProperty::Handle();
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 9a98248..1485555 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -338,6 +338,7 @@
isolates_(),
start_time_micros_(OS::GetCurrentMonotonicMicros()),
is_system_isolate_group_(source->flags.is_system_isolate),
+ random_(),
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
last_reload_timestamp_(OS::GetCurrentTimeMillis()),
#endif
@@ -373,6 +374,8 @@
NOT_IN_PRODUCT("IsolateGroup::kernel_data_class_cache_mutex_")),
kernel_constants_mutex_(
NOT_IN_PRODUCT("IsolateGroup::kernel_constants_mutex_")),
+ field_list_mutex_(NOT_IN_PRODUCT("Isolate::field_list_mutex_")),
+ boxed_field_list_(GrowableObjectArray::null()),
program_lock_(new SafepointRwLock()),
active_mutators_monitor_(new Monitor()),
max_active_mutators_(Scavenger::MaxMutatorThreadCount()) {
@@ -851,19 +854,19 @@
thread()->RestoreOOBMessageInterrupts();
}
-NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread)
- : ThreadStackResource(thread), isolate_(isolate) {
+NoReloadScope::NoReloadScope(IsolateGroup* isolate_group, Thread* thread)
+ : ThreadStackResource(thread), isolate_group_(isolate_group) {
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
- ASSERT(isolate_ != NULL);
- isolate_->no_reload_scope_depth_.fetch_add(1);
- ASSERT(isolate_->no_reload_scope_depth_ >= 0);
+ ASSERT(isolate_group_ != NULL);
+ isolate_group_->no_reload_scope_depth_.fetch_add(1);
+ ASSERT(isolate_group_->no_reload_scope_depth_ >= 0);
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
}
NoReloadScope::~NoReloadScope() {
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
- isolate_->no_reload_scope_depth_.fetch_sub(1);
- ASSERT(isolate_->no_reload_scope_depth_ >= 0);
+ isolate_group_->no_reload_scope_depth_.fetch_sub(1);
+ ASSERT(isolate_group_->no_reload_scope_depth_ >= 0);
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
}
@@ -1473,7 +1476,7 @@
T->isolate()->name(), result.ToErrorCString());
}
- NoReloadScope no_reload_scope(T->isolate(), T);
+ NoReloadScope no_reload_scope(T->isolate_group(), T);
// Generate the error and stacktrace strings for the error message.
const char* exception_cstr = nullptr;
const char* stacktrace_cstr = nullptr;
@@ -1688,10 +1691,7 @@
mutex_(NOT_IN_PRODUCT("Isolate::mutex_")),
pending_deopts_(new MallocGrowableArray<PendingLazyDeopt>()),
tag_table_(GrowableObjectArray::null()),
- deoptimized_code_array_(GrowableObjectArray::null()),
sticky_error_(Error::null()),
- field_list_mutex_(NOT_IN_PRODUCT("Isolate::field_list_mutex_")),
- boxed_field_list_(GrowableObjectArray::null()),
spawn_count_monitor_(),
handler_info_cache_(),
catch_entry_moves_cache_() {
@@ -1971,7 +1971,7 @@
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
bool Isolate::CanReload() const {
return !Isolate::IsSystemIsolate(this) && is_runnable() &&
- !group()->IsReloading() && (no_reload_scope_depth_ == 0) &&
+ !group()->IsReloading() && (group()->no_reload_scope_depth_ == 0) &&
IsolateCreationEnabled() &&
OSThread::Current()->HasStackHeadroom(64 * KB);
}
@@ -2575,7 +2575,6 @@
visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&default_tag_));
visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&ic_miss_code_));
visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&tag_table_));
- visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&deoptimized_code_array_));
visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&sticky_error_));
if (isolate_group_ != nullptr) {
if (isolate_group_->source()->loaded_blobs_ != nullptr) {
@@ -2589,11 +2588,6 @@
visitor->VisitPointer(
reinterpret_cast<ObjectPtr*>(®istered_service_extension_handlers_));
#endif // !defined(PRODUCT)
- // Visit the boxed_field_list_.
- // 'boxed_field_list_' access via mutator and background compilation threads
- // is guarded with a monitor. This means that we can visit it only
- // when at safepoint or the field_list_mutex_ lock has been taken.
- visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&boxed_field_list_));
if (background_compiler() != nullptr) {
background_compiler()->VisitPointers(visitor);
@@ -2746,6 +2740,12 @@
visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&saved_unlinked_calls_));
initial_field_table()->VisitObjectPointers(visitor);
VisitStackPointers(visitor, validate_frames);
+
+ // Visit the boxed_field_list_.
+ // 'boxed_field_list_' access via mutator and background compilation threads
+ // is guarded with a monitor. This means that we can visit it only
+ // when at safepoint or the field_list_mutex_ lock has been taken.
+ visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&boxed_field_list_));
}
void IsolateGroup::VisitStackPointers(ObjectPointerVisitor* visitor,
@@ -3079,24 +3079,6 @@
ic_miss_code_ = code.ptr();
}
-void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) {
- ASSERT(Thread::Current()->IsMutatorThread());
- deoptimized_code_array_ = value.ptr();
-}
-
-void Isolate::TrackDeoptimizedCode(const Code& code) {
- ASSERT(!code.IsNull());
- const GrowableObjectArray& deoptimized_code =
- GrowableObjectArray::Handle(deoptimized_code_array());
- if (deoptimized_code.IsNull()) {
- // Not tracking deoptimized code.
- return;
- }
- // TODO(johnmccutchan): Scan this array and the isolate's profile before
- // old space GC and remove the keep_code flag.
- deoptimized_code.Add(code);
-}
-
ErrorPtr Isolate::StealStickyError() {
NoSafepointScope no_safepoint;
ErrorPtr return_value = sticky_error_;
@@ -3116,7 +3098,7 @@
}
#endif // !defined(PRODUCT)
-void Isolate::AddDeoptimizingBoxedField(const Field& field) {
+void IsolateGroup::AddDeoptimizingBoxedField(const Field& field) {
ASSERT(Compiler::IsBackgroundCompilation());
ASSERT(!field.IsOriginal());
// The enclosed code allocates objects and can potentially trigger a GC,
@@ -3130,7 +3112,7 @@
array.Add(Field::Handle(field.Original()), Heap::kOld);
}
-FieldPtr Isolate::GetDeoptimizingBoxedField() {
+FieldPtr IsolateGroup::GetDeoptimizingBoxedField() {
ASSERT(Thread::Current()->IsMutatorThread());
SafepointMutexLocker ml(&field_list_mutex_);
if (boxed_field_list_ == GrowableObjectArray::null()) {
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index b1ef148..794225c 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -157,11 +157,11 @@
// Disallow isolate reload.
class NoReloadScope : public ThreadStackResource {
public:
- NoReloadScope(Isolate* isolate, Thread* thread);
+ NoReloadScope(IsolateGroup* isolate_group, Thread* thread);
~NoReloadScope();
private:
- Isolate* isolate_;
+ IsolateGroup* isolate_group_;
DISALLOW_COPY_AND_ASSIGN(NoReloadScope);
};
@@ -421,6 +421,8 @@
void set_obfuscation_map(const char** map) { obfuscation_map_ = map; }
const char** obfuscation_map() const { return obfuscation_map_; }
+ Random* random() { return &random_; }
+
bool is_system_isolate_group() const { return is_system_isolate_group_; }
// IsolateGroup-specific flag handling.
@@ -690,6 +692,12 @@
uword FindPendingDeoptAtSafepoint(uword fp);
+ // Used by background compiler which field became boxed and must trigger
+ // deoptimization in the mutator thread.
+ void AddDeoptimizingBoxedField(const Field& field);
+ // Returns Field::null() if none available in the list.
+ FieldPtr GetDeoptimizingBoxedField();
+
void RememberLiveTemporaries();
void DeferredMarkLiveTemporaries();
@@ -728,6 +736,7 @@
friend class StackFrame; // For `[isolates_].First()`.
// For `object_store_shared_untag()`, `class_table_shared_untag()`
friend class Isolate;
+ friend class NoReloadScope; // no_reload_scope_depth_
#define ISOLATE_GROUP_FLAG_BITS(V) \
V(CompactionInProgress) \
@@ -774,10 +783,13 @@
Dart_DeferredLoadHandler deferred_load_handler_ = nullptr;
int64_t start_time_micros_;
bool is_system_isolate_group_;
+ Random random_;
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
int64_t last_reload_timestamp_;
std::shared_ptr<IsolateGroupReloadContext> group_reload_context_;
+ RelaxedAtomic<intptr_t> no_reload_scope_depth_ =
+ 0; // we can only reload when this is 0.
#endif
#define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \
@@ -837,6 +849,11 @@
Mutex initializer_functions_mutex_;
#endif // !defined(DART_PRECOMPILED_RUNTIME)
+ // Protect access to boxed_field_list_.
+ Mutex field_list_mutex_;
+ // List of fields that became boxed and that trigger deoptimization.
+ GrowableObjectArrayPtr boxed_field_list_;
+
// Ensures synchronized access to classes functions, fields and other
// program structure elements to accommodate concurrent modification done
// by multiple isolates and background compiler.
@@ -1280,12 +1297,6 @@
void set_ic_miss_code(const Code& code);
- GrowableObjectArrayPtr deoptimized_code_array() const {
- return deoptimized_code_array_;
- }
- void set_deoptimized_code_array(const GrowableObjectArray& value);
- void TrackDeoptimizedCode(const Code& code);
-
// Also sends a paused at exit event over the service protocol.
void SetStickyError(ErrorPtr sticky_error);
@@ -1307,12 +1318,6 @@
isolate_flags_ = RemappingCidsBit::update(value, isolate_flags_);
}
- // Used by background compiler which field became boxed and must trigger
- // deoptimization in the mutator thread.
- void AddDeoptimizingBoxedField(const Field& field);
- // Returns Field::null() if none available in the list.
- FieldPtr GetDeoptimizingBoxedField();
-
#ifndef PRODUCT
ErrorPtr InvokePendingServiceExtensionCalls();
void AppendServiceExtensionCall(const Instance& closure,
@@ -1616,8 +1621,6 @@
ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE);
#undef ISOLATE_METRIC_VARIABLE
- RelaxedAtomic<intptr_t> no_reload_scope_depth_ =
- 0; // we can only reload when this is 0.
// Per-isolate copy of FLAG_reload_every.
intptr_t reload_every_n_stack_overflow_checks_;
ProgramReloadContext* program_reload_context_ = nullptr;
@@ -1649,18 +1652,11 @@
GrowableObjectArrayPtr tag_table_;
- GrowableObjectArrayPtr deoptimized_code_array_;
-
ErrorPtr sticky_error_;
std::unique_ptr<Bequest> bequest_;
Dart_Port beneficiary_ = 0;
- // Protect access to boxed_field_list_.
- Mutex field_list_mutex_;
- // List of fields that became boxed and that trigger deoptimization.
- GrowableObjectArrayPtr boxed_field_list_;
-
// This guards spawn_count_. An isolate cannot complete shutdown and be
// destroyed while there are child isolates in the midst of a spawn.
Monitor spawn_count_monitor_;
diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc
index fef7059..bff8f7a 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.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.
+#include <array>
+
#include "include/dart_api.h"
#include "include/dart_tools_api.h"
#include "platform/assert.h"
@@ -4734,6 +4736,157 @@
SimpleInvokeStr(lib, "main"));
}
+// Regression test for b/179030011: incorrect lifetime management when reloading
+// with multicomponent Kernel binary. When loading kernel blobs through tag
+// handler (Dart_kKernelTag) we need to make sure to preserve a link between
+// KernelProgramInfo objects and original typed data, because it might be
+// comming with a finalizer, which otherwise might end up being called
+// prematurely.
+namespace {
+
+// Compile the given |source| to Kernel binary.
+static void CompileToKernel(Dart_SourceFile source,
+ const uint8_t** kernel_buffer,
+ intptr_t* kernel_buffer_size) {
+ Dart_SourceFile sources[] = {source};
+ char* error = TestCase::CompileTestScriptWithDFE(
+ sources[0].uri, ARRAY_SIZE(sources), sources, kernel_buffer,
+ kernel_buffer_size,
+ /*incrementally=*/false);
+ EXPECT(error == NULL);
+ EXPECT_NOTNULL(kernel_buffer);
+}
+
+// LibraryTagHandler which returns a fixed Kernel binary back every time it
+// receives a Dart_kKernelTag request. The binary is wrapped in an external
+// typed data with a finalizer attached to it. If this finalizer is called
+// it will set |was_finalized_| to true.
+class KernelTagHandler {
+ public:
+ KernelTagHandler(uint8_t* kernel_buffer, intptr_t kernel_buffer_size)
+ : kernel_buffer_(kernel_buffer), kernel_buffer_size_(kernel_buffer_size) {
+ Dart_SetLibraryTagHandler(&LibraryTagHandler);
+ instance_ = this;
+ }
+
+ ~KernelTagHandler() {
+ Dart_SetLibraryTagHandler(nullptr);
+ instance_ = nullptr;
+ }
+
+ static KernelTagHandler* Current() { return instance_; }
+
+ bool was_called() const { return was_called_; }
+ bool was_finalized() const { return was_finalized_; }
+
+ private:
+ static void Finalizer(void* isolate_callback_data, void* peer) {
+ if (auto handler = KernelTagHandler::Current()) {
+ handler->was_finalized_ = true;
+ }
+ }
+
+ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
+ Dart_Handle library,
+ Dart_Handle url) {
+ if (tag == Dart_kKernelTag) {
+ auto handler = KernelTagHandler::Current();
+ handler->was_called_ = true;
+
+ Dart_Handle result = Dart_NewExternalTypedData(
+ Dart_TypedData_kUint8, handler->kernel_buffer_,
+ handler->kernel_buffer_size_);
+ Dart_NewFinalizableHandle(result, handler->kernel_buffer_,
+ handler->kernel_buffer_size_, &Finalizer);
+ return result;
+ }
+ UNREACHABLE();
+ return Dart_Null();
+ }
+
+ static KernelTagHandler* instance_;
+ uint8_t* kernel_buffer_;
+ intptr_t kernel_buffer_size_;
+ bool was_finalized_ = false;
+ bool was_called_ = false;
+};
+
+KernelTagHandler* KernelTagHandler::instance_ = nullptr;
+} // namespace
+
+TEST_CASE(IsolateReload_RegressB179030011) {
+ struct Component {
+ Dart_SourceFile source;
+ const uint8_t* kernel_buffer;
+ intptr_t kernel_buffer_size;
+ };
+
+ // clang-format off
+ std::array<Component, 2> components = {{
+ {{
+ "file:///test-app",
+ R"(
+ class A {}
+ void main() {
+ A();
+ }
+ )"
+ }, nullptr, 0},
+ {{
+ "file:///library",
+ R"(
+ class B {}
+ )"
+ }, nullptr, 0}
+ }};
+ // clang-format on
+
+ for (auto& component : components) {
+ CompileToKernel(component.source, &component.kernel_buffer,
+ &component.kernel_buffer_size);
+ TestCaseBase::AddToKernelBuffers(component.kernel_buffer);
+ }
+
+ // Concatenate all components.
+ intptr_t kernel_buffer_size = 0;
+ for (auto component : components) {
+ kernel_buffer_size += component.kernel_buffer_size;
+ }
+ uint8_t* kernel_buffer = static_cast<uint8_t*>(malloc(kernel_buffer_size));
+ TestCaseBase::AddToKernelBuffers(kernel_buffer);
+ intptr_t pos = 0;
+ for (auto component : components) {
+ memcpy(kernel_buffer + pos, component.kernel_buffer, // NOLINT
+ component.kernel_buffer_size);
+ pos += component.kernel_buffer_size;
+ }
+
+ // Load the first component into the isolate (to have something set as
+ // root library).
+ Dart_Handle lib = Dart_LoadLibraryFromKernel(
+ components[0].kernel_buffer, components[0].kernel_buffer_size);
+ EXPECT_VALID(lib);
+ EXPECT_VALID(Dart_SetRootLibrary(lib));
+
+ {
+ KernelTagHandler handler(kernel_buffer, kernel_buffer_size);
+ {
+ // Additional API scope to prevent handles leaking into outer scope.
+ Dart_EnterScope();
+ // root_script_url does not really matter.
+ TestCase::TriggerReload(/*root_script_url=*/"something.dill");
+ Dart_ExitScope();
+ }
+ EXPECT(handler.was_called());
+
+ // Check that triggering GC does not cause finalizer registered by
+ // tag handler to fire - meaning that kernel binary continues to live.
+ TransitionNativeToVM transition(thread);
+ GCTestHelper::CollectAllGarbage();
+ EXPECT(!handler.was_finalized());
+ }
+}
+
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
} // namespace dart
diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h
index f7c7dfb..32ecc7c 100644
--- a/runtime/vm/kernel.h
+++ b/runtime/vm/kernel.h
@@ -60,6 +60,16 @@
enum LogicalOperator { kAnd, kOr };
+struct ProgramBinary {
+ ProgramBinary SubView(intptr_t start, intptr_t end) const {
+ return {typed_data, kernel_data + start, end - start};
+ }
+
+ const ExternalTypedData* typed_data;
+ const uint8_t* kernel_data;
+ intptr_t kernel_data_size;
+};
+
class Program {
public:
// Read a kernel Program from the given Reader. Note the returned Program
@@ -89,14 +99,16 @@
return metadata_mappings_offset_;
}
intptr_t constant_table_offset() { return constant_table_offset_; }
- const ExternalTypedData* typed_data() { return typed_data_; }
- const uint8_t* kernel_data() { return kernel_data_; }
- intptr_t kernel_data_size() { return kernel_data_size_; }
intptr_t library_count() { return library_count_; }
NNBDCompiledMode compilation_mode() const { return compilation_mode_; }
+ const ProgramBinary& binary() const { return binary_; }
+ const ExternalTypedData* typed_data() { return binary().typed_data; }
+ const uint8_t* kernel_data() { return binary().kernel_data; }
+ intptr_t kernel_data_size() { return binary().kernel_data_size; }
+
private:
- Program() : typed_data_(NULL), kernel_data_(NULL), kernel_data_size_(-1) {}
+ Program() : binary_() {}
bool single_program_;
uint32_t binary_version_;
@@ -122,9 +134,7 @@
// The offset from the start of the binary to the start of the string table.
intptr_t string_table_offset_;
- const ExternalTypedData* typed_data_;
- const uint8_t* kernel_data_;
- intptr_t kernel_data_size_;
+ ProgramBinary binary_;
DISALLOW_COPY_AND_ASSIGN(Program);
};
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc
index 7e6f741..00ceb7d 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -144,9 +144,9 @@
std::unique_ptr<Program> program(new Program());
program->binary_version_ = formatVersion;
- program->typed_data_ = reader->typed_data();
- program->kernel_data_ = reader->buffer();
- program->kernel_data_size_ = reader->size();
+ program->binary_.typed_data = reader->typed_data();
+ program->binary_.kernel_data = reader->buffer();
+ program->binary_.kernel_data_size = reader->size();
// Dill files can be concatenated (e.g. cat a.dill b.dill > c.dill). Find out
// if this dill contains more than one program.
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index bad9b38..3afc431 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -20,8 +20,8 @@
static const uint32_t kMagicProgramFile = 0x90ABCDEFu;
// Both version numbers are inclusive.
-static const uint32_t kMinSupportedKernelFormatVersion = 54;
-static const uint32_t kMaxSupportedKernelFormatVersion = 54;
+static const uint32_t kMinSupportedKernelFormatVersion = 55;
+static const uint32_t kMaxSupportedKernelFormatVersion = 55;
// Keep in sync with package:kernel/lib/binary/tag.dart
#define KERNEL_TAG_LIST(V) \
@@ -224,23 +224,18 @@
class Reader : public ValueObject {
public:
- Reader(const uint8_t* buffer, intptr_t size)
- : thread_(NULL),
- raw_buffer_(buffer),
- typed_data_(NULL),
- size_(size),
- offset_(0),
- max_position_(TokenPosition::kNoSource),
- min_position_(TokenPosition::kNoSource) {}
+ explicit Reader(const ProgramBinary& binary)
+ : Reader(binary.kernel_data, binary.kernel_data_size) {
+ // Make sure to link any Program / KernelProgramInfo objects created
+ // from this reader back to originating typed data to keep it alive.
+ set_typed_data(binary.typed_data);
+ }
explicit Reader(const ExternalTypedData& typed_data)
: thread_(Thread::Current()),
raw_buffer_(NULL),
typed_data_(&typed_data),
- size_(typed_data.IsNull() ? 0 : typed_data.Length()),
- offset_(0),
- max_position_(TokenPosition::kNoSource),
- min_position_(TokenPosition::kNoSource) {}
+ size_(typed_data.IsNull() ? 0 : typed_data.Length()) {}
uint32_t ReadFromIndex(intptr_t end_offset,
intptr_t fields_before,
@@ -456,6 +451,9 @@
TypedDataPtr ReadLineStartsData(intptr_t line_start_count);
private:
+ Reader(const uint8_t* buffer, intptr_t size)
+ : thread_(NULL), raw_buffer_(buffer), typed_data_(NULL), size_(size) {}
+
const uint8_t* buffer() const {
if (raw_buffer_ != NULL) {
return raw_buffer_;
@@ -468,10 +466,10 @@
const uint8_t* raw_buffer_;
const ExternalTypedData* typed_data_;
intptr_t size_;
- intptr_t offset_;
- TokenPosition max_position_;
- TokenPosition min_position_;
- intptr_t current_script_id_;
+ intptr_t offset_ = 0;
+ TokenPosition max_position_ = TokenPosition::kNoSource;
+ TokenPosition min_position_ = TokenPosition::kNoSource;
+ intptr_t current_script_id_ = -1;
friend class PositionScope;
friend class Program;
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 804e6e5..04b3b430 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -162,11 +162,10 @@
source_references_offset_ = reader_.ReadUInt32At(class_index_offset_ - 4);
}
-ClassIndex::ClassIndex(const uint8_t* buffer,
- intptr_t buffer_size,
+ClassIndex::ClassIndex(const ProgramBinary& binary,
intptr_t class_offset,
intptr_t class_size)
- : reader_(buffer, buffer_size) {
+ : reader_(binary) {
Init(class_offset, class_size);
}
@@ -202,9 +201,8 @@
translation_helper_(this, thread_, Heap::kOld),
helper_(zone_,
&translation_helper_,
- program_->kernel_data(),
- program_->kernel_data_size(),
- 0),
+ program_->binary(),
+ /*data_program_offset=*/0),
constant_reader_(&helper_, &active_class_),
type_translator_(&helper_,
&constant_reader_,
@@ -247,7 +245,7 @@
return Object::Handle(loader.LoadProgram(process_pending_classes));
}
- kernel::Reader reader(program->kernel_data(), program->kernel_data_size());
+ kernel::Reader reader(program->binary());
GrowableArray<intptr_t> subprogram_file_starts;
index_programs(&reader, &subprogram_file_starts);
@@ -264,9 +262,9 @@
Thread* thread_ = Thread::Current();
Zone* zone_ = thread_->zone();
TranslationHelper translation_helper(thread);
- KernelReaderHelper helper_(zone_, &translation_helper,
- program->kernel_data() + subprogram_start,
- subprogram_end - subprogram_start, 0);
+ KernelReaderHelper helper_(
+ zone_, &translation_helper,
+ program->binary().SubView(subprogram_start, subprogram_end), 0); // ,
const intptr_t source_table_size = helper_.SourceTableSize();
for (intptr_t index = 0; index < source_table_size; ++index) {
const String& uri_string = helper_.SourceTableUriFor(index);
@@ -361,8 +359,11 @@
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
TranslationHelper translation_helper(thread);
- KernelReaderHelper reader(zone, &translation_helper, kernel_buffer,
- kernel_buffer_length, 0);
+ // Note: it is okay to have typed_data be nullptr here because we are not
+ // creating any long living views into the kernel_buffer.
+ const ProgramBinary binary = {/*typed_data=*/nullptr, kernel_buffer,
+ kernel_buffer_length};
+ KernelReaderHelper reader(zone, &translation_helper, binary, 0);
intptr_t source_table_size = reader.SourceTableSize();
for (intptr_t i = 0; i < source_table_size; ++i) {
const String& source_uri = reader.SourceTableUriFor(i);
@@ -380,7 +381,7 @@
// Copy the Kernel string offsets out of the binary and into the VM's heap.
ASSERT(program_->string_table_offset() >= 0);
- Reader reader(program_->kernel_data(), program_->kernel_data_size());
+ Reader reader(program_->binary());
reader.set_offset(program_->string_table_offset());
intptr_t count = reader.ReadUInt() + 1;
TypedData& offsets = TypedData::Handle(
@@ -498,7 +499,7 @@
Thread* thread = Thread::Current();
NoOOBMessageScope no_msg_scope(thread);
- NoReloadScope no_reload_scope(thread->isolate(), thread);
+ NoReloadScope no_reload_scope(thread->isolate_group(), thread);
Function& function = Function::Handle();
Library& library = Library::Handle();
@@ -874,7 +875,7 @@
loader.walk_incremental_kernel(modified_libs, is_empty_program,
p_num_classes, p_num_procedures);
}
- kernel::Reader reader(program->kernel_data(), program->kernel_data_size());
+ kernel::Reader reader(program->binary());
GrowableArray<intptr_t> subprogram_file_starts;
index_programs(&reader, &subprogram_file_starts);
@@ -1460,8 +1461,8 @@
intptr_t class_end,
Class* out_class) {
intptr_t class_offset = helper_.ReaderOffset();
- ClassIndex class_index(program_->kernel_data(), program_->kernel_data_size(),
- class_offset, class_end - class_offset);
+ ClassIndex class_index(program_->binary(), class_offset,
+ class_end - class_offset);
ClassHelper class_helper(&helper_);
class_helper.ReadUntilIncluding(ClassHelper::kCanonicalName);
@@ -2088,7 +2089,7 @@
} else {
Thread* thread = Thread::Current();
NoOOBMessageScope no_msg_scope(thread);
- NoReloadScope no_reload_scope(thread->isolate(), thread);
+ NoReloadScope no_reload_scope(thread->isolate_group(), thread);
library.GetMetadata(function);
}
}
diff --git a/runtime/vm/kernel_loader.h b/runtime/vm/kernel_loader.h
index 00f6335..6245e6f 100644
--- a/runtime/vm/kernel_loader.h
+++ b/runtime/vm/kernel_loader.h
@@ -125,8 +125,7 @@
public:
// |class_offset| is the offset of class' kernel data in |buffer| of
// size |size|. The size of the class' kernel data is |class_size|.
- ClassIndex(const uint8_t* buffer,
- intptr_t buffer_size,
+ ClassIndex(const ProgramBinary& binary,
intptr_t class_offset,
intptr_t class_size);
@@ -264,16 +263,14 @@
}
intptr_t library_offset(intptr_t index) {
- kernel::Reader reader(program_->kernel_data(),
- program_->kernel_data_size());
+ kernel::Reader reader(program_->binary());
return reader.ReadFromIndexNoReset(reader.size(),
LibraryCountFieldCountFromEnd + 1,
program_->library_count() + 1, index);
}
NameIndex library_canonical_name(intptr_t index) {
- kernel::Reader reader(program_->kernel_data(),
- program_->kernel_data_size());
+ kernel::Reader reader(program_->binary());
reader.set_offset(library_offset(index));
// Start reading library.
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 415bbfa..88567bf 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -6768,7 +6768,6 @@
Thread* thread = Thread::Current();
DEBUG_ASSERT(
thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
- Isolate* isolate = thread->isolate();
Zone* zone = thread->zone();
// TODO(35224): DEBUG_ASSERT(thread->TopErrorHandlerIsExitFrame());
const Code& current_code = Code::Handle(zone, CurrentCode());
@@ -6786,7 +6785,6 @@
const Code& unopt_code = Code::Handle(zone, unoptimized_code());
unopt_code.Enable();
AttachCode(unopt_code);
- isolate->TrackDeoptimizedCode(current_code);
}
void Function::SwitchToLazyCompiledUnoptimizedCode() const {
@@ -10754,7 +10752,7 @@
#endif // !defined(DART_PRECOMPILED_RUNTIME)
NoOOBMessageScope no_msg_scope(thread);
- NoReloadScope no_reload_scope(thread->isolate(), thread);
+ NoReloadScope no_reload_scope(thread->isolate_group(), thread);
const Function& initializer = Function::Handle(EnsureInitializerFunction());
return DartEntry::InvokeFunction(initializer, Object::empty_array());
}
@@ -17969,7 +17967,7 @@
const char* LanguageError::ToErrorCString() const {
Thread* thread = Thread::Current();
- NoReloadScope no_reload_scope(thread->isolate(), thread);
+ NoReloadScope no_reload_scope(thread->isolate_group(), thread);
const String& msg_str = String::Handle(FormatMessage());
return msg_str.ToCString();
}
@@ -18018,9 +18016,8 @@
const char* UnhandledException::ToErrorCString() const {
Thread* thread = Thread::Current();
- auto isolate = thread->isolate();
auto isolate_group = thread->isolate_group();
- NoReloadScope no_reload_scope(isolate, thread);
+ NoReloadScope no_reload_scope(isolate_group, thread);
HANDLESCOPE(thread);
Object& strtmp = Object::Handle();
const char* exc_str;
diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc
index e1a3c38..c5d4619 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -25,73 +25,6 @@
#ifndef PRODUCT
-class DeoptimizedCodeSet : public ZoneAllocated {
- public:
- explicit DeoptimizedCodeSet(Isolate* isolate)
- : previous_(
- GrowableObjectArray::ZoneHandle(isolate->deoptimized_code_array())),
- current_(GrowableObjectArray::ZoneHandle(
- previous_.IsNull() ? GrowableObjectArray::null()
- : GrowableObjectArray::New())) {}
-
- void Add(const Code& code) {
- if (current_.IsNull()) {
- return;
- }
- if (!Contained(code, previous_) || Contained(code, current_)) {
- return;
- }
- current_.Add(code);
- }
-
- void UpdateIsolate(Isolate* isolate) {
- intptr_t size_before = SizeOf(previous_);
- intptr_t size_after = SizeOf(current_);
- if ((size_before > 0) && FLAG_trace_profiler) {
- intptr_t length_before = previous_.Length();
- intptr_t length_after = current_.Length();
- OS::PrintErr(
- "Updating isolate deoptimized code array: "
- "%" Pd " -> %" Pd " [%" Pd " -> %" Pd "]\n",
- size_before, size_after, length_before, length_after);
- }
- isolate->set_deoptimized_code_array(current_);
- }
-
- private:
- bool Contained(const Code& code, const GrowableObjectArray& array) {
- if (array.IsNull() || code.IsNull()) {
- return false;
- }
- NoSafepointScope no_safepoint_scope;
- for (intptr_t i = 0; i < array.Length(); i++) {
- if (code.ptr() == array.At(i)) {
- return true;
- }
- }
- return false;
- }
-
- intptr_t SizeOf(const GrowableObjectArray& array) {
- if (array.IsNull()) {
- return 0;
- }
- Code& code = Code::ZoneHandle();
- intptr_t size = 0;
- for (intptr_t i = 0; i < array.Length(); i++) {
- code ^= array.At(i);
- ASSERT(!code.IsNull());
- size += code.Size();
- }
- return size;
- }
-
- // Array holding code that is being kept around only for the profiler.
- const GrowableObjectArray& previous_;
- // Array holding code that should continue to be kept around for the profiler.
- const GrowableObjectArray& current_;
-};
-
ProfileFunctionSourcePosition::ProfileFunctionSourcePosition(
TokenPosition token_pos)
: token_pos_(token_pos), exclusive_ticks_(0), inclusive_ticks_(0) {}
@@ -990,7 +923,6 @@
filter_(filter),
sample_buffer_(sample_buffer),
profile_(profile),
- deoptimized_code_(new DeoptimizedCodeSet(thread->isolate())),
null_code_(Code::null()),
null_function_(Function::ZoneHandle()),
inclusive_tree_(false),
@@ -1506,7 +1438,6 @@
SampleFilter* filter_;
SampleBuffer* sample_buffer_;
Profile* profile_;
- DeoptimizedCodeSet* deoptimized_code_;
const AbstractCode null_code_;
const Function& null_function_;
bool inclusive_tree_;
diff --git a/runtime/vm/random.cc b/runtime/vm/random.cc
index 1451cf2..2cc2335 100644
--- a/runtime/vm/random.cc
+++ b/runtime/vm/random.cc
@@ -53,19 +53,26 @@
// The algorithm used here is Multiply with Carry (MWC) with a Base b = 2^32.
// http://en.wikipedia.org/wiki/Multiply-with-carry
// The constant A is selected from "Numerical Recipes 3rd Edition" p.348 B1.
-void Random::NextState() {
+uint64_t Random::NextState() {
const uint64_t MASK_32 = 0xffffffff;
const uint64_t A = 0xffffda61;
- uint64_t state_lo = _state & MASK_32;
- uint64_t state_hi = (_state >> 32) & MASK_32;
- _state = (A * state_lo) + state_hi;
+ uint64_t old_state = _state;
+ while (true) {
+ const uint64_t state_lo = old_state & MASK_32;
+ const uint64_t state_hi = (old_state >> 32) & MASK_32;
+ const uint64_t new_state = (A * state_lo) + state_hi;
+ if (_state.compare_exchange_weak(old_state, new_state,
+ std::memory_order_relaxed,
+ std::memory_order_relaxed)) {
+ return new_state;
+ }
+ }
}
uint32_t Random::NextUInt32() {
const uint64_t MASK_32 = 0xffffffff;
- NextState();
- return static_cast<uint32_t>(_state & MASK_32);
+ return static_cast<uint32_t>(NextState() & MASK_32);
}
} // namespace dart
diff --git a/runtime/vm/random.h b/runtime/vm/random.h
index 67dda32..4af724b 100644
--- a/runtime/vm/random.h
+++ b/runtime/vm/random.h
@@ -5,6 +5,8 @@
#ifndef RUNTIME_VM_RANDOM_H_
#define RUNTIME_VM_RANDOM_H_
+#include <atomic>
+
#include "vm/allocation.h"
#include "vm/flags.h"
#include "vm/globals.h"
@@ -27,10 +29,10 @@
}
private:
- void NextState();
+ uint64_t NextState();
void Initialize(uint64_t seed);
- uint64_t _state;
+ std::atomic<uint64_t> _state;
DISALLOW_COPY_AND_ASSIGN(Random);
};
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index 94e3f38..2a7cbd5 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -2527,7 +2527,7 @@
const char* script_uri;
{
- NoReloadScope no_reload(isolate, thread);
+ NoReloadScope no_reload(isolate_group, thread);
const Library& lib =
Library::Handle(isolate_group->object_store()->_internal_library());
const Class& cls = Class::Handle(
@@ -2753,7 +2753,7 @@
SafepointWriteRwLocker ml(thread,
thread->isolate_group()->program_lock());
Field& field =
- Field::Handle(zone, isolate->GetDeoptimizingBoxedField());
+ Field::Handle(zone, isolate->group()->GetDeoptimizingBoxedField());
while (!field.IsNull()) {
if (FLAG_trace_optimization || FLAG_trace_field_guards) {
THR_Print("Lazy disabling unboxing of %s\n", field.ToCString());
@@ -2761,7 +2761,7 @@
field.set_is_unboxing_candidate(false);
field.DeoptimizeDependentCode();
// Get next field.
- field = isolate->GetDeoptimizingBoxedField();
+ field = isolate->group()->GetDeoptimizingBoxedField();
}
}
if (!BackgroundCompiler::IsDisabled(isolate,
@@ -2952,7 +2952,9 @@
}
}
-void DeoptimizeAt(const Code& optimized_code, StackFrame* frame) {
+void DeoptimizeAt(Isolate* isolate,
+ const Code& optimized_code,
+ StackFrame* frame) {
ASSERT(optimized_code.is_optimized());
// Force-optimized code is optimized code which cannot deoptimize and doesn't
@@ -2993,7 +2995,7 @@
// N.B.: Update the pending deopt table before updating the frame. The
// profiler may attempt a stack walk in between.
- thread->isolate()->AddPendingDeopt(frame->fp(), deopt_pc);
+ isolate->AddPendingDeopt(frame->fp(), deopt_pc);
frame->MarkForLazyDeopt();
if (FLAG_trace_deoptimization) {
@@ -3011,22 +3013,21 @@
void DeoptimizeFunctionsOnStack() {
auto isolate_group = IsolateGroup::Current();
isolate_group->RunWithStoppedMutators([&]() {
- auto current = isolate_group->thread_registry()->active_list();
Code& optimized_code = Code::Handle();
- while (current != nullptr) {
+ isolate_group->ForEachIsolate([&](Isolate* isolate) {
DartFrameIterator iterator(
- current, StackFrameIterator::kAllowCrossThreadIteration);
+ isolate->mutator_thread(),
+ StackFrameIterator::kAllowCrossThreadIteration);
StackFrame* frame = iterator.NextFrame();
- while (frame != NULL) {
+ while (frame != nullptr) {
optimized_code = frame->LookupDartCode();
if (optimized_code.is_optimized() &&
!optimized_code.is_force_optimized()) {
- DeoptimizeAt(optimized_code, frame);
+ DeoptimizeAt(isolate, optimized_code, frame);
}
frame = iterator.NextFrame();
}
- current = current->next();
- }
+ });
});
}
diff --git a/runtime/vm/runtime_entry.h b/runtime/vm/runtime_entry.h
index d4ce293..f1171a6 100644
--- a/runtime/vm/runtime_entry.h
+++ b/runtime/vm/runtime_entry.h
@@ -160,7 +160,9 @@
const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason);
-void DeoptimizeAt(const Code& optimized_code, StackFrame* frame);
+void DeoptimizeAt(Isolate* isolate,
+ const Code& optimized_code,
+ StackFrame* frame);
void DeoptimizeFunctionsOnStack();
double DartModulo(double a, double b);
diff --git a/runtime/vm/thread_registry.h b/runtime/vm/thread_registry.h
index 4a32f5f..e0c80a3 100644
--- a/runtime/vm/thread_registry.h
+++ b/runtime/vm/thread_registry.h
@@ -58,8 +58,6 @@
friend class IsolateGroup;
friend class SafepointHandler;
friend class Scavenger;
- friend class WeakCodeReferences;
- friend void DeoptimizeFunctionsOnStack();
DISALLOW_COPY_AND_ASSIGN(ThreadRegistry);
};
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index a65d61c..9213cfd 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -528,19 +528,15 @@
return Api::Success();
}
-Dart_Handle TestCase::TriggerReload(const uint8_t* kernel_buffer,
- intptr_t kernel_buffer_size) {
+Dart_Handle TestCase::TriggerReload(
+ std::function<bool(Isolate*, JSONStream*)> do_reload) {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
JSONStream js;
bool success = false;
{
TransitionNativeToVM transition(thread);
- success =
- isolate->group()->ReloadKernel(&js,
- false, // force_reload
- kernel_buffer, kernel_buffer_size,
- true); // dont_delete_reload_context
+ success = do_reload(isolate, &js);
OS::PrintErr("RELOAD REPORT:\n%s\n", js.ToCString());
}
@@ -569,6 +565,26 @@
return result;
}
+Dart_Handle TestCase::TriggerReload(const char* root_script_url) {
+ return TriggerReload([&](Isolate* isolate, JSONStream* js) {
+ return isolate->group()->ReloadSources(js,
+ /*force_reload=*/false,
+ root_script_url,
+ /*packages_url=*/nullptr,
+ /*dont_delete_reload_context=*/true);
+ });
+}
+
+Dart_Handle TestCase::TriggerReload(const uint8_t* kernel_buffer,
+ intptr_t kernel_buffer_size) {
+ return TriggerReload([&](Isolate* isolate, JSONStream* js) {
+ return isolate->group()->ReloadKernel(js,
+ /*force_reload=*/false, kernel_buffer,
+ kernel_buffer_size,
+ /*dont_delete_reload_context=*/true);
+ });
+}
+
Dart_Handle TestCase::ReloadTestScript(const char* script) {
Dart_SourceFile* sourcefiles = NULL;
intptr_t num_files = BuildSourceFilesArray(&sourcefiles, script);
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index 89bc50e..50d39eb 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -5,6 +5,8 @@
#ifndef RUNTIME_VM_UNIT_TEST_H_
#define RUNTIME_VM_UNIT_TEST_H_
+#include <functional>
+
#include "include/dart_native_api.h"
#include "platform/globals.h"
@@ -378,6 +380,7 @@
// Initiates the reload.
static Dart_Handle TriggerReload(const uint8_t* kernel_buffer,
intptr_t kernel_buffer_size);
+ static Dart_Handle TriggerReload(const char* root_script_url);
// Helper function which reloads the current isolate using |script|.
static Dart_Handle ReloadTestScript(const char* script);
@@ -397,6 +400,9 @@
static const char* LateTag() { return IsNNBD() ? "late" : ""; }
private:
+ static Dart_Handle TriggerReload(
+ std::function<bool(Isolate*, JSONStream*)> do_reload);
+
// |data_buffer| can either be snapshot data, or kernel binary data.
// If |data_buffer| is snapshot data, then |len| should be zero as snapshot
// size is encoded within them. If |len| is non-zero, then |data_buffer|
diff --git a/sdk/lib/_internal/sdk_library_metadata/pubspec.yaml b/sdk/lib/_internal/sdk_library_metadata/pubspec.yaml
index 7f66713..5624a4e 100644
--- a/sdk/lib/_internal/sdk_library_metadata/pubspec.yaml
+++ b/sdk/lib/_internal/sdk_library_metadata/pubspec.yaml
@@ -3,4 +3,4 @@
name: sdk_library_metadata
publish_to: none
environment:
- sdk: '>=2.11.0 <3.0.0'
+ sdk: '>=2.12.0 <3.0.0'
diff --git a/tools/VERSION b/tools/VERSION
index 7e70b16..8ef6d63 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -25,7 +25,7 @@
#
CHANNEL dev
MAJOR 2
-MINOR 12
+MINOR 13
PATCH 0
-PRERELEASE 286
+PRERELEASE 0
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index 823773d..bd85a2b 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -97,7 +97,7 @@
# default 'language' "category" with code generated for both CFE and Analyzer,
# while other categories can be tailored more specifically.
-current-version: '2.12.0'
+current-version: '2.13.0'
features:
triple-shift:
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index 08b7920..516dcf7 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -19,6 +19,7 @@
...listSubdirectories('pkg'),
...listSubdirectories('third_party/pkg'),
...listSubdirectories('third_party/pkg_tested'),
+ ...listSubdirectories('third_party/pkg/file/packages'),
...listSubdirectories('third_party/pkg/test/pkgs'),
packageDirectory('runtime/observatory'),
packageDirectory(
@@ -27,7 +28,6 @@
packageDirectory(
'runtime/observatory_2/tests/service_2/observatory_test_package_2'),
packageDirectory('sdk/lib/_internal/sdk_library_metadata'),
- packageDirectory('sdk/lib/_internal/js_runtime'),
packageDirectory('third_party/pkg/protobuf/protobuf'),
packageDirectory('tools/package_deps'),
];