Version 2.12.0-283.0.dev
Merge commit '4b0c228e483e4c70c333cc4b9abcd49d75572faf' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index 429b915..70cfbb2 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -56,6 +56,11 @@
"packageUri": ".nonexisting/"
},
{
+ "name": "_fe_analyzer_shared_why_not_promoted",
+ "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted",
+ "packageUri": ".nonexisting/"
+ },
+ {
"name": "_js_interop_checks",
"rootUri": "../pkg/_js_interop_checks",
"packageUri": "lib/",
diff --git a/DEPS b/DEPS
index 6ba4e67..d1a47cc 100644
--- a/DEPS
+++ b/DEPS
@@ -39,7 +39,7 @@
# Checked-in SDK version. The checked-in SDK is a Dart SDK distribution in a
# cipd package used to run Dart scripts in the build and test infrastructure.
- "sdk_tag": "version:2.12.0-133.2.beta",
+ "sdk_tag": "version:2.12.0-259.8.beta",
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
# hashes. It requires access to the dart-build-access group, which EngProd
diff --git a/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml b/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml
index bba3f74..467f323 100644
--- a/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml
+++ b/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml
@@ -15,4 +15,5 @@
- test/flow_analysis/nullability/data/**
- test/flow_analysis/reachability/data/**
- test/flow_analysis/type_promotion/data/**
+ - test/flow_analysis/why_not_promoted/data/**
- test/inheritance/data/**
diff --git a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
index 6809bbc..327b003 100644
--- a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
@@ -307,6 +307,61 @@
'_declared=$_declared)';
}
+/// Non-promotion reason describing the situation where a variable was not
+/// promoted due to an explicit write to the variable appearing somewhere in the
+/// source code.
+class DemoteViaExplicitWrite<Variable extends Object, Expression extends Object>
+ extends NonPromotionReason {
+ /// The local variable that was not promoted.
+ final Variable variable;
+
+ /// The expression that wrote to the variable; this corresponds to an
+ /// expression that was passed to [FlowAnalysis.write].
+ final Expression writeExpression;
+
+ DemoteViaExplicitWrite(this.variable, this.writeExpression);
+
+ @override
+ String get shortName => 'explicitWrite';
+
+ @override
+ R accept<R, Node extends Object, Expression extends Object,
+ Variable extends Object>(
+ NonPromotionReasonVisitor<R, Node, Expression, Variable> visitor) =>
+ visitor.visitDemoteViaExplicitWrite(
+ this as DemoteViaExplicitWrite<Variable, Expression>);
+
+ @override
+ String toString() => 'DemoteViaExplicitWrite($writeExpression)';
+}
+
+/// Non-promotion reason describing the situation where a variable was not
+/// promoted due to the variable appearing before the word `in` in a "for each"
+/// statement or a "for each" collection element.
+class DemoteViaForEachVariableWrite<Variable extends Object,
+ Node extends Object> extends NonPromotionReason {
+ /// The local variable that was not promoted.
+ final Variable variable;
+
+ /// The "for each" statement or collection element that wrote to the variable.
+ final Node node;
+
+ DemoteViaForEachVariableWrite(this.variable, this.node);
+
+ @override
+ String get shortName => 'explicitWrite';
+
+ @override
+ R accept<R, Node extends Object, Expression extends Object,
+ Variable extends Object>(
+ NonPromotionReasonVisitor<R, Node, Expression, Variable> visitor) =>
+ visitor.visitDemoteViaForEachVariableWrite(
+ this as DemoteViaForEachVariableWrite<Variable, Node>);
+
+ @override
+ String toString() => 'DemoteViaForEachVariableWrite($node)';
+}
+
/// A collection of flow models representing the possible outcomes of evaluating
/// an expression that are relevant to flow analysis.
class ExpressionInfo<Variable extends Object, Type extends Object> {
@@ -338,6 +393,24 @@
'ExpressionInfo(after: $after, _ifTrue: $ifTrue, ifFalse: $ifFalse)';
}
+/// Non-promotion reason describing the situation where an expression was not
+/// promoted due to the fact that it's a field (technically, a property get).
+class FieldNotPromoted extends NonPromotionReason {
+ /// The name of the property.
+ final String propertyName;
+
+ FieldNotPromoted(this.propertyName);
+
+ @override
+ String get shortName => 'fieldNotPromoted($propertyName)';
+
+ @override
+ R accept<R, Node extends Object, Expression extends Object,
+ Variable extends Object>(
+ NonPromotionReasonVisitor<R, Node, Expression, Variable> visitor) =>
+ visitor.visitFieldNotPromoted(this);
+}
+
/// Implementation of flow analysis to be shared between the analyzer and the
/// front end.
///
@@ -715,6 +788,13 @@
/// is currently promoted. Otherwise returns `null`.
Type? promotedType(Variable variable);
+ /// Call this method just after visiting a property get expression.
+ /// [wholeExpression] should be the whole property get, [target] should be the
+ /// expression to the left hand side of the `.`, and [propertyName] should be
+ /// the identifier to the right hand side of the `.`.
+ void propertyGet(
+ Expression wholeExpression, Expression target, String propertyName);
+
/// Retrieves the SSA node associated with [variable], or `null` if [variable]
/// is not associated with an SSA node because it is write captured. For
/// testing only.
@@ -750,6 +830,20 @@
/// - Call [switchStatement_end].
void switchStatement_expressionEnd(Statement switchStatement);
+ /// Call this method just after visiting the expression `this` (or the
+ /// pseudo-expression `super`, in the case of the analyzer, which represents
+ /// `super.x` as a property get whose target is `super`). [expression] should
+ /// be the `this` or `super` expression.
+ void thisOrSuper(Expression expression);
+
+ /// Call this method just after visiting an expression that represents a
+ /// property get on `this` or `super`. This handles situations where there is
+ /// an implicit reference to `this`, or the case of the front end, where
+ /// `super.x` is represented by a single expression. [expression] should be
+ /// the whole property get, and [propertyName] should be the name of the
+ /// property being read.
+ void thisOrSuperPropertyGet(Expression expression, String propertyName);
+
/// Call this method just before visiting the body of a "try/catch" statement.
///
/// The order of visiting a "try/catch" statement should be:
@@ -855,8 +949,23 @@
/// Call this method after visiting a "while" statement.
void whileStatement_end();
+ /// Call this method when an error occurs that may be due to a lack of type
+ /// promotion, to retrieve information about why [target] was not promoted.
+ /// This call must be made right after visiting [target].
+ ///
+ /// The returned value is a map whose keys are types that the user might have
+ /// been expecting the target to be promoted to, and whose values are reasons
+ /// why the corresponding promotion did not occur. The caller is expected to
+ /// select which non-promotion reason to report to the user by seeing which
+ /// promotion would have prevented the error. (For example, if an error
+ /// occurs due to the target having a nullable type, the caller should report
+ /// a non-promotion reason associated with non-promotion to a non-nullable
+ /// type).
+ Map<Type, NonPromotionReason> whyNotPromoted(Expression target);
+
/// Register write of the given [variable] in the current state.
/// [writtenType] should be the type of the value that was written.
+ /// [expression] should be the whole expression performing the write.
/// [writtenExpression] should be the expression that was written, or `null`
/// if the expression that was written is not directly represented in the
/// source code (this happens, for example, with compound assignments and with
@@ -865,8 +974,8 @@
/// This should also be used for the implicit write to a non-final variable in
/// its initializer, to ensure that the type is promoted to non-nullable if
/// necessary; in this case, [viaInitializer] should be `true`.
- void write(
- Variable variable, Type writtenType, Expression? writtenExpression);
+ void write(Expression expression, Variable variable, Type writtenType,
+ Expression? writtenExpression);
/// Prints out a summary of the current state of flow analysis, intended for
/// debugging use only.
@@ -1249,6 +1358,13 @@
}
@override
+ void propertyGet(
+ Expression wholeExpression, Expression target, String propertyName) {
+ _wrap('propertyGet($wholeExpression, $target, $propertyName)',
+ () => _wrapped.propertyGet(wholeExpression, target, propertyName));
+ }
+
+ @override
SsaNode<Variable, Type>? ssaNodeForTesting(Variable variable) {
return _wrap('ssaNodeForTesting($variable)',
() => _wrapped.ssaNodeForTesting(variable),
@@ -1274,6 +1390,18 @@
}
@override
+ void thisOrSuper(Expression expression) {
+ return _wrap(
+ 'thisOrSuper($expression)', () => _wrapped.thisOrSuper(expression));
+ }
+
+ @override
+ void thisOrSuperPropertyGet(Expression expression, String propertyName) {
+ _wrap('thisOrSuperPropertyGet($expression, $propertyName)',
+ () => _wrapped.thisOrSuperPropertyGet(expression, propertyName));
+ }
+
+ @override
void tryCatchStatement_bodyBegin() {
return _wrap('tryCatchStatement_bodyBegin()',
() => _wrapped.tryCatchStatement_bodyBegin());
@@ -1350,10 +1478,19 @@
}
@override
- void write(
- Variable variable, Type writtenType, Expression? writtenExpression) {
- _wrap('write($variable, $writtenType, $writtenExpression)',
- () => _wrapped.write(variable, writtenType, writtenExpression));
+ Map<Type, NonPromotionReason> whyNotPromoted(Expression target) {
+ return _wrap(
+ 'whyNotPromoted($target)', () => _wrapped.whyNotPromoted(target),
+ isQuery: true);
+ }
+
+ @override
+ void write(Expression expression, Variable variable, Type writtenType,
+ Expression? writtenExpression) {
+ _wrap(
+ 'write($expression, $variable, $writtenType, $writtenExpression)',
+ () => _wrapped.write(
+ expression, variable, writtenType, writtenExpression));
}
@override
@@ -1403,10 +1540,14 @@
/// variable is not in scope anymore. This should not have any effect on
/// analysis results for error-free code, because it is an error to refer to a
/// variable that is no longer in scope.
- final Map<Variable, VariableModel<Variable, Type> /*!*/ > variableInfo;
+ ///
+ /// `null` is allowed as a special key; it represents the pseudo-variable
+ /// `this`. (This is needed so that we can explain why `this` is not
+ /// promoted, and why properties of `this` are not promoted).
+ final Map<Variable?, VariableModel<Variable, Type> /*!*/ > variableInfo;
/// The empty map, used to [join] variables.
- final Map<Variable, VariableModel<Variable, Type>> _emptyVariableMap = {};
+ final Map<Variable?, VariableModel<Variable, Type>> _emptyVariableMap = {};
/// Creates a state object with the given [reachable] status. All variables
/// are assumed to be unpromoted and already assigned, so joining another
@@ -1455,13 +1596,13 @@
Reachability newReachable = afterFinally.reachable.rebaseForward(reachable);
// Consider each variable that is common to all three models.
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo =
- <Variable, VariableModel<Variable, Type>>{};
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo =
+ <Variable?, VariableModel<Variable, Type>>{};
bool variableInfoMatchesThis = true;
bool variableInfoMatchesAfterFinally = true;
- for (MapEntry<Variable, VariableModel<Variable, Type>> entry
+ for (MapEntry<Variable?, VariableModel<Variable, Type>> entry
in variableInfo.entries) {
- Variable variable = entry.key;
+ Variable? variable = entry.key;
VariableModel<Variable, Type> thisModel = entry.value;
VariableModel<Variable, Type>? beforeFinallyModel =
beforeFinally.variableInfo[variable];
@@ -1524,7 +1665,7 @@
// erroneously think that `newVariableInfo` matches `afterFinally`. If so,
// correct that.
if (variableInfoMatchesAfterFinally) {
- for (Variable variable in afterFinally.variableInfo.keys) {
+ for (Variable? variable in afterFinally.variableInfo.keys) {
if (!variableInfo.containsKey(variable)) {
variableInfoMatchesAfterFinally = false;
break;
@@ -1567,7 +1708,7 @@
FlowModel<Variable, Type> conservativeJoin(
Iterable<Variable> writtenVariables,
Iterable<Variable> capturedVariables) {
- Map<Variable, VariableModel<Variable, Type>>? newVariableInfo;
+ Map<Variable?, VariableModel<Variable, Type>>? newVariableInfo;
for (Variable variable in writtenVariables) {
VariableModel<Variable, Type> info = infoFor(variable);
@@ -1575,7 +1716,7 @@
info.discardPromotionsAndMarkNotUnassigned();
if (!identical(info, newInfo)) {
(newVariableInfo ??=
- new Map<Variable, VariableModel<Variable, Type>>.from(
+ new Map<Variable?, VariableModel<Variable, Type>>.from(
variableInfo))[variable] = newInfo;
}
}
@@ -1630,14 +1771,14 @@
FlowModel<Variable, Type> inheritTested(
TypeOperations<Variable, Type> typeOperations,
FlowModel<Variable, Type> other) {
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo =
- <Variable, VariableModel<Variable, Type>>{};
- Map<Variable, VariableModel<Variable, Type>> otherVariableInfo =
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo =
+ <Variable?, VariableModel<Variable, Type>>{};
+ Map<Variable?, VariableModel<Variable, Type>> otherVariableInfo =
other.variableInfo;
bool changed = false;
- for (MapEntry<Variable, VariableModel<Variable, Type>> entry
+ for (MapEntry<Variable?, VariableModel<Variable, Type>> entry
in variableInfo.entries) {
- Variable variable = entry.key;
+ Variable? variable = entry.key;
VariableModel<Variable, Type> variableModel = entry.value;
VariableModel<Variable, Type>? otherVariableModel =
otherVariableInfo[variable];
@@ -1674,13 +1815,13 @@
Reachability newReachable = reachable.rebaseForward(base.reachable);
// Consider each variable in the new base model.
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo =
- <Variable, VariableModel<Variable, Type>>{};
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo =
+ <Variable?, VariableModel<Variable, Type>>{};
bool variableInfoMatchesThis = true;
bool variableInfoMatchesBase = true;
- for (MapEntry<Variable, VariableModel<Variable, Type>> entry
+ for (MapEntry<Variable?, VariableModel<Variable, Type>> entry
in base.variableInfo.entries) {
- Variable variable = entry.key;
+ Variable? variable = entry.key;
VariableModel<Variable, Type> baseModel = entry.value;
VariableModel<Variable, Type>? thisModel = variableInfo[variable];
if (thisModel == null) {
@@ -1736,7 +1877,7 @@
// present in `this` that aren't present in `base`, we may erroneously think
// that `newVariableInfo` matches `this`. If so, correct that.
if (variableInfoMatchesThis) {
- for (Variable variable in variableInfo.keys) {
+ for (Variable? variable in variableInfo.keys) {
if (!base.variableInfo.containsKey(variable)) {
variableInfoMatchesThis = false;
break;
@@ -1789,13 +1930,13 @@
Reachability newReachable =
Reachability.restrict(reachable, other.reachable);
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo =
- <Variable, VariableModel<Variable, Type>>{};
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo =
+ <Variable?, VariableModel<Variable, Type>>{};
bool variableInfoMatchesThis = true;
bool variableInfoMatchesOther = true;
- for (MapEntry<Variable, VariableModel<Variable, Type>> entry
+ for (MapEntry<Variable?, VariableModel<Variable, Type>> entry
in variableInfo.entries) {
- Variable variable = entry.key;
+ Variable? variable = entry.key;
VariableModel<Variable, Type> thisModel = entry.value;
VariableModel<Variable, Type>? otherModel = other.variableInfo[variable];
if (otherModel == null) {
@@ -1809,7 +1950,7 @@
if (!identical(restricted, otherModel)) variableInfoMatchesOther = false;
}
if (variableInfoMatchesOther) {
- for (Variable variable in other.variableInfo.keys) {
+ for (Variable? variable in other.variableInfo.keys) {
if (!variableInfo.containsKey(variable)) {
variableInfoMatchesOther = false;
break;
@@ -1975,7 +2116,12 @@
/// Updates the state to indicate that an assignment was made to the given
/// [variable]. The variable is marked as definitely assigned, and any
/// previous type promotion is removed.
+ ///
+ /// If there is any chance that the write will cause a demotion, the caller
+ /// must pass in a non-null value for [nonPromotionReason] describing the
+ /// reason for any potential demotion.
FlowModel<Variable, Type> write(
+ NonPromotionReason? nonPromotionReason,
Variable variable,
Type writtenType,
SsaNode<Variable, Type> newSsaNode,
@@ -1983,8 +2129,8 @@
VariableModel<Variable, Type>? infoForVar = variableInfo[variable];
if (infoForVar == null) return this;
- VariableModel<Variable, Type> newInfoForVar =
- infoForVar.write(variable, writtenType, typeOperations, newSsaNode);
+ VariableModel<Variable, Type> newInfoForVar = infoForVar.write(
+ nonPromotionReason, variable, writtenType, typeOperations, newSsaNode);
if (identical(newInfoForVar, infoForVar)) return this;
return _updateVariableInfo(new VariableReference(variable), newInfoForVar);
@@ -2019,7 +2165,8 @@
if (promotedType != null) {
newPromotedTypes =
VariableModel._addToPromotedTypes(info.promotedTypes, promotedType);
- if (typeOperations.isNever(promotedType)) {
+ if (reference is VariableReference<Object, Object> &&
+ typeOperations.isNever(promotedType)) {
newReachable = reachable.setUnreachable();
}
}
@@ -2035,7 +2182,8 @@
tested: newTested,
assigned: info.assigned,
unassigned: info.unassigned,
- ssaNode: info.ssaNode),
+ ssaNode: info.ssaNode,
+ nonPromotionHistory: info.nonPromotionHistory),
reachable: newReachable);
}
@@ -2045,8 +2193,8 @@
Reference<Variable, Type> reference, VariableModel<Variable, Type> model,
{Reachability? reachable}) {
reachable ??= this.reachable;
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo =
- new Map<Variable, VariableModel<Variable, Type>>.from(variableInfo);
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo =
+ new Map<Variable?, VariableModel<Variable, Type>>.from(variableInfo);
reference.storeInfo(newVariableInfo, model);
return new FlowModel<Variable, Type>.withInfo(reachable, newVariableInfo);
}
@@ -2065,7 +2213,7 @@
TypeOperations<Variable, Type> typeOperations,
FlowModel<Variable, Type>? first,
FlowModel<Variable, Type>? second,
- Map<Variable, VariableModel<Variable, Type>> emptyVariableMap,
+ Map<Variable?, VariableModel<Variable, Type>> emptyVariableMap,
) {
if (first == null) return second!;
if (second == null) return first;
@@ -2082,7 +2230,7 @@
Reachability newReachable =
Reachability.join(first.reachable, second.reachable);
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo =
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo =
FlowModel.joinVariableInfo(typeOperations, first.variableInfo,
second.variableInfo, emptyVariableMap);
@@ -2092,25 +2240,25 @@
/// Joins two "variable info" maps. See [join] for details.
@visibleForTesting
- static Map<Variable, VariableModel<Variable, Type>>
+ static Map<Variable?, VariableModel<Variable, Type>>
joinVariableInfo<Variable extends Object, Type extends Object>(
TypeOperations<Variable, Type> typeOperations,
- Map<Variable, VariableModel<Variable, Type>> first,
- Map<Variable, VariableModel<Variable, Type>> second,
- Map<Variable, VariableModel<Variable, Type>> emptyMap,
+ Map<Variable?, VariableModel<Variable, Type>> first,
+ Map<Variable?, VariableModel<Variable, Type>> second,
+ Map<Variable?, VariableModel<Variable, Type>> emptyMap,
) {
if (identical(first, second)) return first;
if (first.isEmpty || second.isEmpty) {
return emptyMap;
}
- Map<Variable, VariableModel<Variable, Type>> result =
- <Variable, VariableModel<Variable, Type>>{};
+ Map<Variable?, VariableModel<Variable, Type>> result =
+ <Variable?, VariableModel<Variable, Type>>{};
bool alwaysFirst = true;
bool alwaysSecond = true;
- for (MapEntry<Variable, VariableModel<Variable, Type>> entry
+ for (MapEntry<Variable?, VariableModel<Variable, Type>> entry
in first.entries) {
- Variable variable = entry.key;
+ Variable? variable = entry.key;
VariableModel<Variable, Type>? secondModel = second[variable];
if (secondModel == null) {
alwaysFirst = false;
@@ -2137,7 +2285,7 @@
TypeOperations<Variable, Type> typeOperations,
FlowModel<Variable, Type>? first,
FlowModel<Variable, Type>? second,
- Map<Variable, VariableModel<Variable, Type>> emptyVariableMap,
+ Map<Variable?, VariableModel<Variable, Type>> emptyVariableMap,
) {
if (first == null) return second!.unsplit();
if (second == null) return first.unsplit();
@@ -2154,7 +2302,7 @@
Reachability newReachable =
Reachability.join(first.reachable, second.reachable).unsplit();
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo =
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo =
FlowModel.joinVariableInfo(typeOperations, first.variableInfo,
second.variableInfo, emptyVariableMap);
@@ -2169,7 +2317,7 @@
FlowModel<Variable, Type> first,
FlowModel<Variable, Type> second,
Reachability newReachable,
- Map<Variable, VariableModel<Variable, Type>> newVariableInfo) {
+ Map<Variable?, VariableModel<Variable, Type>> newVariableInfo) {
if (first.reachable == newReachable &&
identical(first.variableInfo, newVariableInfo)) {
return first;
@@ -2188,11 +2336,11 @@
/// The equivalence check is shallow; if two variables' models are not
/// identical, we return `false`.
static bool _variableInfosEqual<Variable extends Object, Type extends Object>(
- Map<Variable, VariableModel<Variable, Type>> p1,
- Map<Variable, VariableModel<Variable, Type>> p2) {
+ Map<Variable?, VariableModel<Variable, Type>> p1,
+ Map<Variable?, VariableModel<Variable, Type>> p2) {
if (p1.length != p2.length) return false;
if (!p1.keys.toSet().containsAll(p2.keys)) return false;
- for (MapEntry<Variable, VariableModel<Variable, Type>> entry
+ for (MapEntry<Variable?, VariableModel<Variable, Type>> entry
in p1.entries) {
VariableModel<Variable, Type> p1Value = entry.value;
VariableModel<Variable, Type>? p2Value = p2[entry.key];
@@ -2204,6 +2352,62 @@
}
}
+/// Linked list node representing a set of reasons why a given expression was
+/// not promoted.
+///
+/// We use a linked list representation because it is very efficient to build;
+/// this means that in the "happy path" where no error occurs (so non-promotion
+/// history is not needed) we do a minimal amount of work.
+class NonPromotionHistory<Type> {
+ /// The type that was not promoted to.
+ final Type type;
+
+ /// The reason why the promotion didn't occur.
+ final NonPromotionReason nonPromotionReason;
+
+ /// The previous link in the list.
+ final NonPromotionHistory<Type>? previous;
+
+ NonPromotionHistory(this.type, this.nonPromotionReason, this.previous);
+
+ @override
+ String toString() {
+ List<String> items = <String>[];
+ for (NonPromotionHistory<Type>? link = this;
+ link != null;
+ link = link.previous) {
+ items.add('${link.type}: ${link.nonPromotionReason}');
+ }
+ return items.toString();
+ }
+}
+
+/// Abstract class representing a reason why something was not promoted.
+abstract class NonPromotionReason {
+ /// Short text description of this non-promotion reason; intended for ID
+ /// testing.
+ String get shortName;
+
+ /// Implementation of the visitor pattern for non-promotion reasons.
+ R accept<R, Node extends Object, Expression extends Object,
+ Variable extends Object>(
+ NonPromotionReasonVisitor<R, Node, Expression, Variable> visitor);
+}
+
+/// Implementation of the visitor pattern for non-promotion reasons.
+abstract class NonPromotionReasonVisitor<R, Node extends Object,
+ Expression extends Object, Variable extends Object> {
+ NonPromotionReasonVisitor._() : assert(false, 'Do not extend this class');
+
+ R visitDemoteViaExplicitWrite(
+ DemoteViaExplicitWrite<Variable, Expression> reason);
+
+ R visitDemoteViaForEachVariableWrite(
+ DemoteViaForEachVariableWrite<Variable, Node> reason);
+
+ R visitFieldNotPromoted(FieldNotPromoted reason);
+}
+
/// Immutable data structure modeling the reachability of the given point in the
/// source code. Reachability is tracked relative to checkpoints occurring
/// previously along the control flow path leading up to the current point in
@@ -2359,16 +2563,27 @@
/// Gets the info for this reference, creating it if it doesn't exist.
VariableModel<Variable, Type> getInfo(
- Map<Variable, VariableModel<Variable, Type>> variableInfo) =>
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo) =>
_getInfo(variableInfo) ?? new VariableModel<Variable, Type>.fresh();
+ /// Gets a map of non-promotion reasons associated with this reference. This
+ /// is the map that will be returned from [FlowAnalysis.whyNotPromoted].
+ Map<Type, NonPromotionReason> getNonPromotionReasons(
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo,
+ TypeOperations<Variable, Type> typeOperations);
+
+ /// Creates a reference representing a get of a property called [propertyName]
+ /// on the reference represented by `this`.
+ Reference<Variable, Type> propertyGet(String propertyName) =>
+ new _PropertyGetReference<Variable, Type>(this, propertyName);
+
/// Stores info for this reference in [variableInfo].
- void storeInfo(Map<Variable, VariableModel<Variable, Type>> variableInfo,
+ void storeInfo(Map<Variable?, VariableModel<Variable, Type>> variableInfo,
VariableModel<Variable, Type> variableModel);
/// Gets the info for this reference, or `null` if it doesn't exist.
VariableModel<Variable, Type>? _getInfo(
- Map<Variable, VariableModel<Variable, Type>> variableInfo);
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo);
}
/// Data structure representing a unique value that a variable might take on
@@ -2423,6 +2638,9 @@
/// Operations on types, abstracted from concrete type interfaces.
abstract class TypeOperations<Variable extends Object, Type extends Object> {
+ /// Gets the representation of the top type (`Object?`) in the type system.
+ Type get topType;
+
/// Classifies the given type into one of the three categories defined by
/// the [TypeClassification] enum.
TypeClassification classifyType(Type type);
@@ -2510,12 +2728,22 @@
/// `null` if the variable has been write captured.
final SsaNode<Variable, Type>? ssaNode;
+ /// Non-promotion history of this variable.
+ final NonPromotionHistory<Type>? nonPromotionHistory;
+
+ /// Promotion information for properties of this variable. We don't actually
+ /// promote properties, but we track the promotions that would occur if we
+ /// did, so that we can report those as non-promotion reasons.
+ final Map<String, VariableModel<Variable, Type>> properties;
+
VariableModel(
{required this.promotedTypes,
required this.tested,
required this.assigned,
required this.unassigned,
- required this.ssaNode}) {
+ required this.ssaNode,
+ this.nonPromotionHistory,
+ this.properties = const {}}) {
assert(!(assigned && unassigned),
"Can't be both definitely assigned and unassigned");
assert(promotedTypes == null || promotedTypes!.isNotEmpty);
@@ -2533,7 +2761,9 @@
: promotedTypes = null,
tested = const [],
unassigned = !assigned,
- ssaNode = new SsaNode<Variable, Type>(null);
+ ssaNode = new SsaNode<Variable, Type>(null),
+ nonPromotionHistory = null,
+ properties = const {};
/// Indicates whether the variable has been write captured.
bool get writeCaptured => ssaNode == null;
@@ -2605,6 +2835,18 @@
newAssigned, newUnassigned, newWriteCaptured ? null : ssaNode);
}
+ /// Updates `this` with a new set of properties.
+ VariableModel<Variable, Type> setProperties(
+ Map<String, VariableModel<Variable, Type>> newProperties) =>
+ new VariableModel<Variable, Type>(
+ promotedTypes: promotedTypes,
+ tested: tested,
+ unassigned: unassigned,
+ assigned: assigned,
+ ssaNode: ssaNode,
+ nonPromotionHistory: nonPromotionHistory,
+ properties: newProperties);
+
@override
String toString() {
List<String> parts = [ssaNode.toString()];
@@ -2623,12 +2865,20 @@
if (writeCaptured) {
parts.add('writeCaptured: true');
}
+ if (nonPromotionHistory != null) {
+ parts.add('nonPromotionHistory: $nonPromotionHistory');
+ }
return 'VariableModel(${parts.join(', ')})';
}
/// Returns a new [VariableModel] reflecting the fact that the variable was
/// just written to.
+ ///
+ /// If there is any chance that the write will cause a demotion, the caller
+ /// must pass in a non-null value for [nonPromotionReason] describing the
+ /// reason for any potential demotion.
VariableModel<Variable, Type> write(
+ NonPromotionReason? nonPromotionReason,
Variable variable,
Type writtenType,
TypeOperations<Variable, Type> typeOperations,
@@ -2642,14 +2892,15 @@
ssaNode: null);
}
- List<Type>? newPromotedTypes = _demoteViaAssignment(
- writtenType,
- typeOperations,
- );
+ _DemotionResult<Type> demotionResult =
+ _demoteViaAssignment(writtenType, typeOperations, nonPromotionReason);
+ List<Type>? newPromotedTypes = demotionResult.promotedTypes;
Type declaredType = typeOperations.variableType(variable);
newPromotedTypes = _tryPromoteToTypeOfInterest(
typeOperations, declaredType, newPromotedTypes, writtenType);
+ // TODO(paulberry): remove demotions from demotionResult.nonPromotionHistory
+ // that are no longer in effect due to re-promotion.
if (identical(promotedTypes, newPromotedTypes) && assigned) {
return new VariableModel<Variable, Type>(
promotedTypes: promotedTypes,
@@ -2671,7 +2922,8 @@
tested: newTested,
assigned: true,
unassigned: false,
- ssaNode: newSsaNode);
+ ssaNode: newSsaNode,
+ nonPromotionHistory: demotionResult.nonPromotionHistory);
}
/// Returns a new [VariableModel] reflecting the fact that the variable has
@@ -2685,28 +2937,45 @@
ssaNode: null);
}
- List<Type>? _demoteViaAssignment(
- Type writtenType,
- TypeOperations<Variable, Type> typeOperations,
- ) {
+ /// Computes the result of demoting this variable due to writing a value of
+ /// type [writtenType].
+ ///
+ /// If there is any chance that the write will cause an actual demotion to
+ /// occur, the caller must pass in a non-null value for [nonPromotionReason]
+ /// describing the reason for the potential demotion.
+ _DemotionResult<Type> _demoteViaAssignment(
+ Type writtenType,
+ TypeOperations<Variable, Type> typeOperations,
+ NonPromotionReason? nonPromotionReason) {
List<Type>? promotedTypes = this.promotedTypes;
if (promotedTypes == null) {
- return null;
+ return new _DemotionResult<Type>(null, nonPromotionHistory);
}
int numElementsToKeep = promotedTypes.length;
+ NonPromotionHistory<Type>? newNonPromotionHistory = nonPromotionHistory;
+ List<Type>? newPromotedTypes;
for (;; numElementsToKeep--) {
if (numElementsToKeep == 0) {
- return null;
+ break;
}
Type promoted = promotedTypes[numElementsToKeep - 1];
if (typeOperations.isSubtypeOf(writtenType, promoted)) {
if (numElementsToKeep == promotedTypes.length) {
- return promotedTypes;
+ newPromotedTypes = promotedTypes;
+ break;
}
- return promotedTypes.sublist(0, numElementsToKeep);
+ newPromotedTypes = promotedTypes.sublist(0, numElementsToKeep);
+ break;
+ }
+ if (nonPromotionReason == null) {
+ assert(false, 'Demotion occurred but nonPromotionReason is null');
+ } else {
+ newNonPromotionHistory = new NonPromotionHistory<Type>(
+ promoted, nonPromotionReason, newNonPromotionHistory);
}
}
+ return new _DemotionResult<Type>(newPromotedTypes, newNonPromotionHistory);
}
/// Determines whether a variable with the given [promotedTypes] should be
@@ -3067,14 +3336,36 @@
typeOperations.variableType(variable);
@override
- void storeInfo(Map<Variable, VariableModel<Variable, Type>> variableInfo,
+ Map<Type, NonPromotionReason> getNonPromotionReasons(
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo,
+ TypeOperations<Variable, Type> typeOperations) {
+ Map<Type, NonPromotionReason> result = <Type, NonPromotionReason>{};
+ VariableModel<Variable, Type>? currentVariableInfo = variableInfo[variable];
+ if (currentVariableInfo != null) {
+ Type currentType = currentVariableInfo.promotedTypes?.last ??
+ typeOperations.variableType(variable);
+ NonPromotionHistory? nonPromotionHistory =
+ currentVariableInfo.nonPromotionHistory;
+ while (nonPromotionHistory != null) {
+ Type nonPromotedType = nonPromotionHistory.type;
+ if (!typeOperations.isSubtypeOf(currentType, nonPromotedType)) {
+ result[nonPromotedType] ??= nonPromotionHistory.nonPromotionReason;
+ }
+ nonPromotionHistory = nonPromotionHistory.previous;
+ }
+ }
+ return result;
+ }
+
+ @override
+ void storeInfo(Map<Variable?, VariableModel<Variable, Type>> variableInfo,
VariableModel<Variable, Type> variableModel) {
variableInfo[variable] = variableModel;
}
@override
VariableModel<Variable, Type>? _getInfo(
- Map<Variable, VariableModel<Variable, Type>> variableInfo) =>
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo) =>
variableInfo[variable];
}
@@ -3145,6 +3436,19 @@
'thenInfo: $_thenInfo)';
}
+/// Data structure representing the result of demoting a variable from one type
+/// to another.
+class _DemotionResult<Type extends Object> {
+ /// The new set of promoted types.
+ final List<Type>? promotedTypes;
+
+ /// The new non-promotion history (including the types that the variable is
+ /// no longer promoted to).
+ final NonPromotionHistory<Type>? nonPromotionHistory;
+
+ _DemotionResult(this.promotedTypes, this.nonPromotionHistory);
+}
+
/// [_FlowContext] representing an equality comparison using `==` or `!=`.
class _EqualityOpContext<Variable extends Object, Type extends Object>
extends _BranchContext<Variable, Type> {
@@ -3437,8 +3741,12 @@
_current.reachable.parent!, _current);
_stack.add(context);
if (loopVariable != null) {
- _current = _current.write(loopVariable, writtenType,
- new SsaNode<Variable, Type>(null), typeOperations);
+ _current = _current.write(
+ new DemoteViaForEachVariableWrite<Variable, Node>(loopVariable, node),
+ loopVariable,
+ writtenType,
+ new SsaNode<Variable, Type>(null),
+ typeOperations);
}
}
@@ -3581,8 +3889,8 @@
// written type is the variable's declared type.
initializerType = typeOperations.variableType(variable);
}
- _current =
- _current.write(variable, initializerType, newSsaNode, typeOperations);
+ _current = _current.write(
+ null, variable, initializerType, newSsaNode, typeOperations);
}
@override
@@ -3741,6 +4049,16 @@
}
@override
+ void propertyGet(
+ Expression wholeExpression, Expression target, String propertyName) {
+ Reference<Variable, Type>? reference = _getExpressionReference(target);
+ if (reference != null) {
+ _storeExpressionReference(
+ wholeExpression, reference.propertyGet(propertyName));
+ }
+ }
+
+ @override
SsaNode<Variable, Type>? ssaNodeForTesting(Variable variable) =>
_current.variableInfo[variable]?.ssaNode;
@@ -3785,6 +4103,17 @@
}
@override
+ void thisOrSuper(Expression expression) {
+ _storeExpressionReference(expression, new _ThisReference<Variable, Type>());
+ }
+
+ @override
+ void thisOrSuperPropertyGet(Expression expression, String propertyName) {
+ _storeExpressionReference(expression,
+ new _ThisReference<Variable, Type>().propertyGet(propertyName));
+ }
+
+ @override
void tryCatchStatement_bodyBegin() {
_current = _current.split();
_stack.add(new _TryContext<Variable, Type>(_current));
@@ -3914,15 +4243,31 @@
}
@override
- void write(
- Variable variable, Type writtenType, Expression? writtenExpression) {
+ Map<Type, NonPromotionReason> whyNotPromoted(Expression target) {
+ if (identical(target, _expressionWithReference)) {
+ Reference<Variable, Type>? reference = _expressionReference;
+ if (reference != null) {
+ return reference.getNonPromotionReasons(
+ _current.variableInfo, typeOperations);
+ }
+ }
+ return {};
+ }
+
+ @override
+ void write(Expression expression, Variable variable, Type writtenType,
+ Expression? writtenExpression) {
ExpressionInfo<Variable, Type>? expressionInfo = writtenExpression == null
? null
: _getExpressionInfo(writtenExpression);
SsaNode<Variable, Type> newSsaNode = new SsaNode<Variable, Type>(
expressionInfo is _TrivialExpressionInfo ? null : expressionInfo);
- _current =
- _current.write(variable, writtenType, newSsaNode, typeOperations);
+ _current = _current.write(
+ new DemoteViaExplicitWrite<Variable, Expression>(variable, expression),
+ variable,
+ writtenType,
+ newSsaNode,
+ typeOperations);
}
@override
@@ -4425,6 +4770,10 @@
}
@override
+ void propertyGet(
+ Expression wholeExpression, Expression target, String propertyName) {}
+
+ @override
SsaNode<Variable, Type>? ssaNodeForTesting(Variable variable) {
throw new StateError('ssaNodeForTesting requires null-aware flow analysis');
}
@@ -4439,6 +4788,12 @@
void switchStatement_expressionEnd(Statement switchStatement) {}
@override
+ void thisOrSuper(Expression expression) {}
+
+ @override
+ void thisOrSuperPropertyGet(Expression expression, String propertyName) {}
+
+ @override
void tryCatchStatement_bodyBegin() {}
@override
@@ -4481,8 +4836,13 @@
void whileStatement_end() {}
@override
- void write(
- Variable variable, Type writtenType, Expression? writtenExpression) {
+ Map<Type, NonPromotionReason> whyNotPromoted(Expression target) {
+ return {};
+ }
+
+ @override
+ void write(Expression expression, Variable variable, Type writtenType,
+ Expression? writtenExpression) {
assert(
_assignedVariables._anywhere._written.contains(variable),
"Variable is written to, but was not included in "
@@ -4615,6 +4975,57 @@
null;
}
+/// [Reference] object representing a property get applied to another reference.
+class _PropertyGetReference<Variable extends Object, Type extends Object>
+ extends Reference<Variable, Type> {
+ /// The target of the property get. For example a property get of the form
+ /// `a.b`, where `a` is a local variable, has a target which is a reference to
+ /// `a`.
+ final Reference<Variable, Type> target;
+
+ /// The name of the property.
+ final String propertyName;
+
+ _PropertyGetReference(this.target, this.propertyName);
+
+ @override
+ Type getDeclaredType(TypeOperations<Variable, Type> typeOperations) {
+ return typeOperations.topType;
+ }
+
+ @override
+ Map<Type, NonPromotionReason> getNonPromotionReasons(
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo,
+ TypeOperations<Variable, Type> typeOperations) {
+ Map<Type, NonPromotionReason> result = <Type, NonPromotionReason>{};
+ List<Type>? promotedTypes = _getInfo(variableInfo)?.promotedTypes;
+ if (promotedTypes != null) {
+ for (Type type in promotedTypes) {
+ result[type] = new FieldNotPromoted(propertyName);
+ }
+ }
+ return result;
+ }
+
+ @override
+ void storeInfo(Map<Variable?, VariableModel<Variable, Type>> variableInfo,
+ VariableModel<Variable, Type> variableModel) {
+ VariableModel<Variable, Type> targetInfo = target.getInfo(variableInfo);
+ Map<String, VariableModel<Variable, Type>> newProperties =
+ new Map<String, VariableModel<Variable, Type>>.from(
+ targetInfo.properties);
+ newProperties[propertyName] = variableModel;
+ target.storeInfo(variableInfo, targetInfo.setProperties(newProperties));
+ }
+
+ @override
+ VariableModel<Variable, Type>? _getInfo(
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo) {
+ VariableModel<Variable, Type> targetInfo = target.getInfo(variableInfo);
+ return targetInfo.properties[propertyName];
+ }
+}
+
/// [_FlowContext] representing a language construct for which flow analysis
/// must store a flow model state to be retrieved later, such as a `try`
/// statement, function expression, or "if-null" (`??`) expression.
@@ -4650,6 +5061,36 @@
'checkpoint: $_checkpoint)';
}
+/// [Reference] object representing an implicit or explicit reference to `this`.
+class _ThisReference<Variable extends Object, Type extends Object>
+ extends Reference<Variable, Type> {
+ @override
+ Type getDeclaredType(TypeOperations<Variable, Type> typeOperations) {
+ // TODO(paulberry): can we return the actual type? Would that have a
+ // user-visible effect?
+ return typeOperations.topType;
+ }
+
+ @override
+ Map<Type, NonPromotionReason> getNonPromotionReasons(
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo,
+ TypeOperations<Variable, Type> typeOperations) {
+ // TODO(paulberry): implement.
+ return {};
+ }
+
+ @override
+ void storeInfo(Map<Variable?, VariableModel<Variable, Type>> variableInfo,
+ VariableModel<Variable, Type> variableModel) {
+ variableInfo[null] = variableModel;
+ }
+
+ @override
+ VariableModel<Variable, Type>? _getInfo(
+ Map<Variable?, VariableModel<Variable, Type>> variableInfo) =>
+ variableInfo[null];
+}
+
/// Specialization of [ExpressionInfo] for the case where the information we
/// have about the expression is trivial (meaning we know by construction that
/// the expression's [after], [ifTrue], and [ifFalse] models are all the same).
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index ba1e3a6..8a3aef0 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -4033,6 +4033,29 @@
tip: r"""Try removing 'this.'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String name)> templateFieldNotPromoted =
+ const Template<Message Function(String name)>(
+ messageTemplate:
+ r"""'#name' refers to a property so it could not be promoted.""",
+ withArguments: _withArgumentsFieldNotPromoted);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)> codeFieldNotPromoted =
+ const Code<Message Function(String name)>(
+ "FieldNotPromoted",
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsFieldNotPromoted(String name) {
+ if (name.isEmpty) throw 'No name provided';
+ name = demangleMixinApplicationName(name);
+ return new Message(codeFieldNotPromoted,
+ message:
+ """'${name}' refers to a property so it could not be promoted.""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFinalAndCovariant = messageFinalAndCovariant;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5927,6 +5950,17 @@
message: r"""This is the enclosing class.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeJsInteropExternalMemberNotJSAnnotated =
+ messageJsInteropExternalMemberNotJSAnnotated;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageJsInteropExternalMemberNotJSAnnotated = const MessageCode(
+ "JsInteropExternalMemberNotJSAnnotated",
+ message: r"""Only JS interop members may be 'external'.""",
+ tip:
+ r"""Try removing the 'external' keyword or adding a JS interop annotation.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeJsInteropIndexNotSupported =
messageJsInteropIndexNotSupported;
@@ -9621,6 +9655,34 @@
r"""Try removing the keyword 'var', or replacing it with the name of the return type.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ String
+ name)> templateVariableCouldBeNullDueToWrite = const Template<
+ Message Function(String name)>(
+ messageTemplate:
+ r"""Variable '#name' could be null due to a write occurring here.""",
+ tipTemplate: r"""Try null checking the variable after the write.""",
+ withArguments: _withArgumentsVariableCouldBeNullDueToWrite);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)> codeVariableCouldBeNullDueToWrite =
+ const Code<Message Function(String name)>(
+ "VariableCouldBeNullDueToWrite",
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsVariableCouldBeNullDueToWrite(String name) {
+ if (name.isEmpty) throw 'No name provided';
+ name = demangleMixinApplicationName(name);
+ return new Message(codeVariableCouldBeNullDueToWrite,
+ message:
+ """Variable '${name}' could be null due to a write occurring here.""",
+ tip: """Try null checking the variable after the write.""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeVerificationErrorOriginContext =
messageVerificationErrorOriginContext;
diff --git a/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart b/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart
index 9fb1558..755d20c 100644
--- a/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart
+++ b/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart
@@ -16,6 +16,7 @@
testDir('pkg/_fe_analyzer_shared/test/flow_analysis/nullability/data');
testDir('pkg/_fe_analyzer_shared/test/flow_analysis/reachability/data');
testDir('pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data');
+ testDir('pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data');
testDir('pkg/_fe_analyzer_shared/test/inheritance/data');
}
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_mini_ast.dart b/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_mini_ast.dart
index 9838684..0c02855 100644
--- a/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_mini_ast.dart
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_mini_ast.dart
@@ -154,6 +154,11 @@
{required bool isExhaustive}) =>
new _Switch(expression, cases, isExhaustive);
+Expression this_(String type) => new _This(Type(type));
+
+Expression thisOrSuperPropertyGet(String name, {String type = 'Object?'}) =>
+ new _ThisOrSuperPropertyGet(name, type);
+
Expression throw_(Expression operand) => new _Throw(operand);
Statement tryCatch(List<Statement> body, List<CatchClause> catches) =>
@@ -273,12 +278,24 @@
/// If `this` is an expression `x`, creates the expression `x || other`.
Expression or(Expression other) => new _Logical(this, other, isAnd: false);
+ /// If `this` is an expression `x`, creates the expression `x.name`.
+ Expression propertyGet(String name, {String type = 'Object?'}) =>
+ new _PropertyGet(this, name, type);
+
/// If `this` is an expression `x`, creates a pseudo-expression that models
/// evaluation of `x` followed by execution of [stmt]. This can be used to
/// test that flow analysis is in the correct state after an expression is
/// visited.
Expression thenStmt(Statement stmt) =>
new _WrappedExpression(null, this, stmt);
+
+ /// Creates an [Expression] that, when analyzed, will behave the same as
+ /// `this`, but after visiting it, will cause [callback] to be passed the
+ /// non-promotion info associated with it. If the expression has no
+ /// non-promotion info, an empty map will be passed to [callback].
+ Expression whyNotPromoted(
+ void Function(Map<Type, NonPromotionReason>) callback) =>
+ new _WhyNotPromoted(this, callback);
}
/// Test harness for creating flow analysis tests. This class implements all
@@ -311,8 +328,10 @@
'int? <: num?': true,
'int? <: Object': false,
'int? <: Object?': true,
+ 'Never <: Object?': true,
'Null <: int': false,
'Null <: Object': false,
+ 'Null <: Object?': true,
'num <: int': false,
'num <: Iterable': false,
'num <: List': false,
@@ -347,6 +366,7 @@
'Object <: int': false,
'Object <: int?': false,
'Object <: List': false,
+ 'Object <: Null': false,
'Object <: num': false,
'Object <: num?': false,
'Object <: Object?': true,
@@ -354,6 +374,7 @@
'Object? <: Object': false,
'Object? <: int': false,
'Object? <: int?': false,
+ 'Object? <: Null': false,
'String <: int': false,
'String <: int?': false,
'String <: num?': false,
@@ -364,6 +385,8 @@
static final Map<String, Type> _coreFactors = {
'Object? - int': Type('Object?'),
'Object? - int?': Type('Object'),
+ 'Object? - Never': Type('Object?'),
+ 'Object? - Null': Type('Object'),
'Object? - num?': Type('Object'),
'Object? - Object?': Type('Never?'),
'Object? - String': Type('Object?'),
@@ -410,6 +433,9 @@
Harness({this.allowLocalBooleanVarsToPromote = false, this.legacy = false});
+ @override
+ Type get topType => Type('Object?');
+
/// Updates the harness so that when a [factor] query is invoked on types
/// [from] and [what], [result] will be returned.
void addFactor(String from, String what, String result) {
@@ -597,15 +623,30 @@
/// testing. This is essentially a thin wrapper around a string representation
/// of the type.
class Type {
+ static bool _allowComparisons = false;
+
final String type;
Type(this.type);
@override
+ int get hashCode {
+ if (!_allowComparisons) {
+ // The flow analysis engine should not hash types using hashCode. It
+ // should compare them using TypeOperations.
+ fail('Unexpected use of operator== on types');
+ }
+ return type.hashCode;
+ }
+
+ @override
bool operator ==(Object other) {
- // The flow analysis engine should not compare types using operator==. It
- // should compare them using TypeOperations.
- fail('Unexpected use of operator== on types');
+ if (!_allowComparisons) {
+ // The flow analysis engine should not compare types using operator==. It
+ // should compare them using TypeOperations.
+ fail('Unexpected use of operator== on types');
+ }
+ return other is Type && this.type == other.type;
}
@override
@@ -1424,6 +1465,29 @@
type;
}
+class _PropertyGet extends Expression {
+ final Expression target;
+
+ final String propertyName;
+
+ final String type;
+
+ _PropertyGet(this.target, this.propertyName, this.type);
+
+ @override
+ void _preVisit(AssignedVariables<Node, Var> assignedVariables) {
+ target._preVisit(assignedVariables);
+ }
+
+ @override
+ Type _visit(
+ Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
+ target._visit(h, flow);
+ flow.propertyGet(this, target, propertyName);
+ return Type(type);
+ }
+}
+
class _Return extends Statement {
_Return() : super._();
@@ -1481,6 +1545,43 @@
}
}
+class _This extends Expression {
+ final Type type;
+
+ _This(this.type);
+
+ @override
+ String toString() => 'this';
+
+ @override
+ void _preVisit(AssignedVariables<Node, Var> assignedVariables) {}
+
+ @override
+ Type _visit(
+ Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
+ flow.thisOrSuper(this);
+ return type;
+ }
+}
+
+class _ThisOrSuperPropertyGet extends Expression {
+ final String propertyName;
+
+ final String type;
+
+ _ThisOrSuperPropertyGet(this.propertyName, this.type);
+
+ @override
+ void _preVisit(AssignedVariables<Node, Var> assignedVariables) {}
+
+ @override
+ Type _visit(
+ Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
+ flow.thisOrSuperPropertyGet(this, propertyName);
+ return Type(type);
+ }
+}
+
class _Throw extends Expression {
final Expression operand;
@@ -1622,6 +1723,37 @@
}
}
+class _WhyNotPromoted extends Expression {
+ final Expression target;
+
+ final void Function(Map<Type, NonPromotionReason>) callback;
+
+ _WhyNotPromoted(this.target, this.callback);
+
+ @override
+ String toString() => '$target (whyNotPromoted)';
+
+ @override
+ void _preVisit(AssignedVariables<Node, Var> assignedVariables) {
+ target._preVisit(assignedVariables);
+ }
+
+ @override
+ Type _visit(
+ Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
+ var type = target._visit(h, flow);
+ flow.forwardExpression(this, target);
+ assert(!Type._allowComparisons);
+ Type._allowComparisons = true;
+ try {
+ callback(flow.whyNotPromoted(this));
+ } finally {
+ Type._allowComparisons = false;
+ }
+ return type;
+ }
+}
+
class _WrappedExpression extends Expression {
final Statement? before;
final Expression expr;
@@ -1681,7 +1813,7 @@
Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
var rhs = this.rhs;
var type = rhs == null ? variable.type : rhs._visit(h, flow);
- flow.write(variable, type, rhs);
+ flow.write(this, variable, type, rhs);
return type;
}
}
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart b/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart
index 9621ff7..1657689 100644
--- a/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart
@@ -499,6 +499,94 @@
]);
});
+ test('equalityOp_end on property get preserves target variable', () {
+ // This is a regression test for a mistake made during the implementation
+ // of "why not promoted" functionality: when storing information about an
+ // attempt to promote a field (e.g. `x.y != null`) we need to make sure we
+ // don't wipe out information about the target variable (`x`).
+ var h = Harness();
+ var x = Var('x', 'C');
+ h.run([
+ declare(x, initialized: true),
+ checkAssigned(x, true),
+ if_(x.read.propertyGet('y').notEq(nullLiteral), [
+ checkAssigned(x, true),
+ ], [
+ checkAssigned(x, true),
+ ]),
+ ]);
+ });
+
+ test('equalityOp_end does not set reachability for `this`', () {
+ var h = Harness();
+ h.addSubtype('C', 'Object', true);
+ h.run([
+ if_(this_('C').is_('Null'), [
+ if_(this_('C').eq(nullLiteral), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]),
+ ]);
+ });
+
+ group('equalityOp_end does not set reachability for property gets', () {
+ test('on a variable', () {
+ var h = Harness();
+ var x = Var('x', 'C');
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.propertyGet('f').is_('Null'), [
+ if_(x.read.propertyGet('f').eq(nullLiteral), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]),
+ ]);
+ });
+
+ test('on an arbitrary expression', () {
+ var h = Harness();
+ h.run([
+ if_(expr('C').propertyGet('f').is_('Null'), [
+ if_(expr('C').propertyGet('f').eq(nullLiteral), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]),
+ ]);
+ });
+
+ test('on explicit this', () {
+ var h = Harness();
+ h.run([
+ if_(this_('C').propertyGet('f').is_('Null'), [
+ if_(this_('C').propertyGet('f').eq(nullLiteral), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]),
+ ]);
+ });
+
+ test('on implicit this/super', () {
+ var h = Harness();
+ h.run([
+ if_(thisOrSuperPropertyGet('f').is_('Null'), [
+ if_(thisOrSuperPropertyGet('f').eq(nullLiteral), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]),
+ ]);
+ });
+ });
+
test('finish checks proper nesting', () {
var h = Harness();
var e = expr('Null');
@@ -1372,6 +1460,65 @@
]);
});
+ test('isExpression_end() does not set reachability for `this`', () {
+ var h = Harness();
+ h.run([
+ if_(this_('C').is_('Never'), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]);
+ });
+
+ group('isExpression_end() does not set reachability for property gets', () {
+ test('on a variable', () {
+ var h = Harness();
+ var x = Var('x', 'C');
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.propertyGet('f').is_('Never'), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]);
+ });
+
+ test('on an arbitrary expression', () {
+ var h = Harness();
+ h.run([
+ if_(expr('C').propertyGet('f').is_('Never'), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]);
+ });
+
+ test('on explicit this', () {
+ var h = Harness();
+ h.run([
+ if_(this_('C').propertyGet('f').is_('Never'), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]);
+ });
+
+ test('on implicit this/super', () {
+ var h = Harness();
+ h.run([
+ if_(thisOrSuperPropertyGet('f').is_('Never'), [
+ checkReachable(true),
+ ], [
+ checkReachable(true),
+ ]),
+ ]);
+ });
+ });
+
test('labeledBlock without break', () {
var h = Harness();
var x = Var('x', 'int?');
@@ -3262,7 +3409,7 @@
// This should not happen in valid code, but test that we don't crash.
var h = Harness();
var s = FlowModel<Var, Type>(Reachability.initial).write(
- objectQVar, Type('Object?'), new SsaNode<Var, Type>(null), h);
+ null, objectQVar, Type('Object?'), new SsaNode<Var, Type>(null), h);
expect(s.variableInfo[objectQVar], isNull);
});
@@ -3271,7 +3418,7 @@
var s1 = FlowModel<Var, Type>(Reachability.initial)
.declare(objectQVar, true);
var s2 = s1.write(
- objectQVar, Type('Object?'), new SsaNode<Var, Type>(null), h);
+ null, objectQVar, Type('Object?'), new SsaNode<Var, Type>(null), h);
expect(s2, isNot(same(s1)));
expect(s2.reachable, same(s1.reachable));
expect(
@@ -3287,8 +3434,8 @@
var h = Harness();
var s1 = FlowModel<Var, Type>(Reachability.initial)
.declare(objectQVar, false);
- var s2 =
- s1.write(objectQVar, Type('int?'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(
+ null, objectQVar, Type('int?'), new SsaNode<Var, Type>(null), h);
expect(s2.reachable.overallReachable, true);
expect(
s2.infoFor(objectQVar),
@@ -3306,8 +3453,8 @@
.tryPromoteForTypeCheck(h, _varRef(objectQVar), Type('int'))
.ifTrue;
expect(s1.variableInfo, contains(objectQVar));
- var s2 =
- s1.write(objectQVar, Type('int?'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(_MockNonPromotionReason(), objectQVar, Type('int?'),
+ new SsaNode<Var, Type>(null), h);
expect(s2.reachable.overallReachable, true);
expect(s2.variableInfo, {
objectQVar: _matchVariableModel(
@@ -3333,8 +3480,8 @@
assigned: true,
unassigned: false)
});
- var s2 =
- s1.write(objectQVar, Type('num'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(_MockNonPromotionReason(), objectQVar, Type('num'),
+ new SsaNode<Var, Type>(null), h);
expect(s2.reachable.overallReachable, true);
expect(s2.variableInfo, {
objectQVar: _matchVariableModel(
@@ -3362,8 +3509,8 @@
assigned: true,
unassigned: false)
});
- var s2 =
- s1.write(objectQVar, Type('num'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(_MockNonPromotionReason(), objectQVar, Type('num'),
+ new SsaNode<Var, Type>(null), h);
expect(s2.reachable.overallReachable, true);
expect(s2.variableInfo, {
objectQVar: _matchVariableModel(
@@ -3389,8 +3536,8 @@
assigned: true,
unassigned: false)
});
- var s2 =
- s1.write(objectQVar, Type('num'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(
+ null, objectQVar, Type('num'), new SsaNode<Var, Type>(null), h);
expect(s2.reachable.overallReachable, true);
expect(s2.variableInfo, isNot(same(s1.variableInfo)));
expect(s2.variableInfo, {
@@ -3417,8 +3564,8 @@
assigned: true,
unassigned: false)
});
- var s2 =
- s1.write(objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(
+ null, objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
expect(s2.reachable.overallReachable, true);
expect(s2.variableInfo, isNot(same(s1.variableInfo)));
expect(s2.variableInfo, {
@@ -3440,7 +3587,8 @@
x: _matchVariableModel(chain: null),
});
- var s2 = s1.write(x, Type('int'), new SsaNode<Var, Type>(null), h);
+ var s2 =
+ s1.write(null, x, Type('int'), new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
x: _matchVariableModel(chain: ['int']),
});
@@ -3461,7 +3609,8 @@
});
// 'x' is write-captured, so not promoted
- var s3 = s2.write(x, Type('int'), new SsaNode<Var, Type>(null), h);
+ var s3 =
+ s2.write(null, x, Type('int'), new SsaNode<Var, Type>(null), h);
expect(s3.variableInfo, {
x: _matchVariableModel(chain: null, writeCaptured: true),
});
@@ -3480,7 +3629,7 @@
),
});
var s2 = s1.write(
- objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
+ null, objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
objectQVar: _matchVariableModel(
chain: ['int?', 'int'],
@@ -3502,7 +3651,7 @@
),
});
var s2 = s1.write(
- objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
+ null, objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
objectQVar: _matchVariableModel(
chain: ['Object', 'int'],
@@ -3524,8 +3673,8 @@
ofInterest: ['num?'],
),
});
- var s2 =
- s1.write(objectQVar, Type('num?'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(_MockNonPromotionReason(), objectQVar, Type('num?'),
+ new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
objectQVar: _matchVariableModel(
chain: ['num?'],
@@ -3548,8 +3697,8 @@
ofInterest: ['num?', 'int?'],
),
});
- var s2 =
- s1.write(objectQVar, Type('int?'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(_MockNonPromotionReason(), objectQVar, Type('int?'),
+ new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
objectQVar: _matchVariableModel(
chain: ['num?', 'int?'],
@@ -3618,7 +3767,8 @@
),
});
- var s2 = s1.write(x, Type('C'), new SsaNode<Var, Type>(null), h);
+ var s2 =
+ s1.write(null, x, Type('C'), new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
x: _matchVariableModel(
chain: ['Object', 'B'],
@@ -3643,7 +3793,8 @@
),
});
- var s2 = s1.write(x, Type('C'), new SsaNode<Var, Type>(null), h);
+ var s2 =
+ s1.write(null, x, Type('C'), new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
x: _matchVariableModel(
chain: ['Object', 'B'],
@@ -3668,7 +3819,8 @@
),
});
- var s2 = s1.write(x, Type('B'), new SsaNode<Var, Type>(null), h);
+ var s2 =
+ s1.write(null, x, Type('B'), new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
x: _matchVariableModel(
chain: ['Object', 'A'],
@@ -3694,7 +3846,7 @@
),
});
var s2 = s1.write(
- objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
+ null, objectQVar, Type('int'), new SsaNode<Var, Type>(null), h);
// It's ambiguous whether to promote to num? or num*, so we don't
// promote.
expect(s2, isNot(same(s1)));
@@ -3721,8 +3873,8 @@
ofInterest: ['num?', 'num*'],
),
});
- var s2 = s1.write(
- objectQVar, Type('num?'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(_MockNonPromotionReason(), objectQVar, Type('num?'),
+ new SsaNode<Var, Type>(null), h);
// It's ambiguous whether to promote to num? or num*, but since the
// written type is exactly num?, we use that.
expect(s2.variableInfo, {
@@ -3754,7 +3906,8 @@
),
});
- var s2 = s1.write(x, Type('double'), new SsaNode<Var, Type>(null), h);
+ var s2 = s1.write(_MockNonPromotionReason(), x, Type('double'),
+ new SsaNode<Var, Type>(null), h);
expect(s2.variableInfo, {
x: _matchVariableModel(
chain: ['num?', 'num'],
@@ -3908,11 +4061,11 @@
.declare(c, false)
.declare(d, false);
var s1 = s0
- .write(a, Type('int'), new SsaNode<Var, Type>(null), h)
- .write(b, Type('int'), new SsaNode<Var, Type>(null), h);
+ .write(null, a, Type('int'), new SsaNode<Var, Type>(null), h)
+ .write(null, b, Type('int'), new SsaNode<Var, Type>(null), h);
var s2 = s0
- .write(a, Type('int'), new SsaNode<Var, Type>(null), h)
- .write(c, Type('int'), new SsaNode<Var, Type>(null), h);
+ .write(null, a, Type('int'), new SsaNode<Var, Type>(null), h)
+ .write(null, c, Type('int'), new SsaNode<Var, Type>(null), h);
var result = s1.rebaseForward(h, s2);
expect(result.infoFor(a).assigned, true);
expect(result.infoFor(b).assigned, true);
@@ -3978,7 +4131,8 @@
var s0 = FlowModel<Var, Type>(Reachability.initial).declare(x, true);
var s1 = s0;
if (unsafe) {
- s1 = s1.write(x, Type('Object?'), new SsaNode<Var, Type>(null), h);
+ s1 = s1.write(
+ null, x, Type('Object?'), new SsaNode<Var, Type>(null), h);
}
if (thisType != null) {
s1 =
@@ -5363,6 +5517,173 @@
]);
});
});
+
+ group('why not promoted', () {
+ test('due to assignment', () {
+ var h = Harness();
+ var x = Var('x', 'int?');
+ late Expression writeExpression;
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.eq(nullLiteral), [
+ return_(),
+ ]),
+ checkPromoted(x, 'int'),
+ (writeExpression = x.write(expr('int?'))).stmt,
+ checkNotPromoted(x),
+ x.read.whyNotPromoted((reasons) {
+ expect(reasons.keys, unorderedEquals([Type('int')]));
+ var nonPromotionReason =
+ reasons.values.single as DemoteViaExplicitWrite<Var, Expression>;
+ expect(nonPromotionReason.writeExpression, same(writeExpression));
+ }).stmt,
+ ]);
+ });
+
+ test('due to assignment, multiple demotions', () {
+ var h = Harness();
+ var x = Var('x', 'Object?');
+ late Expression writeExpression;
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.isNot('int?'), [
+ return_(),
+ ]),
+ if_(x.read.eq(nullLiteral), [
+ return_(),
+ ]),
+ checkPromoted(x, 'int'),
+ (writeExpression = x.write(expr('Object?'))).stmt,
+ checkNotPromoted(x),
+ x.read.whyNotPromoted((reasons) {
+ expect(reasons.keys, unorderedEquals([Type('int'), Type('int?')]));
+ expect(
+ (reasons[Type('int')] as DemoteViaExplicitWrite<Var, Expression>)
+ .writeExpression,
+ same(writeExpression));
+ expect(
+ (reasons[Type('int?')] as DemoteViaExplicitWrite<Var, Expression>)
+ .writeExpression,
+ same(writeExpression));
+ }).stmt,
+ ]);
+ });
+
+ test('preserved in join when one branch unreachable', () {
+ var h = Harness();
+ var x = Var('x', 'int?');
+ late Expression writeExpression;
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.eq(nullLiteral), [
+ return_(),
+ ]),
+ checkPromoted(x, 'int'),
+ (writeExpression = x.write(expr('int?'))).stmt,
+ checkNotPromoted(x),
+ if_(expr('bool'), [
+ return_(),
+ ]),
+ x.read.whyNotPromoted((reasons) {
+ expect(reasons.keys, unorderedEquals([Type('int')]));
+ var nonPromotionReason =
+ reasons.values.single as DemoteViaExplicitWrite<Var, Expression>;
+ expect(nonPromotionReason.writeExpression, same(writeExpression));
+ }).stmt,
+ ]);
+ });
+
+ test('preserved in later promotions', () {
+ var h = Harness();
+ var x = Var('x', 'Object');
+ late Expression writeExpression;
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.is_('int', isInverted: true), [
+ return_(),
+ ]),
+ checkPromoted(x, 'int'),
+ (writeExpression = x.write(expr('Object'))).stmt,
+ checkNotPromoted(x),
+ if_(x.read.is_('num', isInverted: true), [
+ return_(),
+ ]),
+ checkPromoted(x, 'num'),
+ x.read.whyNotPromoted((reasons) {
+ var nonPromotionReason =
+ reasons[Type('int')] as DemoteViaExplicitWrite;
+ expect(nonPromotionReason.writeExpression, same(writeExpression));
+ }).stmt,
+ ]);
+ });
+
+ test('re-promotion', () {
+ var h = Harness();
+ var x = Var('x', 'int?');
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.eq(nullLiteral), [
+ return_(),
+ ]),
+ checkPromoted(x, 'int'),
+ x.write(expr('int?')).stmt,
+ checkNotPromoted(x),
+ if_(x.read.eq(nullLiteral), [
+ return_(),
+ ]),
+ checkPromoted(x, 'int'),
+ x.read.whyNotPromoted((reasons) {
+ expect(reasons, isEmpty);
+ }).stmt,
+ ]);
+ });
+
+ group('because field', () {
+ test('via explicit this', () {
+ var h = Harness();
+ h.run([
+ if_(this_('C').propertyGet('field').eq(nullLiteral), [
+ return_(),
+ ]),
+ this_('C').propertyGet('field').whyNotPromoted((reasons) {
+ expect(reasons.keys, unorderedEquals([Type('Object')]));
+ var nonPromotionReason = reasons.values.single;
+ expect(nonPromotionReason, TypeMatcher<FieldNotPromoted>());
+ }).stmt,
+ ]);
+ });
+
+ test('via implicit this/super', () {
+ var h = Harness();
+ h.run([
+ if_(thisOrSuperPropertyGet('field').eq(nullLiteral), [
+ return_(),
+ ]),
+ thisOrSuperPropertyGet('field').whyNotPromoted((reasons) {
+ expect(reasons.keys, unorderedEquals([Type('Object')]));
+ var nonPromotionReason = reasons.values.single;
+ expect(nonPromotionReason, TypeMatcher<FieldNotPromoted>());
+ }).stmt,
+ ]);
+ });
+
+ test('via variable', () {
+ var h = Harness();
+ var x = Var('x', 'C');
+ h.run([
+ declare(x, initialized: true),
+ if_(x.read.propertyGet('field').eq(nullLiteral), [
+ return_(),
+ ]),
+ x.read.propertyGet('field').whyNotPromoted((reasons) {
+ expect(reasons.keys, unorderedEquals([Type('Object')]));
+ var nonPromotionReason = reasons.values.single;
+ expect(nonPromotionReason, TypeMatcher<FieldNotPromoted>());
+ }).stmt,
+ ]);
+ });
+ });
+ });
}
/// Returns the appropriate matcher for expecting an assertion error to be
@@ -5434,3 +5755,12 @@
Reference<Var, Type> _varRef(Var variable) =>
new VariableReference<Var, Type>(variable);
+
+class _MockNonPromotionReason extends NonPromotionReason {
+ String get shortName => fail('Unexpected call to shortName');
+
+ R accept<R, Node extends Object, Expression extends Object,
+ Variable extends Object>(
+ NonPromotionReasonVisitor<R, Node, Expression, Variable> visitor) =>
+ fail('Unexpected call to accept');
+}
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/assignment.dart b/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/assignment.dart
new file mode 100644
index 0000000..f867664
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/assignment.dart
@@ -0,0 +1,71 @@
+// Copyright (c) 2020, 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.
+
+abstract class C {
+ C? operator +(int i);
+ int get cProperty => 0;
+}
+
+direct_assignment(int? i, int? j) {
+ if (i == null) return;
+ /*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ i = j;
+ i. /*notPromoted(explicitWrite)*/ isEven;
+}
+
+compound_assignment(C? c, int i) {
+ if (c == null) return;
+ /*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ c += i;
+ c. /*notPromoted(explicitWrite)*/ cProperty;
+}
+
+via_postfix_op(C? c) {
+ if (c == null) return;
+ /*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ c++;
+ c. /*notPromoted(explicitWrite)*/ cProperty;
+}
+
+via_prefix_op(C? c) {
+ if (c == null) return;
+ /*analyzer.explicitWrite*/ ++ /*cfe.update: explicitWrite*/ c;
+ c. /*notPromoted(explicitWrite)*/ cProperty;
+}
+
+via_for_each_statement(int? i, List<int?> list) {
+ if (i == null) return;
+ for (/*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ i in list) {
+ i. /*notPromoted(explicitWrite)*/ isEven;
+ }
+}
+
+via_for_each_list_element(int? i, List<int?> list) {
+ if (i == null) return;
+ [
+ for (/*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ i in list)
+ i. /*notPromoted(explicitWrite)*/ isEven
+ ];
+}
+
+via_for_each_set_element(int? i, List<int?> list) {
+ if (i == null) return;
+ ({
+ for (/*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ i in list)
+ i. /*notPromoted(explicitWrite)*/ isEven
+ });
+}
+
+via_for_each_map_key(int? i, List<int?> list) {
+ if (i == null) return;
+ ({
+ for (/*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ i in list)
+ i. /*notPromoted(explicitWrite)*/ isEven: null
+ });
+}
+
+via_for_each_map_value(int? i, List<int?> list) {
+ if (i == null) return;
+ ({
+ for (/*cfe.update: explicitWrite*/ /*analyzer.explicitWrite*/ i in list)
+ null: i. /*notPromoted(explicitWrite)*/ isEven
+ });
+}
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/field.dart b/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/field.dart
new file mode 100644
index 0000000..0bbec4e
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/field.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2020, 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.
+
+class C {
+ int? i;
+ int? j;
+
+ get_field_via_explicit_this() {
+ if (this.i == null) return;
+ this.i. /*notPromoted(fieldNotPromoted(i))*/ isEven;
+ }
+
+ get_field_via_explicit_this_parenthesized() {
+ if ((this).i == null) return;
+ (this).i. /*notPromoted(fieldNotPromoted(i))*/ isEven;
+ }
+
+ get_field_by_implicit_this() {
+ if (i == null) return;
+ i. /*notPromoted(fieldNotPromoted(i))*/ isEven;
+ }
+}
+
+class D extends C {
+ get_field_via_explicit_super() {
+ if (super.i == null) return;
+ super.i. /*notPromoted(fieldNotPromoted(i))*/ isEven;
+ }
+
+ get_field_by_implicit_super() {
+ if (i == null) return;
+ i. /*notPromoted(fieldNotPromoted(i))*/ isEven;
+ }
+}
+
+get_field_via_prefixed_identifier(C c) {
+ if (c.i == null) return;
+ c.i. /*notPromoted(fieldNotPromoted(i))*/ isEven;
+}
+
+get_field_via_prefixed_identifier_mismatched_target(C c1, C c2) {
+ if (c1.i == null) return;
+ c2.i.isEven;
+}
+
+get_field_via_prefixed_identifier_mismatched_property(C c) {
+ if (c.i == null) return;
+ c.j.isEven;
+}
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/marker.options b/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/marker.options
new file mode 100644
index 0000000..1ebb2bc
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/id_tests/why_not_promoted_test.dart
+analyzer=pkg/analyzer/test/id_tests/why_not_promoted_test.dart
\ No newline at end of file
diff --git a/pkg/_js_interop_checks/lib/js_interop_checks.dart b/pkg/_js_interop_checks/lib/js_interop_checks.dart
index b936c44..7639e85 100644
--- a/pkg/_js_interop_checks/lib/js_interop_checks.dart
+++ b/pkg/_js_interop_checks/lib/js_interop_checks.dart
@@ -12,6 +12,7 @@
messageJsInteropAnonymousFactoryPositionalParameters,
messageJsInteropEnclosingClassJSAnnotation,
messageJsInteropEnclosingClassJSAnnotationContext,
+ messageJsInteropExternalMemberNotJSAnnotated,
messageJsInteropIndexNotSupported,
messageJsInteropNamedParameters,
messageJsInteropNonExternalConstructor,
@@ -29,6 +30,37 @@
bool _classHasJSAnnotation = false;
bool _classHasAnonymousAnnotation = false;
bool _libraryHasJSAnnotation = false;
+
+ /// Libraries that use `external` to exclude from checks on external.
+ static final Iterable<String> _pathsWithAllowedDartExternalUsage = <String>[
+ '_foreign_helper', // for foreign helpers
+ '_interceptors', // for ddc JS string
+ '_native_typed_data',
+ '_runtime', // for ddc types at runtime
+ 'async',
+ 'core', // for environment constructors
+ 'html',
+ 'html_common',
+ 'indexed_db',
+ 'js',
+ 'js_util',
+ 'svg',
+ 'web_audio',
+ 'web_gl',
+ 'web_sql'
+ ];
+
+ /// Native tests to exclude from checks on external.
+ // TODO(rileyporter): Use ExternalName from CFE to exclude native tests.
+ List<Pattern> _allowedNativeTestPatterns = [
+ RegExp(r'(?<!generated_)tests/dart2js/native'),
+ RegExp(r'(?<!generated_)tests/dart2js/internal'),
+ 'generated_tests/dart2js/native/native_test',
+ RegExp(r'(?<!generated_)tests/dart2js_2/native'),
+ RegExp(r'(?<!generated_)tests/dart2js_2/internal'),
+ 'generated_tests/dart2js_2/native/native_test',
+ ];
+
bool _libraryIsGlobalNamespace = false;
// TODO(srujzs): This currently disables this check always. This check should
// instead only be disabled up until a given language version.
@@ -233,6 +265,30 @@
enclosingClass.name.length)
]);
}
+
+ // Check for correct `external` usage.
+ if (member.isExternal &&
+ !_isAllowedExternalUsage(member) &&
+ !hasJSInteropAnnotation(member)) {
+ if (member.enclosingClass != null && !_classHasJSAnnotation ||
+ member.enclosingClass == null && !_libraryHasJSAnnotation) {
+ _diagnosticsReporter.report(
+ messageJsInteropExternalMemberNotJSAnnotated,
+ member.fileOffset,
+ member.name.text.length,
+ member.location.file);
+ }
+ }
+ }
+
+ /// Verifies given member is one of the allowed usages of external:
+ /// a dart low level library, a foreign helper, a native test,
+ /// or a from environment constructor.
+ bool _isAllowedExternalUsage(Member member) {
+ Uri uri = member.enclosingLibrary.importUri;
+ return uri.scheme == 'dart' &&
+ _pathsWithAllowedDartExternalUsage.contains(uri.path) ||
+ _allowedNativeTestPatterns.any((pattern) => uri.path.contains(pattern));
}
/// Returns whether [member] is considered to be a JS interop member.
diff --git a/pkg/analysis_server/benchmark/benchmarks.dart b/pkg/analysis_server/benchmark/benchmarks.dart
index 20ad9aa..1dd12cb 100644
--- a/pkg/analysis_server/benchmark/benchmarks.dart
+++ b/pkg/analysis_server/benchmark/benchmarks.dart
@@ -17,8 +17,10 @@
Future main(List<String> args) async {
var benchmarks = <Benchmark>[
- ColdAnalysisBenchmark(),
- AnalysisBenchmark(),
+ ColdAnalysisBenchmark(ServerBenchmark.das),
+ ColdAnalysisBenchmark(ServerBenchmark.lsp),
+ AnalysisBenchmark(ServerBenchmark.das),
+ AnalysisBenchmark(ServerBenchmark.lsp),
FlutterAnalyzeBenchmark(),
];
diff --git a/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart b/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart
index 0d0893f..c9b438c 100644
--- a/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart
+++ b/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart
@@ -5,10 +5,8 @@
import 'dart:async';
import 'dart:io';
-import 'package:analysis_server/src/protocol_server.dart';
import 'package:path/path.dart' as path;
-import '../../test/integration/support/integration_tests.dart';
import '../benchmarks.dart';
import 'memory_tests.dart';
@@ -18,11 +16,13 @@
/// - analysis-server-edit
/// - analysis-server-completion
class AnalysisBenchmark extends Benchmark {
- AnalysisBenchmark()
- : super(
- 'analysis-server',
- 'Analysis server benchmarks of a large project, with an existing '
- 'driver cache.',
+ final AbstractBenchmarkTest Function() testConstructor;
+ AnalysisBenchmark(ServerBenchmark benchmarkTest)
+ : testConstructor = benchmarkTest.testConstructor,
+ super(
+ benchmarkTest.id,
+ '${benchmarkTest.name} benchmarks of a large project, with an existing '
+ 'driver cache.',
kind: 'group');
@override
@@ -32,13 +32,11 @@
}) async {
var stopwatch = Stopwatch()..start();
- var test = AnalysisServerMemoryUsageTest();
+ var test = testConstructor();
if (verbose) {
test.debugStdio();
}
- await test.setUp();
- await test.subscribeToStatusNotifications();
- await test.sendAnalysisSetAnalysisRoots(getProjectRoots(quick: quick), []);
+ await test.setUp(getProjectRoots(quick: quick));
await test.analysisFinished;
stopwatch.stop();
@@ -64,37 +62,20 @@
return result;
}
- Future<int> _calcCompletionTiming(
- AbstractAnalysisServerIntegrationTest test) async {
+ Future<int> _calcCompletionTiming(AbstractBenchmarkTest test) async {
const kGroupCount = 10;
var filePath =
path.join(analysisServerSrcPath, 'lib/src/analysis_server.dart');
var contents = File(filePath).readAsStringSync();
- await test
- .sendAnalysisUpdateContent({filePath: AddContentOverlay(contents)});
+ await test.openFile(filePath, contents);
var completionCount = 0;
var stopwatch = Stopwatch()..start();
Future _complete(int offset) async {
- // Create a new non-broadcast stream and subscribe to
- // test.onCompletionResults before sending a request.
- // Otherwise we could skip results which where posted to
- // test.onCompletionResults after request is sent but
- // before subscribing to test.onCompletionResults.
- final completionResults = StreamController<CompletionResultsParams>();
- completionResults.sink.addStream(test.onCompletionResults);
-
- var result = await test.sendCompletionGetSuggestions(filePath, offset);
-
- var future = completionResults.stream
- .where((CompletionResultsParams params) =>
- params.id == result.id && params.isLast)
- .first;
- await future;
-
+ await test.complete(filePath, offset);
completionCount++;
}
@@ -116,26 +97,25 @@
contents = contents.substring(0, index + 1) +
' ' +
contents.substring(index + 1);
- await test
- .sendAnalysisUpdateContent({filePath: AddContentOverlay(contents)});
+ await test.updateFile(filePath, contents);
}
}
stopwatch.stop();
+ await test.closeFile(filePath);
+
return stopwatch.elapsedMicroseconds ~/ completionCount;
}
- Future<int> _calcEditTiming(
- AbstractAnalysisServerIntegrationTest test) async {
+ Future<int> _calcEditTiming(AbstractBenchmarkTest test) async {
const kGroupCount = 5;
var filePath =
path.join(analysisServerSrcPath, 'lib/src/analysis_server.dart');
var contents = File(filePath).readAsStringSync();
- await test
- .sendAnalysisUpdateContent({filePath: AddContentOverlay(contents)});
+ await test.openFile(filePath, contents);
var stopwatch = Stopwatch()..start();
@@ -145,13 +125,14 @@
contents = contents.substring(0, index + 1) +
' ' +
contents.substring(index + 1);
- await test
- .sendAnalysisUpdateContent({filePath: AddContentOverlay(contents)});
+ await test.updateFile(filePath, contents);
await test.analysisFinished;
}
stopwatch.stop();
+ await test.closeFile(filePath);
+
return stopwatch.elapsedMicroseconds ~/ kGroupCount;
}
}
@@ -160,10 +141,12 @@
/// - analysis-server-cold-analysis
/// - analysis-server-cold-memory
class ColdAnalysisBenchmark extends Benchmark {
- ColdAnalysisBenchmark()
- : super(
- 'analysis-server-cold',
- 'Analysis server benchmarks of a large project on start-up, no '
+ final AbstractBenchmarkTest Function() testConstructor;
+ ColdAnalysisBenchmark(ServerBenchmark benchmarkTest)
+ : testConstructor = benchmarkTest.testConstructor,
+ super(
+ '${benchmarkTest.id}-cold',
+ '${benchmarkTest.name} benchmarks of a large project on start-up, no '
'existing driver cache.',
kind: 'group');
@@ -181,10 +164,8 @@
var stopwatch = Stopwatch()..start();
- var test = AnalysisServerMemoryUsageTest();
- await test.setUp();
- await test.subscribeToStatusNotifications();
- await test.sendAnalysisSetAnalysisRoots(getProjectRoots(quick: quick), []);
+ var test = testConstructor();
+ await test.setUp(getProjectRoots(quick: quick));
await test.analysisFinished;
stopwatch.stop();
@@ -200,3 +181,16 @@
return result;
}
}
+
+class ServerBenchmark {
+ static final das = ServerBenchmark('analysis-server', 'Analysis Server',
+ () => AnalysisServerBenchmarkTest());
+ static final lsp = ServerBenchmark('lsp-analysis-server',
+ 'LSP Analysis Server', () => LspAnalysisServerBenchmarkTest());
+ final String id;
+
+ final String name;
+ final AbstractBenchmarkTest Function() testConstructor;
+
+ ServerBenchmark(this.id, this.name, this.testConstructor);
+}
diff --git a/pkg/analysis_server/benchmark/perf/memory_tests.dart b/pkg/analysis_server/benchmark/perf/memory_tests.dart
index 5f242cd..651763f 100644
--- a/pkg/analysis_server/benchmark/perf/memory_tests.dart
+++ b/pkg/analysis_server/benchmark/perf/memory_tests.dart
@@ -6,38 +6,90 @@
import 'dart:convert' show jsonDecode, jsonEncode;
import 'dart:io';
+import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
+import 'package:analysis_server/src/lsp/handlers/handler_completion.dart';
+import 'package:analysis_server/src/protocol_server.dart';
import 'package:test/test.dart';
+import '../../test/integration/lsp_server/integration_tests.dart';
import '../../test/integration/support/integration_tests.dart';
+import '../../test/lsp/server_abstract.dart' show ClientCapabilitiesHelperMixin;
+
+/// A server protocol-agnostic interface to the memory test, allowing the same
+/// benchmarks to run for both the original protocol and LSP.
+abstract class AbstractBenchmarkTest {
+ Future<void> get analysisFinished;
+ Future<void> closeFile(String filePath);
+ Future<void> complete(String filePath, int offset);
+ void debugStdio();
+ Future<int> getMemoryUsage();
+ Future<void> openFile(String filePath, String contents);
+ Future<void> setUp(List<String> roots);
+ Future<void> shutdown();
+
+ Future<void> updateFile(String filePath, String contents);
+}
+
+/// An implementation of [AbstractBenchmarkTest] for a original protocol memory
+/// test.
+class AnalysisServerBenchmarkTest extends AbstractBenchmarkTest {
+ final _test = AnalysisServerMemoryUsageTest();
+
+ @override
+ Future<void> get analysisFinished => _test.analysisFinished;
+
+ @override
+ Future<void> closeFile(String filePath) =>
+ _test.sendAnalysisUpdateContent({filePath: RemoveContentOverlay()});
+
+ @override
+ Future<void> complete(String filePath, int offset) async {
+ // Create a new non-broadcast stream and subscribe to
+ // test.onCompletionResults before sending a request.
+ // Otherwise we could skip results which where posted to
+ // test.onCompletionResults after request is sent but
+ // before subscribing to test.onCompletionResults.
+ final completionResults = StreamController<CompletionResultsParams>();
+ completionResults.sink.addStream(_test.onCompletionResults);
+
+ var result = await _test.sendCompletionGetSuggestions(filePath, offset);
+
+ var future = completionResults.stream
+ .where((CompletionResultsParams params) =>
+ params.id == result.id && params.isLast)
+ .first;
+ await future;
+ }
+
+ @override
+ void debugStdio() => _test.debugStdio();
+
+ @override
+ Future<int> getMemoryUsage() => _test.getMemoryUsage();
+
+ @override
+ Future<void> openFile(String filePath, String contents) =>
+ _test.sendAnalysisUpdateContent({filePath: AddContentOverlay(contents)});
+
+ @override
+ Future<void> setUp(List<String> roots) async {
+ await _test.setUp();
+ await _test.subscribeToStatusNotifications();
+ await _test.sendAnalysisSetAnalysisRoots(roots, []);
+ }
+
+ @override
+ Future<void> shutdown() => _test.shutdown();
+
+ @override
+ Future<void> updateFile(String filePath, String contents) =>
+ _test.sendAnalysisUpdateContent({filePath: AddContentOverlay(contents)});
+}
/// Base class for analysis server memory usage tests.
class AnalysisServerMemoryUsageTest
- extends AbstractAnalysisServerIntegrationTest {
- int _vmServicePort;
-
- Future<int> getMemoryUsage() async {
- var uri = Uri.parse('ws://127.0.0.1:$_vmServicePort/ws');
- var service = await ServiceProtocol.connect(uri);
- var vm = await service.call('getVM');
-
- var total = 0;
-
- List isolateRefs = vm['isolates'];
- for (Map isolateRef in isolateRefs) {
- var isolate =
- await service.call('getIsolate', {'isolateId': isolateRef['id']});
-
- Map _heaps = isolate['_heaps'];
- total += _heaps['new']['used'] + _heaps['new']['external'];
- total += _heaps['old']['used'] + _heaps['old']['external'];
- }
-
- service.dispose();
-
- return total;
- }
-
+ extends AbstractAnalysisServerIntegrationTest with ServerMemoryUsageMixin {
/// Send the server an 'analysis.setAnalysisRoots' command directing it to
/// analyze [sourceDirectory].
Future setAnalysisRoot() =>
@@ -46,7 +98,7 @@
/// The server is automatically started before every test.
@override
Future setUp() async {
- _vmServicePort = await _findAvailableSocketPort();
+ _vmServicePort = await ServiceProtocol._findAvailableSocketPort();
onAnalysisErrors.listen((AnalysisErrorsParams params) {
currentAnalysisErrors[params.file] = params.errors;
@@ -77,14 +129,135 @@
Future subscribeToStatusNotifications() async {
await sendServerSetSubscriptions([ServerService.STATUS]);
}
+}
- static Future<int> _findAvailableSocketPort() async {
- var socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
- try {
- return socket.port;
- } finally {
- await socket.close();
+/// An implementation of [AbstractBenchmarkTest] for an LSP memory test.
+class LspAnalysisServerBenchmarkTest extends AbstractBenchmarkTest
+ with ClientCapabilitiesHelperMixin {
+ final _test = LspAnalysisServerMemoryUsageTest();
+
+ /// Track the file contents so we can easily convert offsets (used in
+ /// the interface) to Positions required by LSP without having to keep
+ /// passing in the contents.
+ final Map<String, String> _fileContents = {};
+ int _fileVersion = 1;
+
+ @override
+ Future<void> get analysisFinished => _test.waitForAnalysisComplete();
+
+ @override
+ Future<void> closeFile(String filePath) {
+ _fileContents.remove(filePath);
+ return _test.closeFile(Uri.file(filePath));
+ }
+
+ @override
+ Future<void> complete(String filePath, int offset) {
+ final contents = _fileContents[filePath];
+ final position = _test.positionFromOffset(offset, contents);
+ return _test.getCompletion(Uri.file(filePath), position);
+ }
+
+ @override
+ void debugStdio() {}
+
+ @override
+ Future<int> getMemoryUsage() => _test.getMemoryUsage();
+
+ @override
+ Future<void> openFile(String filePath, String contents) {
+ _fileContents[filePath] = contents;
+ return _test.openFile(Uri.file(filePath), contents);
+ }
+
+ @override
+ Future<void> setUp(List<String> roots) async {
+ await _test.setUp();
+ _test.projectFolderPath = roots.single;
+ _test.projectFolderUri = Uri.file(_test.projectFolderPath);
+ // Use some reasonable default client capabilities that will activate
+ // features that will excercise more code that benchmarks should measure
+ // (such as applyEdit to allow suggestion sets results to be merged in).
+ await _test.initialize(
+ textDocumentCapabilities: withCompletionItemSnippetSupport(
+ withCompletionItemKinds(
+ emptyTextDocumentClientCapabilities,
+ defaultSupportedCompletionKinds.toList(),
+ ),
+ ),
+ workspaceCapabilities: withDocumentChangesSupport(
+ withApplyEditSupport(emptyWorkspaceClientCapabilities),
+ ),
+ windowCapabilities:
+ withWorkDoneProgressSupport(emptyWindowClientCapabilities),
+ );
+ }
+
+ @override
+ Future<void> shutdown() async => _test.tearDown();
+
+ @override
+ Future<void> updateFile(String filePath, String contents) {
+ _fileContents[filePath] = contents;
+ return _test.replaceFile(_fileVersion++, Uri.file(filePath), contents);
+ }
+}
+
+/// Base class for LSP analysis server memory usage tests.
+class LspAnalysisServerMemoryUsageTest
+ extends AbstractLspAnalysisServerIntegrationTest
+ with ServerMemoryUsageMixin {
+ Map<String, List<Diagnostic>> currentAnalysisErrors = {};
+
+ @override
+ void expect(actual, matcher, {String reason}) =>
+ outOfTestExpect(actual, matcher, reason: reason);
+
+ /// The server is automatically started before every test.
+ @override
+ Future<void> setUp() async {
+ _vmServicePort = await ServiceProtocol._findAvailableSocketPort();
+ vmArgs.addAll([
+ '--enable-vm-service=$_vmServicePort',
+ '-DSILENT_OBSERVATORY=true',
+ '--disable-service-auth-codes',
+ '--disable-dart-dev'
+ ]);
+ await super.setUp();
+
+ errorNotificationsFromServer.listen((NotificationMessage error) {
+ // A server error should never happen during an integration test.
+ fail('${error.toJson()}');
+ });
+ }
+
+ /// After every test, the server is stopped.
+ Future shutdown() async => this.tearDown();
+}
+
+mixin ServerMemoryUsageMixin {
+ int _vmServicePort;
+
+ Future<int> getMemoryUsage() async {
+ var uri = Uri.parse('ws://127.0.0.1:$_vmServicePort/ws');
+ var service = await ServiceProtocol.connect(uri);
+ var vm = await service.call('getVM');
+
+ var total = 0;
+
+ List isolateRefs = vm['isolates'];
+ for (Map isolateRef in isolateRefs) {
+ var isolate =
+ await service.call('getIsolate', {'isolateId': isolateRef['id']});
+
+ Map _heaps = isolate['_heaps'];
+ total += _heaps['new']['used'] + _heaps['new']['external'];
+ total += _heaps['old']['used'] + _heaps['old']['external'];
}
+
+ service.dispose();
+
+ return total;
}
}
@@ -137,4 +310,13 @@
var socket = await WebSocket.connect(uri.toString());
return ServiceProtocol._(socket);
}
+
+ static Future<int> _findAvailableSocketPort() async {
+ var socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
+ try {
+ return socket.port;
+ } finally {
+ await socket.close();
+ }
+ }
}
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 95b2236..bb921ee 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -810,6 +810,7 @@
builder.performanceLog = analysisServer.analysisPerformanceLogger;
builder.byteStore = analysisServer.byteStore;
builder.enableIndex = true;
+ builder.lookForBazelBuildFileSubstitutes = false;
return builder;
}
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index 106cd91..1165746 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -867,6 +867,7 @@
builder.performanceLog = analysisServer.analysisPerformanceLogger;
builder.byteStore = analysisServer.byteStore;
builder.enableIndex = true;
+ builder.lookForBazelBuildFileSubstitutes = false;
return builder;
}
diff --git a/pkg/analysis_server/lib/src/lsp/mapping.dart b/pkg/analysis_server/lib/src/lsp/mapping.dart
index d2fad8a..02af79d 100644
--- a/pkg/analysis_server/lib/src/lsp/mapping.dart
+++ b/pkg/analysis_server/lib/src/lsp/mapping.dart
@@ -11,7 +11,6 @@
import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
import 'package:analysis_server/lsp_protocol/protocol_special.dart';
import 'package:analysis_server/lsp_protocol/protocol_special.dart' as lsp;
-import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/lsp/constants.dart' as lsp;
import 'package:analysis_server/src/lsp/constants.dart';
import 'package:analysis_server/src/lsp/dartdoc.dart';
@@ -212,7 +211,7 @@
HashSet<lsp.CompletionItemKind> supportedCompletionItemKinds,
String file,
int offset,
- IncludedSuggestionSet includedSuggestionSet,
+ server.IncludedSuggestionSet includedSuggestionSet,
Library library,
Map<String, int> tagBoosts,
server.LineInfo lineInfo,
@@ -667,7 +666,7 @@
server.LineInfo Function(String) getLineInfo,
plugin.AnalysisError error,
) {
- List<DiagnosticRelatedInformation> relatedInformation;
+ List<lsp.DiagnosticRelatedInformation> relatedInformation;
if (error.contextMessages != null && error.contextMessages.isNotEmpty) {
relatedInformation = error.contextMessages
.map((message) =>
@@ -792,18 +791,20 @@
range: toRange(lineInfo, label.offset, label.length),
label: label.label);
-CodeActionKind toCodeActionKind(String id, lsp.CodeActionKind fallback) {
+lsp.CodeActionKind toCodeActionKind(String id, lsp.CodeActionKind fallback) {
if (id == null) {
return fallback;
}
// Dart fixes and assists start with "dart.assist." and "dart.fix." but in LSP
// we want to use the predefined prefixes for CodeActions.
final newId = id
- .replaceAll('dart.assist', CodeActionKind.Refactor.toString())
- .replaceAll('dart.fix', CodeActionKind.QuickFix.toString())
- .replaceAll('analysisOptions.assist', CodeActionKind.Refactor.toString())
- .replaceAll('analysisOptions.fix', CodeActionKind.QuickFix.toString());
- return CodeActionKind(newId);
+ .replaceAll('dart.assist', lsp.CodeActionKind.Refactor.toString())
+ .replaceAll('dart.fix', lsp.CodeActionKind.QuickFix.toString())
+ .replaceAll(
+ 'analysisOptions.assist', lsp.CodeActionKind.Refactor.toString())
+ .replaceAll(
+ 'analysisOptions.fix', lsp.CodeActionKind.QuickFix.toString());
+ return lsp.CodeActionKind(newId);
}
lsp.CompletionItem toCompletionItem(
@@ -931,7 +932,7 @@
// Default to the error's severity if none is specified.
errorSeverity ??= errorCode.errorSeverity;
- List<DiagnosticRelatedInformation> relatedInformation;
+ List<lsp.DiagnosticRelatedInformation> relatedInformation;
if (error.contextMessages.isNotEmpty) {
relatedInformation = error.contextMessages
.map((message) => toDiagnosticRelatedInformation(result, message))
@@ -1232,7 +1233,7 @@
return lsp.TextDocumentEdit(
textDocument: edit.doc,
edits: edit.edits
- .map((e) => Either2<TextEdit, AnnotatedTextEdit>.t1(
+ .map((e) => Either2<lsp.TextEdit, lsp.AnnotatedTextEdit>.t1(
toTextEdit(edit.lineInfo, e)))
.toList(),
);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
index 6461fbf..f205135 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
@@ -80,6 +80,7 @@
double hasDeprecated = 0.0,
double inheritanceDistance = 0.0,
double isConstant = 0.0,
+ double isNoSuchMethod = 0.0,
double localVariableDistance = 0.0,
double startsWithDollar = 0.0,
double superMatches = 0.0}) {
@@ -97,6 +98,7 @@
hasDeprecated,
inheritanceDistance,
isConstant,
+ isNoSuchMethod,
localVariableDistance,
startsWithDollar,
superMatches,
@@ -106,6 +108,7 @@
0.50, // hasDeprecated
1.00, // inheritanceDistance
1.00, // isConstant
+ 1.00, // isNoSuchMethod
1.00, // localVariableDistance
0.50, // startsWithDollar
1.00, // superMatches
@@ -289,6 +292,17 @@
return 0.0;
}
+ /// Return the value of the _is noSuchMethod_ feature.
+ double isNoSuchMethodFeature(
+ String containingMethodName, String proposedMemberName) {
+ if (proposedMemberName == containingMethodName) {
+ // Don't penalize `noSuchMethod` when completing after `super` in an
+ // override of `noSuchMethod`.
+ return 0.0;
+ }
+ return proposedMemberName == 'noSuchMethod' ? -1.0 : 0.0;
+ }
+
/// Return the value of the _keyword_ feature for the [keyword] when
/// completing at the given [completionLocation].
double keywordFeature(String keyword, String completionLocation) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index edc41bb..47d35a8b 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -575,6 +575,8 @@
var isConstant = request.inConstantContext
? featureComputer.isConstantFeature(method)
: 0.0;
+ var isNoSuchMethod = featureComputer.isNoSuchMethodFeature(
+ _containingMemberName, method.name);
var startsWithDollar = featureComputer.startsWithDollarFeature(method.name);
var superMatches =
featureComputer.superMatchesFeature(_containingMemberName, method.name);
@@ -584,6 +586,7 @@
hasDeprecated: hasDeprecated,
inheritanceDistance: inheritanceDistance,
isConstant: isConstant,
+ isNoSuchMethod: isNoSuchMethod,
startsWithDollar: startsWithDollar,
superMatches: superMatches);
listener?.computedFeatures(
@@ -592,6 +595,7 @@
hasDeprecated: hasDeprecated,
inheritanceDistance: inheritanceDistance,
isConstant: isConstant,
+ isNoSuchMethod: isNoSuchMethod,
startsWithDollar: startsWithDollar,
superMatches: superMatches);
@@ -944,22 +948,14 @@
return elementKind;
}
- /// Compute a relevance value from the given feature scores:
- /// - [contextType] is higher if the type of the element matches the context
- /// type,
- /// - [hasDeprecated] is higher if the element is not deprecated,
- /// - [inheritanceDistance] is higher if the element is defined closer to the
- /// target type,
- /// - [startsWithDollar] is higher if the element's name doe _not_ start with
- /// a dollar sign, and
- /// - [superMatches] is higher if the element is being invoked through `super`
- /// and the element's name matches the name of the enclosing method.
+ /// Compute a relevance value from the given feature scores.
int _computeMemberRelevance(
{@required double contextType,
@required double elementKind,
@required double hasDeprecated,
@required double inheritanceDistance,
@required double isConstant,
+ double isNoSuchMethod = 0.0,
@required double startsWithDollar,
@required double superMatches}) {
var score = weightedAverage(
@@ -968,6 +964,7 @@
hasDeprecated: hasDeprecated,
inheritanceDistance: inheritanceDistance,
isConstant: isConstant,
+ isNoSuchMethod: isNoSuchMethod,
startsWithDollar: startsWithDollar,
superMatches: superMatches);
return toRelevance(score);
@@ -1145,6 +1142,7 @@
double hasDeprecated,
double inheritanceDistance,
double isConstant,
+ double isNoSuchMethod,
double keyword,
double localVariableDistance,
double startsWithDollar,
diff --git a/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart b/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart
index 5c93ac9..6f66ef2 100644
--- a/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart
+++ b/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart
@@ -61,7 +61,7 @@
/// can't be found.
Future<FormalParameterList> getParameterList() async {
var result = await sessionHelper.getElementDeclaration(executable);
- var targetDeclaration = result.node;
+ var targetDeclaration = result?.node;
if (targetDeclaration is ConstructorDeclaration) {
return targetDeclaration.parameters;
} else if (targetDeclaration is FunctionDeclaration) {
@@ -77,7 +77,7 @@
/// or `null` if it can't be found.
Future<FormalParameter> getParameterNode(ParameterElement element) async {
var result = await sessionHelper.getElementDeclaration(element);
- var declaration = result.node;
+ var declaration = result?.node;
for (var node = declaration; node != null; node = node.parent) {
if (node is FormalParameter && node.parent is FormalParameterList) {
return node;
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index f000bb7..d8ee8ac 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -6,7 +6,6 @@
import 'package:analysis_server/protocol/protocol_constants.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
-import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin;
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -235,8 +234,8 @@
var files = params.files;
expect(files, hasLength(1));
Object overlay = files[filePath];
- expect(overlay, const TypeMatcher<plugin.AddContentOverlay>());
- plugin.AddContentOverlay addOverlay = overlay;
+ expect(overlay, const TypeMatcher<AddContentOverlay>());
+ AddContentOverlay addOverlay = overlay;
expect(addOverlay.content, fileContent);
//
// Change
@@ -251,8 +250,8 @@
files = params.files;
expect(files, hasLength(1));
overlay = files[filePath];
- expect(overlay, const TypeMatcher<plugin.ChangeContentOverlay>());
- plugin.ChangeContentOverlay changeOverlay = overlay;
+ expect(overlay, const TypeMatcher<ChangeContentOverlay>());
+ ChangeContentOverlay changeOverlay = overlay;
expect(changeOverlay.edits, hasLength(2));
//
// Remove
@@ -265,7 +264,7 @@
files = params.files;
expect(files, hasLength(1));
overlay = files[filePath];
- expect(overlay, const TypeMatcher<plugin.RemoveContentOverlay>());
+ expect(overlay, const TypeMatcher<RemoveContentOverlay>());
}
// CompilationUnit _getTestUnit() {
diff --git a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart
index e69a2bc..c07285d 100644
--- a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart
@@ -8,12 +8,14 @@
import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
import 'package:analysis_server/src/lsp/channel/lsp_byte_stream_channel.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
+import 'package:meta/meta.dart';
import 'package:path/path.dart';
import '../../lsp/server_abstract.dart';
-class AbstractLspAnalysisServerIntegrationTest
+abstract class AbstractLspAnalysisServerIntegrationTest
with ClientCapabilitiesHelperMixin, LspAnalysisServerTestMixin {
+ final List<String> vmArgs = [];
LspServerClient client;
final Map<int, Completer<ResponseMessage>> _completers = {};
@@ -63,7 +65,8 @@
void sendResponseToServer(ResponseMessage response) =>
client.channel.sendResponse(response);
- Future setUp() async {
+ @mustCallSuper
+ Future<void> setUp() async {
// Set up temporary folder for the test.
projectFolderPath = Directory.systemTemp
.createTempSync('analysisServer')
@@ -77,7 +80,7 @@
analysisOptionsUri = Uri.file(analysisOptionsPath);
client = LspServerClient();
- await client.start();
+ await client.start(vmArgs: vmArgs);
client.serverToClient.listen((message) {
if (message is ResponseMessage) {
final id = message.id.map((number) => number,
@@ -128,7 +131,7 @@
return dirname(pathname);
}
- Future start() async {
+ Future start({List<String> vmArgs}) async {
if (_process != null) {
throw Exception('Process already started');
}
@@ -154,7 +157,7 @@
serverPath = normalize(join(rootDir, 'bin', 'server.dart'));
}
- final arguments = [serverPath, '--lsp', '--suppress-analytics'];
+ final arguments = [...?vmArgs, serverPath, '--lsp', '--suppress-analytics'];
_process = await Process.start(dartBinary, arguments);
_process.exitCode.then((int code) {
if (code != 0) {
diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart
index 74726a9..fead448 100644
--- a/pkg/analysis_server/test/lsp/server_abstract.dart
+++ b/pkg/analysis_server/test/lsp/server_abstract.dart
@@ -26,7 +26,8 @@
import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin;
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
-import 'package:test/test.dart';
+import 'package:test/test.dart' hide expect;
+import 'package:test/test.dart' as test show expect;
import '../mocks.dart';
import '../src/utilities/mock_packages.dart';
@@ -724,6 +725,9 @@
return expectSuccessfulResponseTo(request, (result) => result);
}
+ void expect(actual, matcher, {String reason}) =>
+ test.expect(actual, matcher, reason: reason);
+
void expectDocumentVersion(
TextDocumentEdit edit,
Map<String, int> expectedVersions,
diff --git a/pkg/analysis_server/test/src/cider/completion_test.dart b/pkg/analysis_server/test/src/cider/completion_test.dart
index 86bd6a5..e272ab9 100644
--- a/pkg/analysis_server/test/src/cider/completion_test.dart
+++ b/pkg/analysis_server/test/src/cider/completion_test.dart
@@ -488,7 +488,24 @@
_assertHasClass(text: 'A');
}
- Future<void> test_limitedResolution_inPart() async {
+ Future<void> test_limitedResolution_inPart_partOfName() async {
+ newFile('/workspace/dart/test/lib/a.dart', content: r'''
+library my_lib;
+part 'test.dart';
+class A {}
+''');
+
+ await _compute(r'''
+part of my_lib;
+^
+''');
+
+ _assertHasClass(text: 'int');
+ // TODO(scheglov) would be nice to have it
+ _assertNoClass(text: 'A');
+ }
+
+ Future<void> test_limitedResolution_inPart_partOfUri() async {
newFile('/workspace/dart/test/lib/a.dart', content: r'''
part 'test.dart';
class A {}
@@ -503,6 +520,17 @@
_assertHasClass(text: 'A');
}
+ Future<void> test_limitedResolution_inPart_partOfUri_doesNotExist() async {
+ await _compute(r'''
+part of 'a.dart';
+class A {}
+^
+''');
+
+ _assertHasClass(text: 'int');
+ _assertHasClass(text: 'A');
+ }
+
Future<void> test_limitedResolution_mixin_method_body() async {
_configureToCheckNotResolved(
identifiers: {'print'},
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
index 0f5c502..b073812 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
@@ -105,6 +105,17 @@
''');
}
+ Future<void> test_function_hasZero_partOfName_noLibrary() async {
+ await resolveTestCode('''
+part of my_lib;
+test() {}
+main() {
+ test(1);
+}
+''');
+ await assertNoFix();
+ }
+
Future<void> test_method_hasOne() async {
await resolveTestCode('''
class A {
diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics.dart b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
index 3cffbee..b9c2038 100644
--- a/pkg/analysis_server/tool/code_completion/completion_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
@@ -1121,6 +1121,7 @@
'hasDeprecated',
'inheritanceDistance',
'isConstant',
+ 'isNoSuchMethod',
'keyword',
'localVariableDistance',
'startsWithDollar',
@@ -1464,7 +1465,7 @@
@override
void builtSuggestion(protocol.CompletionSuggestion suggestion) {
featureMap[suggestion] = cachedFeatures;
- cachedFeatures = const [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
+ cachedFeatures = const [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
}
@override
@@ -1474,6 +1475,7 @@
double hasDeprecated = 0.0,
double inheritanceDistance = 0.0,
double isConstant = 0.0,
+ double isNoSuchMethod = 0.0,
double keyword = 0.0,
double localVariableDistance = 0.0,
double startsWithDollar = 0.0,
@@ -1484,6 +1486,7 @@
hasDeprecated,
inheritanceDistance,
isConstant,
+ isNoSuchMethod,
keyword,
localVariableDistance,
startsWithDollar,
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index ac3f422..51bfd9e 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -6,6 +6,7 @@
* Deprecated `CompilationUnitElement.functionTypeAliases`.
Use `CompilationUnitElement.typeAliases` instead.
* Added `AnalysisContext.sdkRoot`.
+* Removed `NullSafetyUnderstandingFlag`.
## 0.41.1
* Updated `PackageBuildWorkspace` that supports `package:build` to stop
diff --git a/pkg/analyzer/lib/dart/element/null_safety_understanding_flag.dart b/pkg/analyzer/lib/dart/element/null_safety_understanding_flag.dart
deleted file mode 100644
index 5406994..0000000
--- a/pkg/analyzer/lib/dart/element/null_safety_understanding_flag.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2020, 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.
-
-import 'dart:async';
-
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-
-/// Every [DartType] has the nullability suffix, elements declared in legacy
-/// libraries have types with star suffixes, and types in migrated libraries
-/// have none, question mark, or star suffixes. Analyzer itself can handle
-/// mixtures of nullabilities with legacy and migrated libraries.
-///
-/// However analyzer clients saw only star suffixes so far. Exposing other
-/// nullabilities is a breaking change, because types types with different
-/// nullabilities are not equal, `null` cannot be used where a non-nullable
-/// type is expected, etc. When accessing elements and types that come from
-/// migrated libraries, while analyzing a legacy library, nullabilities must
-/// be erased, using [LibraryElement.toLegacyElementIfOptOut] and
-/// [LibraryElement.toLegacyTypeIfOptOut]. The client must explicitly do
-/// this, and explicitly specify that it knows how to handle nullabilities
-/// by setting this flag to `true`.
-///
-/// When this flag is `false` (by default), all types will return their
-/// nullability as star. So, type equality and subtype checks will work
-/// as they worked before some libraries migrated. Note, that during
-/// analysis (building element models, and resolving ASTs), analyzer will use
-/// actual nullabilities, according to the language specification, so report
-/// all corresponding errors, and perform necessary type operations. It is
-/// only when the client later views on the types, they will look as legacy.
-class NullSafetyUnderstandingFlag {
- static final _zoneKey = Object();
-
- static bool get isEnabled {
- return Zone.current[_zoneKey] ?? false;
- }
-
- /// Code that understands nullability should be run using this method,
- /// otherwise all type operations will treat all nullabilities as star.
- static R enableNullSafetyTypes<R>(R Function() body) {
- return runZoned<R>(body, zoneValues: {_zoneKey: true});
- }
-}
diff --git a/pkg/analyzer/lib/error/listener.dart b/pkg/analyzer/lib/error/listener.dart
index 7de0ed7..e89e8b6 100644
--- a/pkg/analyzer/lib/error/listener.dart
+++ b/pkg/analyzer/lib/error/listener.dart
@@ -94,16 +94,18 @@
/// Report an error with the given [errorCode] and [arguments].
/// The [node] is used to compute the location of the error.
void reportErrorForNode(ErrorCode errorCode, AstNode node,
- [List<Object?>? arguments]) {
- reportErrorForOffset(errorCode, node.offset, node.length, arguments);
+ [List<Object?>? arguments, List<DiagnosticMessage>? messages]) {
+ reportErrorForOffset(
+ errorCode, node.offset, node.length, arguments, messages);
}
/// Report an error with the given [errorCode] and [arguments]. The location
/// of the error is specified by the given [offset] and [length].
void reportErrorForOffset(ErrorCode errorCode, int offset, int length,
- [List<Object?>? arguments]) {
+ [List<Object?>? arguments, List<DiagnosticMessage>? messages]) {
_convertElements(arguments);
- var messages = _convertTypeNames(arguments);
+ messages ??= [];
+ messages.addAll(_convertTypeNames(arguments));
_errorListener.onError(
AnalysisError(_source, offset, length, errorCode, arguments, messages));
}
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index 9280477..e8a31f4 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -97,6 +97,11 @@
/// indexing and search.
bool enableIndex = false;
+ /// Sometimes `BUILD` files are not preserved, and other files are created
+ /// instead. But looking for them is expensive, so we want to avoid this
+ /// in cases when `BUILD` files are always available.
+ bool lookForBazelBuildFileSubstitutes = true;
+
/// Initialize a newly created builder to be ready to build a context rooted in
/// the directory with the given [rootDirectoryPath].
ContextBuilder(this.resourceProvider, this.sdkManager, this.contentCache,
@@ -113,8 +118,9 @@
if (builderOptions.librarySummaryPaths != null) {
summaryData = SummaryDataStore(builderOptions.librarySummaryPaths!);
}
- Workspace workspace =
- ContextBuilder.createWorkspace(resourceProvider, path, this);
+ Workspace workspace = ContextBuilder.createWorkspace(
+ resourceProvider, path, this,
+ lookForBazelBuildFileSubstitutes: lookForBazelBuildFileSubstitutes);
final sf =
createSourceFactoryFromWorkspace(workspace, summaryData: summaryData);
@@ -397,7 +403,8 @@
}
static Workspace createWorkspace(ResourceProvider resourceProvider,
- String rootPath, ContextBuilder contextBuilder) {
+ String rootPath, ContextBuilder contextBuilder,
+ {bool lookForBazelBuildFileSubstitutes = true}) {
var packages = contextBuilder.createPackageMap(rootPath);
var packageMap = <String, List<Folder>>{};
for (var package in packages.packages) {
@@ -413,7 +420,8 @@
PubWorkspace.find(resourceProvider, packageMap, rootPath) ??
BasicWorkspace.find(resourceProvider, packageMap, rootPath);
}
- Workspace? workspace = BazelWorkspace.find(resourceProvider, rootPath);
+ Workspace? workspace = BazelWorkspace.find(resourceProvider, rootPath,
+ lookForBuildFileSubstitutes: lookForBazelBuildFileSubstitutes);
workspace ??= GnWorkspace.find(resourceProvider, rootPath);
workspace ??=
PackageBuildWorkspace.find(resourceProvider, packageMap, rootPath);
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 7c67e46..614d996 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -11,7 +11,6 @@
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart' show LibraryElement;
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/exception/exception.dart';
@@ -247,6 +246,8 @@
/// Whether resolved units should be indexed.
final bool enableIndex;
+ late final DriverAnalyzedFiles analyzedFiles = DriverAnalyzedFiles(this);
+
/// The current analysis session.
late AnalysisSessionImpl _currentSession;
@@ -445,6 +446,7 @@
if (!_fsState.hasUri(path)) {
return;
}
+ analyzedFiles.reset();
if (AnalysisEngine.isDartFileName(path)) {
_fileTracker.addFile(path);
// If the file is known, it has already been read, even if it did not
@@ -1198,6 +1200,7 @@
/// but does not guarantee this.
void removeFile(String path) {
_throwIfNotAbsolutePath(path);
+ analyzedFiles.reset();
_fileTracker.removeFile(path);
clearLibraryContext();
_priorityResults.clear();
@@ -1252,21 +1255,6 @@
{bool withUnit = false,
bool asIsIfPartWithoutLibrary = false,
bool skipIfSameSignature = false}) {
- return NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return _computeAnalysisResult2(
- path,
- withUnit: withUnit,
- asIsIfPartWithoutLibrary: asIsIfPartWithoutLibrary,
- skipIfSameSignature: skipIfSameSignature,
- );
- });
- }
-
- /// Unwrapped implementation of [_computeAnalysisResult].
- AnalysisResult? _computeAnalysisResult2(String path,
- {bool withUnit = false,
- bool asIsIfPartWithoutLibrary = false,
- bool skipIfSameSignature = false}) {
FileState file = _fsState.getFileForPath(path);
// Prepare the library - the file itself, or the known library.
@@ -1403,12 +1391,6 @@
/// Return the newly computed resolution result of the library with the
/// given [path].
ResolvedLibraryResultImpl _computeResolvedLibrary(String path) {
- return NullSafetyUnderstandingFlag.enableNullSafetyTypes(
- () => _computeResolvedLibrary2(path));
- }
-
- /// Unwrapped implementation of [_computeResolvedLibrary].
- ResolvedLibraryResultImpl _computeResolvedLibrary2(String path) {
FileState library = _fsState.getFileForPath(path);
return _logger.run('Compute resolved library $path', () {
@@ -1545,23 +1527,21 @@
}
}
- NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- if (_libraryContext == null) {
- _libraryContext = LibraryContext(
- testView: _testView.libraryContext,
- session: currentSession,
- logger: _logger,
- byteStore: _byteStore,
- analysisOptions: _analysisOptions,
- declaredVariables: declaredVariables,
- sourceFactory: _sourceFactory,
- externalSummaries: _externalSummaries,
- targetLibrary: library,
- );
- } else {
- _libraryContext!.load2(library);
- }
- });
+ if (_libraryContext == null) {
+ _libraryContext = LibraryContext(
+ testView: _testView.libraryContext,
+ session: currentSession,
+ logger: _logger,
+ byteStore: _byteStore,
+ analysisOptions: _analysisOptions,
+ declaredVariables: declaredVariables,
+ sourceFactory: _sourceFactory,
+ externalSummaries: _externalSummaries,
+ targetLibrary: library,
+ );
+ } else {
+ _libraryContext!.load2(library);
+ }
return _libraryContext!;
}
@@ -2103,6 +2083,29 @@
errors);
}
+/// The cache of files analyzed in the driver.
+class DriverAnalyzedFiles {
+ final AnalysisDriver _driver;
+ List<String>? _files;
+
+ DriverAnalyzedFiles(this._driver);
+
+ List<String> get files {
+ var files = _files;
+
+ if (files == null) {
+ var contextRoot = _driver.analysisContext!.contextRoot;
+ _files = files = contextRoot.analyzedFiles().toList();
+ }
+
+ return files;
+ }
+
+ void reset() {
+ _files = null;
+ }
+}
+
/// An object that watches for the creation and removal of analysis drivers.
///
/// Clients may not extend, implement or mix-in this class.
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 923e178..dc2c87a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -628,22 +628,9 @@
);
parser.enableOptionalNewAndConst = true;
- // TODO(scheglov) https://github.com/dart-lang/sdk/issues/41023
- CompilationUnit unit;
- try {
- unit = parser.parseCompilationUnit(token);
- unit.lineInfo = lineInfo;
- } catch (e) {
- throw StateError('''
-Parser error.
-path: $path
-${'-' * 40}
-$content
-''');
- }
-
- var unitImpl = unit as CompilationUnitImpl;
- unitImpl.languageVersion = LibraryLanguageVersion(
+ var unit = parser.parseCompilationUnit(token) as CompilationUnitImpl;
+ unit.lineInfo = lineInfo;
+ unit.languageVersion = LibraryLanguageVersion(
package: packageLanguageVersion!,
override: scanner.overrideVersion,
);
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 1f449ba..c3b00d8 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -6,7 +6,6 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/context/source.dart';
@@ -109,10 +108,6 @@
/// Compute analysis results for all units of the library.
Map<FileState, UnitAnalysisResult> analyzeSync() {
- // Analyzer understands null safety, so it should set
- // NullSafetyUnderstandingFlag.
- assert(NullSafetyUnderstandingFlag.isEnabled);
-
timerLibraryAnalyzer.start();
Map<FileState, CompilationUnit> units = {};
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index fa87c88..03439d6 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -503,8 +503,7 @@
}
void ownAnalyzed(Search search) {
- var contextRoot = search._driver.analysisContext!.contextRoot;
- for (var path in contextRoot.analyzedFiles()) {
+ for (var path in search._driver.analyzedFiles.files) {
if (path.endsWith('.dart')) {
add(path, search);
}
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 2758b97..24c111f 100644
--- a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
@@ -891,6 +891,7 @@
safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
sink.write("part of ");
safelyVisitNode(node.libraryName);
+ safelyVisitNode(node.uri);
sink.write(';');
}
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 4f7bd29..73b1748 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -815,7 +815,7 @@
return true;
}
var objType = obj.type;
- return library.typeSystem.isSubtypeOf2(objType, type);
+ return library.typeSystem.isSubtypeOf(objType, type);
}
DartObjectImpl _nullObject(LibraryElementImpl library) {
@@ -1538,7 +1538,7 @@
// TODO(brianwilkerson) Figure out why the static type is sometimes null.
var staticType = condition.staticType;
if (staticType == null ||
- typeSystem.isAssignableTo2(staticType, _typeProvider.boolType)) {
+ typeSystem.isAssignableTo(staticType, _typeProvider.boolType)) {
// If the static type is not assignable, then we will have already
// reported this error.
// TODO(mfairhurst) get the FeatureSet to suppress this for nnbd too.
diff --git a/pkg/analyzer/lib/src/dart/constant/value.dart b/pkg/analyzer/lib/src/dart/constant/value.dart
index 19cc0a5..0730163 100644
--- a/pkg/analyzer/lib/src/dart/constant/value.dart
+++ b/pkg/analyzer/lib/src/dart/constant/value.dart
@@ -277,7 +277,7 @@
return this;
}
- if (!typeSystem.isSubtypeOf2(type, resultType)) {
+ if (!typeSystem.isSubtypeOf(type, resultType)) {
throw EvaluationException(
CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION);
}
@@ -495,7 +495,7 @@
} else if (typeType == null) {
state = BoolState.TRUE_STATE;
} else {
- state = BoolState.from(typeSystem.isSubtypeOf2(type, typeType));
+ state = BoolState.from(typeSystem.isSubtypeOf(type, typeType));
}
return DartObjectImpl(typeSystem, typeSystem.typeProvider.boolType, state);
}
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 17860e4..e3d4d8d4 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2323,142 +2323,90 @@
AnalysisContext get context => compilationUnit.library.context;
@override
- bool get isAlwaysThrows =>
- element is PropertyAccessorElement &&
- element!.name == _ALWAYS_THROWS_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isAlwaysThrows => _isPackageMetaGetter(_ALWAYS_THROWS_VARIABLE_NAME);
@override
bool get isConstantEvaluated => evaluationResult != null;
@override
bool get isDeprecated {
- if (element?.library!.isDartCore == true) {
- if (element is ConstructorElement) {
- return element!.enclosingElement!.name == _DEPRECATED_CLASS_NAME;
- } else if (element is PropertyAccessorElement) {
- return element!.name == _DEPRECATED_VARIABLE_NAME;
- }
+ var element = this.element;
+ if (element is ConstructorElement) {
+ return element.library.isDartCore &&
+ element.enclosingElement.name == _DEPRECATED_CLASS_NAME;
+ } else if (element is PropertyAccessorElement) {
+ return element.library.isDartCore &&
+ element.name == _DEPRECATED_VARIABLE_NAME;
}
return false;
}
@override
- bool get isDoNotStore =>
- element is PropertyAccessorElement &&
- element!.name == _DO_NOT_STORE_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isDoNotStore => _isPackageMetaGetter(_DO_NOT_STORE_VARIABLE_NAME);
@override
- bool get isFactory =>
- element is PropertyAccessorElement &&
- element!.name == _FACTORY_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isFactory => _isPackageMetaGetter(_FACTORY_VARIABLE_NAME);
@override
- bool get isImmutable =>
- element is PropertyAccessorElement &&
- element!.name == _IMMUTABLE_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isImmutable => _isPackageMetaGetter(_IMMUTABLE_VARIABLE_NAME);
@override
- bool get isInternal =>
- element is PropertyAccessorElement &&
- element!.name == _INTERNAL_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isInternal => _isPackageMetaGetter(_INTERNAL_VARIABLE_NAME);
@override
- bool get isIsTest =>
- element is PropertyAccessorElement &&
- element!.name == _IS_TEST_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isIsTest => _isPackageMetaGetter(_IS_TEST_VARIABLE_NAME);
@override
- bool get isIsTestGroup =>
- element is PropertyAccessorElement &&
- element!.name == _IS_TEST_GROUP_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isIsTestGroup => _isPackageMetaGetter(_IS_TEST_GROUP_VARIABLE_NAME);
@override
bool get isJS =>
- element is ConstructorElement &&
- element!.enclosingElement!.name == _JS_CLASS_NAME &&
- element!.library!.name == _JS_LIB_NAME;
+ _isConstructor(libraryName: _JS_LIB_NAME, className: _JS_CLASS_NAME);
@override
- bool get isLiteral =>
- element is PropertyAccessorElement &&
- element!.name == _LITERAL_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isLiteral => _isPackageMetaGetter(_LITERAL_VARIABLE_NAME);
@override
bool get isMustCallSuper =>
- element is PropertyAccessorElement &&
- element!.name == _MUST_CALL_SUPER_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ _isPackageMetaGetter(_MUST_CALL_SUPER_VARIABLE_NAME);
@override
- bool get isNonVirtual =>
- element is PropertyAccessorElement &&
- element!.name == _NON_VIRTUAL_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isNonVirtual => _isPackageMetaGetter(_NON_VIRTUAL_VARIABLE_NAME);
@override
bool get isOptionalTypeArgs =>
- element is PropertyAccessorElement &&
- element!.name == _OPTIONAL_TYPE_ARGS_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ _isPackageMetaGetter(_OPTIONAL_TYPE_ARGS_VARIABLE_NAME);
@override
- bool get isOverride =>
- element is PropertyAccessorElement &&
- element!.name == _OVERRIDE_VARIABLE_NAME &&
- element!.library!.isDartCore == true;
+ bool get isOverride => _isDartCoreGetter(_OVERRIDE_VARIABLE_NAME);
@override
- bool get isProtected =>
- element is PropertyAccessorElement &&
- element!.name == _PROTECTED_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isProtected => _isPackageMetaGetter(_PROTECTED_VARIABLE_NAME);
@override
- bool get isProxy =>
- element is PropertyAccessorElement &&
- element!.name == PROXY_VARIABLE_NAME &&
- element!.library!.isDartCore == true;
+ bool get isProxy => _isDartCoreGetter(PROXY_VARIABLE_NAME);
@override
bool get isRequired =>
- element is ConstructorElement &&
- element!.enclosingElement!.name == _REQUIRED_CLASS_NAME &&
- element!.library!.name == _META_LIB_NAME ||
- element is PropertyAccessorElement &&
- element!.name == _REQUIRED_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ _isConstructor(
+ libraryName: _META_LIB_NAME, className: _REQUIRED_CLASS_NAME) ||
+ _isPackageMetaGetter(_REQUIRED_VARIABLE_NAME);
@override
- bool get isSealed =>
- element is PropertyAccessorElement &&
- element!.name == _SEALED_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ bool get isSealed => _isPackageMetaGetter(_SEALED_VARIABLE_NAME);
@override
- bool get isTarget =>
- element is ConstructorElement &&
- element!.enclosingElement!.name == _TARGET_CLASS_NAME &&
- element!.library!.name == _META_META_LIB_NAME;
+ bool get isTarget => _isConstructor(
+ libraryName: _META_META_LIB_NAME, className: _TARGET_CLASS_NAME);
@override
- bool get isVisibleForTemplate =>
- element is PropertyAccessorElement &&
- element!.name == _VISIBLE_FOR_TEMPLATE_VARIABLE_NAME &&
- element!.library!.name == _NG_META_LIB_NAME;
+ bool get isVisibleForTemplate => _isTopGetter(
+ libraryName: _NG_META_LIB_NAME,
+ name: _VISIBLE_FOR_TEMPLATE_VARIABLE_NAME);
@override
bool get isVisibleForTesting =>
- element is PropertyAccessorElement &&
- element!.name == _VISIBLE_FOR_TESTING_VARIABLE_NAME &&
- element!.library!.name == _META_LIB_NAME;
+ _isPackageMetaGetter(_VISIBLE_FOR_TESTING_VARIABLE_NAME);
@override
LibraryElement get library => compilationUnit.library;
@@ -2486,6 +2434,40 @@
@override
String toString() => '@$element';
+
+ bool _isConstructor({
+ required String libraryName,
+ required String className,
+ }) {
+ var element = this.element;
+ return element is ConstructorElement &&
+ element.enclosingElement.name == className &&
+ element.library.name == libraryName;
+ }
+
+ bool _isDartCoreGetter(String name) {
+ return _isTopGetter(
+ libraryName: 'dart.core',
+ name: name,
+ );
+ }
+
+ bool _isPackageMetaGetter(String name) {
+ return _isTopGetter(
+ libraryName: _META_LIB_NAME,
+ name: name,
+ );
+ }
+
+ bool _isTopGetter({
+ required String libraryName,
+ required String name,
+ }) {
+ var element = this.element;
+ return element is PropertyAccessorElement &&
+ element.name == name &&
+ element.library.name == libraryName;
+ }
}
/// A base class for concrete implementations of an [Element].
@@ -2907,7 +2889,7 @@
@override
AnalysisSession get session {
- return _enclosingElement!.session;
+ return enclosingElement!.session;
}
@override
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index 56c791f..d7da75d 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -552,8 +552,7 @@
bool get isDownwards => origin is! _TypeConstraintFromArgument;
bool isSatisfiedBy(TypeSystemImpl ts, DartType type) {
- return ts.isSubtypeOf2(lowerBound, type) &&
- ts.isSubtypeOf2(type, upperBound);
+ return ts.isSubtypeOf(lowerBound, type) && ts.isSubtypeOf(type, upperBound);
}
/// Converts this constraint to a message suitable for a type inference error.
diff --git a/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart b/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart
index 1e9aebf..86df48a 100644
--- a/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart
+++ b/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart
@@ -111,7 +111,7 @@
if (T1_nullability == NullabilitySuffix.none && T1.isDartCoreNull) {
// * Null if Null <: T2
// * Never otherwise
- if (_typeSystem.isSubtypeOf2(_nullNone, T2)) {
+ if (_typeSystem.isSubtypeOf(_nullNone, T2)) {
return _nullNone;
} else {
return NeverTypeImpl.instance;
@@ -122,7 +122,7 @@
if (T2_nullability == NullabilitySuffix.none && T2.isDartCoreNull) {
// * Null if Null <: T1
// * Never otherwise
- if (_typeSystem.isSubtypeOf2(_nullNone, T1)) {
+ if (_typeSystem.isSubtypeOf(_nullNone, T1)) {
return _nullNone;
} else {
return NeverTypeImpl.instance;
@@ -209,12 +209,12 @@
}
// DOWN(T1, T2) = T1 if T1 <: T2
- if (_typeSystem.isSubtypeOf2(T1, T2)) {
+ if (_typeSystem.isSubtypeOf(T1, T2)) {
return T1;
}
// DOWN(T1, T2) = T2 if T2 <: T1
- if (_typeSystem.isSubtypeOf2(T2, T1)) {
+ if (_typeSystem.isSubtypeOf(T2, T1)) {
return T2;
}
diff --git a/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart b/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart
index 325bdc0..764d9ef 100644
--- a/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart
+++ b/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart
@@ -183,10 +183,10 @@
type1 = type1.withNullability(NullabilitySuffix.none);
type2 = type2.withNullability(NullabilitySuffix.none);
- if (typeSystem.isSubtypeOf2(type1, type2)) {
+ if (typeSystem.isSubtypeOf(type1, type2)) {
return type2.withNullability(nullability);
}
- if (typeSystem.isSubtypeOf2(type2, type1)) {
+ if (typeSystem.isSubtypeOf(type2, type1)) {
return type1.withNullability(nullability);
}
@@ -212,8 +212,8 @@
args.add(typeSystem.getLeastUpperBound(args1[i], args2[i]));
}
} else if (parameterVariance.isInvariant) {
- if (!typeSystem.isSubtypeOf2(args1[i], args2[i]) ||
- !typeSystem.isSubtypeOf2(args2[i], args1[i])) {
+ if (!typeSystem.isSubtypeOf(args1[i], args2[i]) ||
+ !typeSystem.isSubtypeOf(args2[i], args1[i])) {
// No bound will be valid, find bound at the interface level.
return _computeLeastUpperBound(
InstantiatedClass.of(type1),
@@ -637,11 +637,11 @@
// UP(X1 & B1, T2)
if (T1 is TypeParameterTypeImpl) {
// T2 if X1 <: T2
- if (_typeSystem.isSubtypeOf2(T1, T2)) {
+ if (_typeSystem.isSubtypeOf(T1, T2)) {
return T2;
}
// otherwise X1 if T2 <: X1
- if (_typeSystem.isSubtypeOf2(T2, T1)) {
+ if (_typeSystem.isSubtypeOf(T2, T1)) {
return T1;
}
// otherwise UP(B1a, T2)
@@ -655,12 +655,12 @@
// UP(T1, X2 & B2)
if (T2 is TypeParameterTypeImpl) {
// X2 if T1 <: X2
- if (_typeSystem.isSubtypeOf2(T1, T2)) {
+ if (_typeSystem.isSubtypeOf(T1, T2)) {
// TODO(scheglov) How to get here?
return T2;
}
// otherwise T1 if X2 <: T1
- if (_typeSystem.isSubtypeOf2(T2, T1)) {
+ if (_typeSystem.isSubtypeOf(T2, T1)) {
return T1;
}
// otherwise UP(T1, B2a)
diff --git a/pkg/analyzer/lib/src/dart/element/replace_top_bottom_visitor.dart b/pkg/analyzer/lib/src/dart/element/replace_top_bottom_visitor.dart
index 1d9c2ca..5709733 100644
--- a/pkg/analyzer/lib/src/dart/element/replace_top_bottom_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/element/replace_top_bottom_visitor.dart
@@ -27,7 +27,7 @@
if (variance.isContravariant) {
// ...replacing every occurrence in `T` of a type `S` in a contravariant
// position where `S <: Never` by `Object?`
- if (_typeSystem.isSubtypeOf2(type, NeverTypeImpl.instance)) {
+ if (_typeSystem.isSubtypeOf(type, NeverTypeImpl.instance)) {
return _topType;
}
} else {
diff --git a/pkg/analyzer/lib/src/dart/element/top_merge.dart b/pkg/analyzer/lib/src/dart/element/top_merge.dart
index c79f91b..b60f3b1 100644
--- a/pkg/analyzer/lib/src/dart/element/top_merge.dart
+++ b/pkg/analyzer/lib/src/dart/element/top_merge.dart
@@ -236,8 +236,8 @@
if (R_isCovariant) {
var T1 = T_parameter.type;
var T2 = S_parameter.type;
- var T1_isSubtype = typeSystem.isSubtypeOf2(T1, T2);
- var T2_isSubtype = typeSystem.isSubtypeOf2(T2, T1);
+ var T1_isSubtype = typeSystem.isSubtypeOf(T1, T2);
+ var T2_isSubtype = typeSystem.isSubtypeOf(T2, T1);
if (T1_isSubtype && T2_isSubtype) {
// if `T1 <: T2` and `T2 <: T1`, then the result is
// `NNBD_TOP_MERGE(T1, T2)`, and it is covariant.
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 8cf0fb0..c092d6e 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -6,7 +6,6 @@
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_visitor.dart';
@@ -222,10 +221,8 @@
}
if (other is FunctionTypeImpl) {
- if (NullSafetyUnderstandingFlag.isEnabled) {
- if (other.nullabilitySuffix != nullabilitySuffix) {
- return false;
- }
+ if (other.nullabilitySuffix != nullabilitySuffix) {
+ return false;
}
if (other.typeFormals.length != typeFormals.length) {
@@ -841,10 +838,8 @@
return true;
}
if (other is InterfaceTypeImpl) {
- if (NullSafetyUnderstandingFlag.isEnabled) {
- if (other.nullabilitySuffix != nullabilitySuffix) {
- return false;
- }
+ if (other.nullabilitySuffix != nullabilitySuffix) {
+ return false;
}
return other.element == element &&
TypeImpl.equalArrays(other.typeArguments, typeArguments);
@@ -1386,7 +1381,7 @@
for (DartType type in types) {
// If any existing type in the bucket is more specific than this type,
// then we can ignore this type.
- if (bucket.any((DartType t) => typeSystem.isSubtypeOf2(t, type))) {
+ if (bucket.any((DartType t) => typeSystem.isSubtypeOf(t, type))) {
continue;
}
// Otherwise, we need to add this type to the bucket and remove any types
@@ -1394,7 +1389,7 @@
bool added = false;
int i = 0;
while (i < bucket.length) {
- if (typeSystem.isSubtypeOf2(type, bucket[i])) {
+ if (typeSystem.isSubtypeOf(type, bucket[i])) {
if (added) {
if (i < bucket.length - 1) {
bucket[i] = bucket.removeLast();
@@ -1852,10 +1847,8 @@
}
if (other is TypeParameterTypeImpl && other.element == element) {
- if (NullSafetyUnderstandingFlag.isEnabled) {
- if (other.nullabilitySuffix != nullabilitySuffix) {
- return false;
- }
+ if (other.nullabilitySuffix != nullabilitySuffix) {
+ return false;
}
return other.promotedBound == promotedBound;
}
diff --git a/pkg/analyzer/lib/src/dart/element/type_system.dart b/pkg/analyzer/lib/src/dart/element/type_system.dart
index 51ceee2..beb67a5 100644
--- a/pkg/analyzer/lib/src/dart/element/type_system.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_system.dart
@@ -7,7 +7,6 @@
import 'package:analyzer/dart/ast/ast.dart' show AstNode;
import 'package:analyzer/dart/ast/token.dart' show TokenType;
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_provider.dart';
@@ -169,7 +168,7 @@
/// promotion during flow analysis.
DartType factor(DartType T, DartType S) {
// * If T <: S then Never
- if (isSubtypeOf2(T, S)) {
+ if (isSubtypeOf(T, S)) {
return NeverTypeImpl.instance;
}
@@ -180,7 +179,7 @@
if (T_nullability == NullabilitySuffix.question) {
var R = (T as TypeImpl).withNullability(NullabilitySuffix.none);
var factor_RS = factor(R, S) as TypeImpl;
- if (isSubtypeOf2(nullNone, S)) {
+ if (isSubtypeOf(nullNone, S)) {
return factor_RS;
} else {
return factor_RS.withNullability(NullabilitySuffix.question);
@@ -192,7 +191,7 @@
if (T_nullability == NullabilitySuffix.star) {
var R = (T as TypeImpl).withNullability(NullabilitySuffix.none);
var factor_RS = factor(R, S) as TypeImpl;
- if (isSubtypeOf2(nullNone, S)) {
+ if (isSubtypeOf(nullNone, S)) {
return factor_RS;
} else {
return factor_RS.withNullability(NullabilitySuffix.star);
@@ -204,10 +203,10 @@
if (T is InterfaceType && T.isDartAsyncFutureOr) {
var R = T.typeArguments[0];
var future_R = typeProvider.futureType2(R);
- if (isSubtypeOf2(future_R, S)) {
+ if (isSubtypeOf(future_R, S)) {
return factor(R, S);
}
- if (isSubtypeOf2(R, S)) {
+ if (isSubtypeOf(R, S)) {
return factor(future_R, S);
}
}
@@ -688,16 +687,8 @@
@override
bool isAssignableTo(DartType fromType, DartType toType) {
- if (!NullSafetyUnderstandingFlag.isEnabled) {
- fromType = NullabilityEliminator.perform(typeProvider, fromType);
- toType = NullabilityEliminator.perform(typeProvider, toType);
- }
- return isAssignableTo2(fromType, toType);
- }
-
- bool isAssignableTo2(DartType fromType, DartType toType) {
// An actual subtype
- if (isSubtypeOf2(fromType, toType)) {
+ if (isSubtypeOf(fromType, toType)) {
return true;
}
@@ -706,7 +697,7 @@
!isNullable(fromType) &&
acceptsFunctionType(toType)) {
var callMethodType = getCallMethodType(fromType);
- if (callMethodType != null && isAssignableTo2(callMethodType, toType)) {
+ if (callMethodType != null && isAssignableTo(callMethodType, toType)) {
return true;
}
}
@@ -741,7 +732,7 @@
}
// If the subtype relation goes the other way, allow the implicit downcast.
- if (isSubtypeOf2(toType, fromType)) {
+ if (isSubtypeOf(toType, fromType)) {
// TODO(leafp,jmesserly): we emit warnings/hints for these in
// src/task/strong/checker.dart, which is a bit inconsistent. That
// code should be handled into places that use isAssignableTo, such as
@@ -945,7 +936,7 @@
/// In strong mode, this is equivalent to [isSubtypeOf].
@Deprecated('Use isSubtypeOf() instead.')
bool isMoreSpecificThan(DartType leftType, DartType rightType) {
- return isSubtypeOf2(leftType, rightType);
+ return isSubtypeOf(leftType, rightType);
}
/// Defines a total order on top and Object types.
@@ -1141,14 +1132,6 @@
/// See `resources/type-system/subtyping.md`
@override
bool isSubtypeOf(DartType leftType, DartType rightType) {
- if (!NullSafetyUnderstandingFlag.isEnabled) {
- leftType = NullabilityEliminator.perform(typeProvider, leftType);
- rightType = NullabilityEliminator.perform(typeProvider, rightType);
- }
- return isSubtypeOf2(leftType, rightType);
- }
-
- bool isSubtypeOf2(DartType leftType, DartType rightType) {
return _subtypeHelper.isSubtypeOf(leftType, rightType);
}
@@ -1254,10 +1237,6 @@
@override
DartType leastUpperBound(DartType leftType, DartType rightType) {
- if (!NullSafetyUnderstandingFlag.isEnabled) {
- leftType = NullabilityEliminator.perform(typeProvider, leftType);
- rightType = NullabilityEliminator.perform(typeProvider, rightType);
- }
return getLeastUpperBound(leftType, rightType);
}
@@ -1511,13 +1490,13 @@
//
// This allows the variable to be used wherever the supertype (here `Base`)
// is expected, while gaining a more precise type.
- if (isSubtypeOf2(to, from)) {
+ if (isSubtypeOf(to, from)) {
return to;
}
// For a type parameter `T extends U`, allow promoting the upper bound
// `U` to `S` where `S <: U`, yielding a type parameter `T extends S`.
if (from is TypeParameterType) {
- if (isSubtypeOf2(to, from.bound)) {
+ if (isSubtypeOf(to, from.bound)) {
var declaration = from.element.declaration;
return TypeParameterTypeImpl(
element: declaration,
diff --git a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
index f5686bf..a4e2455 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
@@ -509,7 +509,33 @@
) {
if (completionPath != null) {
var completionUnit = units.values.first;
- completionUnit.element = _unitElementWithPath(completionPath);
+ var unitElement = _unitElementWithPath(completionPath);
+ // TODO(scheglov) https://github.com/dart-lang/sdk/issues/44840
+ if (unitElement == null) {
+ String shortString(String s) {
+ const maxLength = 1000;
+ if (s.length > maxLength) {
+ return s.substring(0, maxLength);
+ }
+ return s;
+ }
+
+ var libraryContent = '<unknown>';
+ try {
+ libraryContent = _library.getContent();
+ libraryContent = shortString(libraryContent);
+ } catch (_) {}
+
+ var libraryUnitPaths =
+ _libraryElement.units.map((e) => e.source.fullName).toList();
+ throw '[completionPath: $completionPath]'
+ '[library.path: ${_library.path}]'
+ '[library.uri: ${_library.uri}]'
+ '[libraryUnitPaths: $libraryUnitPaths]'
+ '[libraryContent: $libraryContent]'
+ '[unitStr: ${shortString('$completionUnit')}]';
+ }
+ completionUnit.element = unitElement;
return;
}
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index c58fb75..48bf382 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -5,7 +5,6 @@
import 'dart:typed_data';
import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
@@ -336,7 +335,16 @@
performance: performance!,
);
var file = fileContext.file;
- var libraryFile = file.partOfLibrary ?? file;
+
+ // If we have a `part of` directive, we want to analyze this library.
+ // But the library must include the file, so have its element.
+ var libraryFile = file;
+ var partOfLibrary = file.partOfLibrary;
+ if (partOfLibrary != null) {
+ if (partOfLibrary.libraryFiles.contains(file)) {
+ libraryFile = partOfLibrary;
+ }
+ }
int? completionOffset;
if (completionLine != null && completionColumn != null) {
@@ -374,13 +382,11 @@
try {
results = performance!.run('analyze', (performance) {
- return NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return libraryAnalyzer.analyzeSync(
- completionPath: completionOffset != null ? path : null,
- completionOffset: completionOffset,
- performance: performance,
- );
- });
+ return libraryAnalyzer.analyzeSync(
+ completionPath: completionOffset != null ? path : null,
+ completionOffset: completionOffset,
+ performance: performance,
+ );
});
} catch (exception, stackTrace) {
var fileContentMap = <String, String>{};
diff --git a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
index a767e17..88b4fd2 100644
--- a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
@@ -26,7 +26,7 @@
AssignmentExpressionResolver({
required ResolverVisitor resolver,
- }) : _resolver = resolver,
+ }) : _resolver = resolver,
_typePropertyResolver = resolver.typePropertyResolver,
_inferenceHelper = resolver.inferenceHelper,
_assignmentShared = AssignmentExpressionShared(
@@ -88,7 +88,8 @@
if (flow != null) {
if (writeElement is PromotableElement) {
- flow.write(writeElement, node.staticType!, hasRead ? null : right);
+ flow.write(
+ node, writeElement, node.staticType!, hasRead ? null : right);
}
if (isIfNull) {
flow.ifNullExpression_end();
@@ -107,7 +108,7 @@
return;
}
- if (_typeSystem.isAssignableTo2(rightType, writeType)) {
+ if (_typeSystem.isAssignableTo(rightType, writeType)) {
return;
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
index 1c8de42..38fcc61 100644
--- a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
@@ -28,7 +28,7 @@
BinaryExpressionResolver({
required ResolverVisitor resolver,
required TypePromotionManager promoteManager,
- }) : _resolver = resolver,
+ }) : _resolver = resolver,
_promoteManager = promoteManager,
_typePropertyResolver = resolver.typePropertyResolver,
_inferenceHelper = resolver.inferenceHelper;
diff --git a/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart b/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart
index ed9a552..05991d0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart
@@ -130,7 +130,7 @@
}
// Otherwise, if `T <: R` then let `S` be `T`.
- if (_typeSystem.isSubtypeOf2(T, R)) {
+ if (_typeSystem.isSubtypeOf(T, R)) {
return T;
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
index 1765615..126a6d7 100644
--- a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
@@ -167,7 +167,7 @@
if (receiverType.isVoid) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.USE_OF_VOID_RESULT, receiverExpression);
- } else if (!_typeSystem.isAssignableTo2(receiverType, node.extendedType!)) {
+ } else if (!_typeSystem.isAssignableTo(receiverType, node.extendedType!)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE,
receiverExpression,
@@ -226,7 +226,7 @@
var boundType = typeParameters[i].bound;
if (boundType != null) {
boundType = substitution.substituteType(boundType);
- if (!_typeSystem.isSubtypeOf2(argType, boundType)) {
+ if (!_typeSystem.isSubtypeOf(argType, boundType)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
typeArgumentList.arguments[i],
@@ -459,7 +459,7 @@
/// Ask the type system for a subtype check.
bool _isSubtypeOf(DartType type1, DartType type2) =>
- _typeSystem.isSubtypeOf2(type1, type2);
+ _typeSystem.isSubtypeOf(type1, type2);
List<DartType> _listOfDynamic(List<TypeParameterElement> parameters) {
return List<DartType>.filled(parameters.length, _dynamicType);
diff --git a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
index 4a01f6e..1f89eb6 100644
--- a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
@@ -4,6 +4,7 @@
import 'package:_fe_analyzer_shared/src/flow_analysis/flow_analysis.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -40,6 +41,14 @@
final Map<Declaration,
AssignedVariablesForTesting<AstNode, PromotableElement>>
assignedVariables = {};
+
+ /// For each expression that led to an error because it was not promoted, a
+ /// string describing the reason it was not promoted.
+ Map<SyntacticEntity, String> nonPromotionReasons = {};
+
+ /// For each auxiliary AST node pointed to by a non-promotion reason, a string
+ /// describing the non-promotion reason pointing to it.
+ Map<AstNode, String> nonPromotionReasonTargets = {};
}
/// The helper for performing flow analysis during resolution.
@@ -333,6 +342,9 @@
TypeSystemTypeOperations(this.typeSystem);
@override
+ DartType get topType => typeSystem.objectQuestion;
+
+ @override
TypeClassification classifyType(DartType type) {
if (isSubtypeOf(type, typeSystem.typeProvider.objectType)) {
return TypeClassification.nonNullable;
@@ -360,7 +372,7 @@
@override
bool isSubtypeOf(DartType leftType, DartType rightType) {
- return typeSystem.isSubtypeOf2(leftType, rightType);
+ return typeSystem.isSubtypeOf(leftType, rightType);
}
@override
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
index 830360d..f60d683 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
@@ -25,7 +25,7 @@
required ResolverVisitor resolver,
required MigrationResolutionHooks? migrationResolutionHooks,
required TypePromotionManager promoteManager,
- }) : _resolver = resolver,
+ }) : _resolver = resolver,
_migrationResolutionHooks = migrationResolutionHooks,
_inferenceHelper = resolver.inferenceHelper,
_promoteManager = promoteManager;
@@ -99,7 +99,7 @@
// If the greatest closure of `K` is `S` and `S` is a subtype of
// `Null`, then `T` is `Object?`. Otherwise, `T` is `S`.
- if (_typeSystem.isSubtypeOf2(inferredType, _typeSystem.nullNone)) {
+ if (_typeSystem.isSubtypeOf(inferredType, _typeSystem.nullNone)) {
inferredType = _isNonNullableByDefault
? _typeSystem.objectQuestion
: _typeSystem.objectStar;
diff --git a/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
index 08ebc32..bfac763 100644
--- a/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
@@ -26,7 +26,7 @@
PostfixExpressionResolver({
required ResolverVisitor resolver,
- }) : _resolver = resolver,
+ }) : _resolver = resolver,
_typePropertyResolver = resolver.typePropertyResolver,
_inferenceHelper = resolver.inferenceHelper,
_assignmentShared = AssignmentExpressionShared(
@@ -74,7 +74,7 @@
void _checkForInvalidAssignmentIncDec(
PostfixExpression node, Expression operand, DartType type) {
var operandWriteType = node.writeType!;
- if (!_typeSystem.isAssignableTo2(type, operandWriteType)) {
+ if (!_typeSystem.isAssignableTo(type, operandWriteType)) {
_resolver.errorReporter.reportErrorForNode(
CompileTimeErrorCode.INVALID_ASSIGNMENT,
node,
@@ -173,7 +173,7 @@
var element = operand.staticElement;
if (element is PromotableElement) {
_resolver.flowAnalysis?.flow
- ?.write(element, operatorReturnType, null);
+ ?.write(node, element, operatorReturnType, null);
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
index 6901f05..82f712c 100644
--- a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
@@ -26,7 +26,7 @@
PrefixExpressionResolver({
required ResolverVisitor resolver,
- }) : _resolver = resolver,
+ }) : _resolver = resolver,
_typePropertyResolver = resolver.typePropertyResolver,
_inferenceHelper = resolver.inferenceHelper,
_assignmentShared = AssignmentExpressionShared(
@@ -78,7 +78,7 @@
void _checkForInvalidAssignmentIncDec(
PrefixExpressionImpl node, DartType type) {
var operandWriteType = node.writeType!;
- if (!_typeSystem.isAssignableTo2(type, operandWriteType)) {
+ if (!_typeSystem.isAssignableTo(type, operandWriteType)) {
_resolver.errorReporter.reportErrorForNode(
CompileTimeErrorCode.INVALID_ASSIGNMENT,
node,
@@ -209,7 +209,8 @@
if (operand is SimpleIdentifier) {
var element = operand.staticElement;
if (element is PromotableElement) {
- _resolver.flowAnalysis?.flow?.write(element, staticType, null);
+ _resolver.flowAnalysis?.flow
+ ?.write(node, element, staticType, null);
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
index 9a7c23b..00317e0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
@@ -143,6 +143,7 @@
}
return _resolve(
+ node: node,
target: prefix,
isCascaded: false,
isNullAware: false,
@@ -171,6 +172,7 @@
if (target is SuperExpression) {
return _resolveTargetSuperExpression(
+ node: node,
target: target,
propertyName: propertyName,
hasRead: hasRead,
@@ -179,6 +181,7 @@
}
return _resolve(
+ node: node,
target: target,
isCascaded: node.target == null,
isNullAware: node.isNullAware,
@@ -198,6 +201,9 @@
if (hasRead) {
var readLookup = _resolver.lexicalLookup(node: node, setter: false);
readElementRequested = readLookup.requested;
+ if (readElementRequested is PropertyAccessorElement) {
+ _resolver.flowAnalysis?.flow?.thisOrSuperPropertyGet(node, node.name);
+ }
_resolver.checkReadOfNotAssignedLocalVariable(node, readElementRequested);
}
@@ -282,6 +288,7 @@
}
PropertyElementResolverResult _resolve({
+ required Expression node,
required Expression target,
required bool isCascaded,
required bool isNullAware,
@@ -364,6 +371,8 @@
nameErrorEntity: propertyName,
);
+ _resolver.flowAnalysis?.flow?.propertyGet(node, target, propertyName.name);
+
if (hasRead && result.needsGetterError) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.UNDEFINED_GETTER,
@@ -595,6 +604,7 @@
}
PropertyElementResolverResult _resolveTargetSuperExpression({
+ required Expression node,
required SuperExpression target,
required SimpleIdentifier propertyName,
required bool hasRead,
@@ -610,6 +620,8 @@
if (targetType is InterfaceTypeImpl) {
if (hasRead) {
+ _resolver.flowAnalysis?.flow
+ ?.propertyGet(node, target, propertyName.name);
var name = Name(_definingLibrary.source.uri, propertyName.name);
readElement = _resolver.inheritance
.getMember2(targetType.element, name, forSuper: true);
diff --git a/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
index fc603c5..15898fa 100644
--- a/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
@@ -2,18 +2,23 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:_fe_analyzer_shared/src/flow_analysis/flow_analysis.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type_provider.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/dart/resolver/extension_member_resolver.dart';
+import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
import 'package:analyzer/src/dart/resolver/resolution_result.dart';
+import 'package:analyzer/src/diagnostic/diagnostic.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/source.dart';
/// Helper for resolving properties (getters, setters, or methods).
class TypePropertyResolver {
@@ -114,9 +119,30 @@
}
}
+ var whyNotPromoted = receiver == null
+ ? null
+ : _resolver.flowAnalysis?.flow?.whyNotPromoted(receiver);
+ List<DiagnosticMessage> messages = [];
+ if (whyNotPromoted != null) {
+ for (var entry in whyNotPromoted.entries) {
+ var whyNotPromotedVisitor = _WhyNotPromotedVisitor(
+ _resolver.source, _resolver.flowAnalysis!.dataForTesting);
+ if (_typeSystem.isPotentiallyNullable(entry.key)) continue;
+ if (_resolver.flowAnalysis!.dataForTesting != null) {
+ _resolver.flowAnalysis!.dataForTesting!
+ .nonPromotionReasons[nameErrorEntity] = entry.value.shortName;
+ }
+ var message = entry.value.accept(whyNotPromotedVisitor);
+ if (message != null) {
+ messages = [message];
+ }
+ break;
+ }
+ }
+
_resolver.nullableDereferenceVerifier.report(
receiverErrorNode, receiverType,
- errorCode: errorCode, arguments: [name]);
+ errorCode: errorCode, arguments: [name], messages: messages);
_reportedGetterError = true;
_reportedSetterError = true;
@@ -264,3 +290,71 @@
);
}
}
+
+class _WhyNotPromotedVisitor
+ implements
+ NonPromotionReasonVisitor<DiagnosticMessage?, AstNode, Expression,
+ PromotableElement> {
+ final Source source;
+
+ final FlowAnalysisDataForTesting? _dataForTesting;
+
+ _WhyNotPromotedVisitor(this.source, this._dataForTesting);
+
+ @override
+ DiagnosticMessage? visitDemoteViaExplicitWrite(
+ DemoteViaExplicitWrite<PromotableElement, Expression> reason) {
+ var writeExpression = reason.writeExpression;
+ if (_dataForTesting != null) {
+ _dataForTesting!.nonPromotionReasonTargets[writeExpression] =
+ reason.shortName;
+ }
+ var variableName = reason.variable.name;
+ if (variableName == null) return null;
+ return _contextMessageForWrite(variableName, writeExpression);
+ }
+
+ @override
+ DiagnosticMessage? visitDemoteViaForEachVariableWrite(
+ DemoteViaForEachVariableWrite<PromotableElement, AstNode> reason) {
+ var node = reason.node;
+ var variableName = reason.variable.name;
+ if (variableName == null) return null;
+ ForLoopParts parts;
+ if (node is ForStatement) {
+ parts = node.forLoopParts;
+ } else if (node is ForElement) {
+ parts = node.forLoopParts;
+ } else {
+ assert(false, 'Unexpected node type');
+ return null;
+ }
+ if (parts is ForEachPartsWithIdentifier) {
+ var identifier = parts.identifier;
+ if (_dataForTesting != null) {
+ _dataForTesting!.nonPromotionReasonTargets[identifier] =
+ reason.shortName;
+ }
+ return _contextMessageForWrite(variableName, identifier);
+ } else {
+ assert(false, 'Unexpected parts type');
+ return null;
+ }
+ }
+
+ @override
+ DiagnosticMessage? visitFieldNotPromoted(FieldNotPromoted reason) {
+ // TODO(paulberry): how to report this?
+ return null;
+ }
+
+ DiagnosticMessageImpl _contextMessageForWrite(
+ String variableName, Expression writeExpression) {
+ return DiagnosticMessageImpl(
+ filePath: source.fullName,
+ message:
+ "Variable '$variableName' could be null due to a write occurring here.",
+ offset: writeExpression.offset,
+ length: writeExpression.length);
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
index d6c2dfc..6cf4eb2 100644
--- a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
@@ -187,10 +187,10 @@
}
if (_typeSystem.isNonNullableByDefault) {
- if (_typeSystem.isSubtypeOf2(expressionType, NeverTypeImpl.instance)) {
+ if (_typeSystem.isSubtypeOf(expressionType, NeverTypeImpl.instance)) {
return NeverTypeImpl.instance;
}
- if (_typeSystem.isSubtypeOf2(expressionType, _typeSystem.nullNone)) {
+ if (_typeSystem.isSubtypeOf(expressionType, _typeSystem.nullNone)) {
if (element.isNullAware) {
return NeverTypeImpl.instance;
}
@@ -380,14 +380,14 @@
}
if (_typeSystem.isNonNullableByDefault) {
- if (_typeSystem.isSubtypeOf2(expressionType, NeverTypeImpl.instance)) {
+ if (_typeSystem.isSubtypeOf(expressionType, NeverTypeImpl.instance)) {
return _InferredCollectionElementTypeInformation(
elementType: NeverTypeImpl.instance,
keyType: NeverTypeImpl.instance,
valueType: NeverTypeImpl.instance,
);
}
- if (_typeSystem.isSubtypeOf2(expressionType, _typeSystem.nullNone)) {
+ if (_typeSystem.isSubtypeOf(expressionType, _typeSystem.nullNone)) {
if (element.isNullAware) {
return _InferredCollectionElementTypeInformation(
elementType: NeverTypeImpl.instance,
diff --git a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
index 68efd6c..d0829f0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
@@ -20,7 +20,7 @@
VariableDeclarationResolver({
required ResolverVisitor resolver,
required bool strictInference,
- }) : _resolver = resolver,
+ }) : _resolver = resolver,
_strictInference = strictInference;
void resolve(VariableDeclarationImpl node) {
diff --git a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
index 41678af..103119a 100644
--- a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
@@ -83,7 +83,7 @@
impliedReturnType = _typeProvider.streamType2(expressionType);
}
- if (!_typeSystem.isAssignableTo2(impliedReturnType, declaredReturnType)) {
+ if (!_typeSystem.isAssignableTo(impliedReturnType, declaredReturnType)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
expression,
@@ -103,7 +103,7 @@
requiredReturnType = _typeProvider.streamDynamicType;
}
- if (!_typeSystem.isAssignableTo2(impliedReturnType, requiredReturnType)) {
+ if (!_typeSystem.isAssignableTo(impliedReturnType, requiredReturnType)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
expression,
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 3c842d0..9f75b54 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -1611,7 +1611,7 @@
}
// The cast is necessary.
- if (!typeSystem.isSubtypeOf2(leftType, rightType)) {
+ if (!typeSystem.isSubtypeOf(leftType, rightType)) {
return false;
}
diff --git a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
index 3fa1459..3324386 100644
--- a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
+++ b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
@@ -48,7 +48,7 @@
{required ErrorCode errorCode, List<Object>? arguments}) {
var type = expression.staticType!;
if (!_checkForUseOfVoidResult(expression) &&
- !_typeSystem.isAssignableTo2(type, _boolType)) {
+ !_typeSystem.isAssignableTo(type, _boolType)) {
if (type.element == _boolElement) {
_nullableDereferenceVerifier.report(expression, type,
errorCode: CompileTimeErrorCode
diff --git a/pkg/analyzer/lib/src/error/correct_override.dart b/pkg/analyzer/lib/src/error/correct_override.dart
index db8a2ee..7970e6f 100644
--- a/pkg/analyzer/lib/src/error/correct_override.dart
+++ b/pkg/analyzer/lib/src/error/correct_override.dart
@@ -39,7 +39,7 @@
superMember = _library.toLegacyElementIfOptOut(superMember);
var superType = superMember.type;
- return _typeSystem.isSubtypeOf2(_thisTypeForSubtype!, superType);
+ return _typeSystem.isSubtypeOf(_thisTypeForSubtype!, superType);
}
/// If [_thisMember] is not a correct override of [superMember], report the
@@ -120,8 +120,8 @@
for (var superParameter in entry.value) {
var thisType = parameter.type;
var superType = superParameter.type;
- if (!_typeSystem.isSubtypeOf2(superType, thisType) &&
- !_typeSystem.isSubtypeOf2(thisType, superType)) {
+ if (!_typeSystem.isSubtypeOf(superType, thisType) &&
+ !_typeSystem.isSubtypeOf(thisType, superType)) {
var superMember = superParameter.member;
errorReporter.reportErrorForNode(
CompileTimeErrorCode.INVALID_OVERRIDE,
diff --git a/pkg/analyzer/lib/src/error/dead_code_verifier.dart b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
index 6425888..bce84b9 100644
--- a/pkg/analyzer/lib/src/error/dead_code_verifier.dart
+++ b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
@@ -633,7 +633,7 @@
// An on-catch clause was found; verify that the exception type is not a
// subtype of a previous on-catch exception type.
for (var type in _visitedTypes) {
- if (_typeSystem.isSubtypeOf2(currentType, type)) {
+ if (_typeSystem.isSubtypeOf(currentType, type)) {
_errorReporter(
catchClause,
catchClauses.last,
diff --git a/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart b/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart
index 5c5e045..933fe37 100644
--- a/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart
+++ b/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart
@@ -115,8 +115,8 @@
bool _match(DartType getterType, DartType setterType) {
return _isNonNullableByDefault
- ? _typeSystem.isSubtypeOf2(getterType, setterType)
- : _typeSystem.isAssignableTo2(getterType, setterType);
+ ? _typeSystem.isSubtypeOf(getterType, setterType)
+ : _typeSystem.isAssignableTo(getterType, setterType);
}
/// Return the return type of the [getter].
diff --git a/pkg/analyzer/lib/src/error/literal_element_verifier.dart b/pkg/analyzer/lib/src/error/literal_element_verifier.dart
index 36b4318..d62271b 100644
--- a/pkg/analyzer/lib/src/error/literal_element_verifier.dart
+++ b/pkg/analyzer/lib/src/error/literal_element_verifier.dart
@@ -48,7 +48,7 @@
/// Check that the given [type] is assignable to the [elementType], otherwise
/// report the list or set error on the [errorNode].
void _checkAssignableToElementType(DartType type, AstNode errorNode) {
- if (!typeSystem.isAssignableTo2(type, elementType!)) {
+ if (!typeSystem.isAssignableTo(type, elementType!)) {
var errorCode = forList
? CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
: CompileTimeErrorCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE;
@@ -108,7 +108,7 @@
}
var keyType = entry.key.staticType!;
- if (!typeSystem.isAssignableTo2(keyType, mapKeyType!)) {
+ if (!typeSystem.isAssignableTo(keyType, mapKeyType!)) {
errorReporter.reportErrorForNode(
CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
entry.key,
@@ -117,7 +117,7 @@
}
var valueType = entry.value.staticType!;
- if (!typeSystem.isAssignableTo2(valueType, mapValueType!)) {
+ if (!typeSystem.isAssignableTo(valueType, mapValueType!)) {
errorReporter.reportErrorForNode(
CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
entry.value,
@@ -133,10 +133,10 @@
if (expressionType.isDynamic) return;
if (typeSystem.isNonNullableByDefault) {
- if (typeSystem.isSubtypeOf2(expressionType, NeverTypeImpl.instance)) {
+ if (typeSystem.isSubtypeOf(expressionType, NeverTypeImpl.instance)) {
return;
}
- if (typeSystem.isSubtypeOf2(expressionType, typeSystem.nullNone)) {
+ if (typeSystem.isSubtypeOf(expressionType, typeSystem.nullNone)) {
if (isNullAware) {
return;
}
@@ -171,7 +171,7 @@
}
var iterableElementType = iterableType.typeArguments[0];
- if (!typeSystem.isAssignableTo2(iterableElementType, elementType!)) {
+ if (!typeSystem.isAssignableTo(iterableElementType, elementType!)) {
var errorCode = forList
? CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
: CompileTimeErrorCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE;
@@ -190,10 +190,10 @@
if (expressionType.isDynamic) return;
if (typeSystem.isNonNullableByDefault) {
- if (typeSystem.isSubtypeOf2(expressionType, NeverTypeImpl.instance)) {
+ if (typeSystem.isSubtypeOf(expressionType, NeverTypeImpl.instance)) {
return;
}
- if (typeSystem.isSubtypeOf2(expressionType, typeSystem.nullNone)) {
+ if (typeSystem.isSubtypeOf(expressionType, typeSystem.nullNone)) {
if (isNullAware) {
return;
}
@@ -228,7 +228,7 @@
}
var keyType = mapType.typeArguments[0];
- if (!typeSystem.isAssignableTo2(keyType, mapKeyType!)) {
+ if (!typeSystem.isAssignableTo(keyType, mapKeyType!)) {
errorReporter.reportErrorForNode(
CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
expression,
@@ -237,7 +237,7 @@
}
var valueType = mapType.typeArguments[1];
- if (!typeSystem.isAssignableTo2(valueType, mapValueType!)) {
+ if (!typeSystem.isAssignableTo(valueType, mapValueType!)) {
errorReporter.reportErrorForNode(
CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
expression,
diff --git a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
index e1dd812..1b5f219 100644
--- a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
+++ b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/element/type.dart';
@@ -32,13 +33,16 @@
}
void report(AstNode errorNode, DartType receiverType,
- {ErrorCode? errorCode, List<String> arguments = const <String>[]}) {
+ {ErrorCode? errorCode,
+ List<String> arguments = const <String>[],
+ List<DiagnosticMessage>? messages}) {
if (receiverType == _typeSystem.typeProvider.nullType) {
errorCode = CompileTimeErrorCode.INVALID_USE_OF_NULL_VALUE;
} else {
errorCode ??= CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE;
}
- _errorReporter.reportErrorForNode(errorCode, errorNode, arguments);
+ _errorReporter.reportErrorForNode(
+ errorCode, errorNode, arguments, messages);
}
/// If the [receiverType] is potentially nullable, report it.
diff --git a/pkg/analyzer/lib/src/error/return_type_verifier.dart b/pkg/analyzer/lib/src/error/return_type_verifier.dart
index c59865c..38aad2a 100644
--- a/pkg/analyzer/lib/src/error/return_type_verifier.dart
+++ b/pkg/analyzer/lib/src/error/return_type_verifier.dart
@@ -207,7 +207,7 @@
// It is a compile-time error if `S` is not `void`,
// and `S` is not assignable to `T`.
if (!S.isVoid) {
- if (!_typeSystem.isAssignableTo2(S, T)) {
+ if (!_typeSystem.isAssignableTo(S, T)) {
reportTypeError();
return;
}
@@ -244,7 +244,7 @@
// and `Future<flatten(S)>` is not assignable to `T`.
if (!flatten_S.isVoid) {
var future_flatten_S = _typeProvider.futureType2(flatten_S);
- if (!_typeSystem.isAssignableTo2(future_flatten_S, T)) {
+ if (!_typeSystem.isAssignableTo(future_flatten_S, T)) {
reportTypeError();
return;
}
@@ -314,7 +314,7 @@
// It is a compile-time error if `S` is not `void`,
// and `S` is not assignable to `T`.
if (!S.isVoid) {
- if (!_typeSystem.isAssignableTo2(S, T)) {
+ if (!_typeSystem.isAssignableTo(S, T)) {
reportTypeError();
return;
}
@@ -345,8 +345,8 @@
// It is a compile-time error if `flatten(S)` is not `void`,
// and `Future<flatten(S)>` is not assignable to `T`.
if (!flatten_S.isVoid) {
- if (!_typeSystem.isAssignableTo2(S, T_v) &&
- !_typeSystem.isSubtypeOf2(flatten_S, T_v)) {
+ if (!_typeSystem.isAssignableTo(S, T_v) &&
+ !_typeSystem.isSubtypeOf(flatten_S, T_v)) {
reportTypeError();
return;
}
@@ -406,7 +406,7 @@
typeArguments: [NeverTypeImpl.instance],
nullabilitySuffix: NullabilitySuffix.star,
);
- return _typeSystem.isSubtypeOf2(lowerBound, returnType);
+ return _typeSystem.isSubtypeOf(lowerBound, returnType);
}
static bool _isVoidDynamic(DartType type) {
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index 7af6125..642a37f 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -230,7 +230,7 @@
bound = _libraryElement.toLegacyTypeIfOptOut(bound);
bound = substitution.substituteType(bound);
- if (!_typeSystem.isSubtypeOf2(typeArgument, bound)) {
+ if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
issues ??= <_TypeArgumentIssue>[];
issues.add(
_TypeArgumentIssue(i, typeParameter, typeArgument),
@@ -279,7 +279,7 @@
bound = _libraryElement.toLegacyTypeIfOptOut(bound);
bound = substitution.substituteType(bound);
- if (!_typeSystem.isSubtypeOf2(typeArgument, bound)) {
+ if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
_typeArgumentErrorNode(typeName, i),
@@ -367,7 +367,7 @@
var substitution = Substitution.fromPairs(fnTypeParams, typeArgs);
var bound = substitution.substituteType(rawBound);
- if (!_typeSystem.isSubtypeOf2(argType, bound)) {
+ if (!_typeSystem.isSubtypeOf(argType, bound)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
typeArgumentList[i],
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 786cd50..426cf7b 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1530,18 +1530,12 @@
debugEvent("FunctionTypeAlias");
if (equals == null) {
- var parameters = pop() as FormalParameterList?;
+ var parameters = pop() as FormalParameterList;
var typeParameters = pop() as TypeParameterList?;
var name = pop() as SimpleIdentifier;
var returnType = pop() as TypeAnnotation?;
var metadata = pop() as List<Annotation>?;
var comment = _findComment(metadata, typedefKeyword);
-
- // TODO(scheglov) https://github.com/dart-lang/sdk/issues/41023
- if (parameters == null) {
- throw StateError('FunctionTypeAlias without parameters.');
- }
-
declarations.add(ast.functionTypeAlias(comment, metadata, typedefKeyword,
returnType, name, typeParameters, parameters, semicolon));
} else {
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 912da39..148ef98 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -1465,14 +1465,14 @@
// Report specific problem when return type is incompatible
FunctionType constructorType = declaration.declaredElement!.type;
DartType constructorReturnType = constructorType.returnType;
- if (!_typeSystem.isAssignableTo2(
+ if (!_typeSystem.isAssignableTo(
redirectedReturnType, constructorReturnType)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.REDIRECT_TO_INVALID_RETURN_TYPE,
redirectedConstructor,
[redirectedReturnType, constructorReturnType]);
return;
- } else if (!_typeSystem.isSubtypeOf2(redirectedType, constructorType)) {
+ } else if (!_typeSystem.isSubtypeOf(redirectedType, constructorType)) {
// Check parameters.
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.REDIRECT_TO_INVALID_FUNCTION_TYPE,
@@ -1622,7 +1622,7 @@
DartType actualStaticType,
DartType expectedStaticType,
ErrorCode errorCode) {
- if (!_typeSystem.isAssignableTo2(actualStaticType, expectedStaticType)) {
+ if (!_typeSystem.isAssignableTo(actualStaticType, expectedStaticType)) {
AstNode getErrorNode(AstNode node) {
if (node is CascadeExpression) {
return getErrorNode(node.target);
@@ -2327,7 +2327,7 @@
iterableType = requiredSequenceType;
}
- if (!_typeSystem.isAssignableTo2(iterableType, requiredSequenceType)) {
+ if (!_typeSystem.isAssignableTo(iterableType, requiredSequenceType)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE,
node.iterable,
@@ -2351,7 +2351,7 @@
return true;
}
- if (!_typeSystem.isAssignableTo2(sequenceElementType, variableType)) {
+ if (!_typeSystem.isAssignableTo(sequenceElementType, variableType)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
node.iterable,
@@ -2521,7 +2521,7 @@
Expression expression = initializer.expression;
// test the static type of the expression
DartType staticType = expression.staticType!;
- if (_typeSystem.isAssignableTo2(staticType, fieldType)) {
+ if (_typeSystem.isAssignableTo(staticType, fieldType)) {
return;
}
// report problem
@@ -3122,7 +3122,7 @@
var first = positional.first;
var type = first.declaredElement!.type;
var listOfString = _typeProvider.listType2(_typeProvider.stringType);
- if (!_typeSystem.isSubtypeOf2(listOfString, type)) {
+ if (!_typeSystem.isSubtypeOf(listOfString, type)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE,
first.notDefault.typeOrSelf,
@@ -3281,11 +3281,11 @@
superType = superType.withNullability(NullabilitySuffix.none);
}
- bool isSatisfied = _typeSystem.isSubtypeOf2(superType, constraint);
+ bool isSatisfied = _typeSystem.isSubtypeOf(superType, constraint);
if (!isSatisfied) {
for (int i = 0; i < mixinIndex && !isSatisfied; i++) {
isSatisfied =
- _typeSystem.isSubtypeOf2(_enclosingClass!.mixins[i], constraint);
+ _typeSystem.isSubtypeOf(_enclosingClass!.mixins[i], constraint);
}
}
if (!isSatisfied) {
@@ -4176,7 +4176,7 @@
DartType caseType = caseExpression.staticType!;
// check types
- if (!_typeSystem.isAssignableTo2(expressionType, caseType)) {
+ if (!_typeSystem.isAssignableTo(expressionType, caseType)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE,
expression,
@@ -4190,7 +4190,7 @@
var expression = node.expression;
var type = node.expression.staticType!;
- if (!_typeSystem.isAssignableTo2(type, _typeSystem.objectNone)) {
+ if (!_typeSystem.isAssignableTo(type, _typeSystem.objectNone)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.THROW_OF_INVALID_TYPE,
expression,
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 299afe7..feca32d 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -628,11 +628,11 @@
InterfaceType objectType = typeSystem.objectStar;
return checkCovariance
? /* everything is subtype of objectStar */ true
- : typeSystem.isSubtypeOf2(objectType, dartType);
+ : typeSystem.isSubtypeOf(objectType, dartType);
} else if (dartType is InterfaceType && nativeType is InterfaceType) {
return checkCovariance
- ? typeSystem.isSubtypeOf2(dartType, nativeType)
- : typeSystem.isSubtypeOf2(nativeType, dartType);
+ ? typeSystem.isSubtypeOf(dartType, nativeType)
+ : typeSystem.isSubtypeOf(nativeType, dartType);
} else {
// If the [nativeType] is not a primitive int/double type then it has to
// be a Pointer type atm.
@@ -785,7 +785,7 @@
if (!_isValidFfiNativeType(targetType, false, true)) {
final AstNode errorNode = node;
_errorReporter.reportErrorForNode(
- FfiCode.NON_CONSTANT_TYPE_ARGUMENT_WARNING, errorNode, ['[]']);
+ FfiCode.NON_CONSTANT_TYPE_ARGUMENT, errorNode, ['[]']);
}
}
@@ -796,7 +796,7 @@
if (!_isValidFfiNativeType(targetType, false, true)) {
final AstNode errorNode = node;
_errorReporter.reportErrorForNode(
- FfiCode.NON_CONSTANT_TYPE_ARGUMENT_WARNING, errorNode, ['ref']);
+ FfiCode.NON_CONSTANT_TYPE_ARGUMENT, errorNode, ['ref']);
}
}
@@ -805,7 +805,7 @@
if (!_isValidFfiNativeType(targetType, false, true)) {
final AstNode errorNode = node;
_errorReporter.reportErrorForNode(
- FfiCode.NON_CONSTANT_TYPE_ARGUMENT_WARNING, errorNode, ['ref']);
+ FfiCode.NON_CONSTANT_TYPE_ARGUMENT, errorNode, ['ref']);
}
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 14bea1b..e2c8920 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1158,8 +1158,7 @@
_enclosingFunction = node.declaredElement!;
if (flowAnalysis != null) {
- flowAnalysis!
- .topLevelDeclaration_enter(node, node.parameters, node.body);
+ flowAnalysis!.topLevelDeclaration_enter(node, node.parameters, node.body);
flowAnalysis!.executableDeclaration_enter(node, node.parameters, false);
} else {
_promoteManager.enterFunctionBody(node.body!);
@@ -1655,8 +1654,7 @@
_enclosingFunction = node.declaredElement!;
if (flowAnalysis != null) {
- flowAnalysis!
- .topLevelDeclaration_enter(node, node.parameters, node.body);
+ flowAnalysis!.topLevelDeclaration_enter(node, node.parameters, node.body);
flowAnalysis!.executableDeclaration_enter(node, node.parameters, false);
} else {
_promoteManager.enterFunctionBody(node.body);
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index e7d2de5..ab454da 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -220,8 +220,8 @@
var context = InferenceContext.getContext(
(node as IntegerLiteralImpl).immediatelyNegated ? node.parent : node);
if (context == null ||
- _typeSystem.isAssignableTo2(_typeProvider.intType, context) ||
- !_typeSystem.isAssignableTo2(_typeProvider.doubleType, context)) {
+ _typeSystem.isAssignableTo(_typeProvider.intType, context) ||
+ !_typeSystem.isAssignableTo(_typeProvider.doubleType, context)) {
recordStaticType(node, _typeProvider.intType);
} else {
recordStaticType(node, _typeProvider.doubleType);
@@ -284,6 +284,7 @@
@override
void visitSuperExpression(SuperExpression node) {
+ _resolver.flowAnalysis?.flow?.thisOrSuper(node);
var thisType = _resolver.thisType;
if (thisType == null ||
node.thisOrAncestorOfType<ExtensionDeclaration>() != null) {
@@ -304,6 +305,7 @@
/// interface of the immediately enclosing class.</blockquote>
@override
void visitThisExpression(ThisExpression node) {
+ _resolver.flowAnalysis?.flow?.thisOrSuper(node);
var thisType = _resolver.thisType;
if (thisType == null) {
// TODO(brianwilkerson) Report this error if it hasn't already been
diff --git a/pkg/analyzer/lib/src/summary2/linked_element_factory.dart b/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
index 44aa3ee..080df22 100644
--- a/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
+++ b/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
@@ -297,7 +297,19 @@
}
// For class, mixin, extension - index members.
- parent.nodeAccessor!.readIndex();
+ var parentNodeAccessor = parent.nodeAccessor;
+ // TODO(scheglov) https://github.com/dart-lang/sdk/issues/44841
+ if (parentNodeAccessor == null) {
+ var parentNodeCode = '<unknown>';
+ try {
+ parentNodeCode = '${parent.node}';
+ } catch (_) {}
+ throw '[reference: $reference]'
+ '[parent: $parent]'
+ '[parentNodeCode: $parentNodeCode]';
+ } else {
+ parentNodeAccessor.readIndex();
+ }
// For any element - class, method, etc - read the node.
var node = reference.nodeAccessor!.node;
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 36ae705..948dd19 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -606,13 +606,13 @@
return null; // unrelated
}
- if (rules.isSubtypeOf2(from, to)) {
+ if (rules.isSubtypeOf(from, to)) {
// Sound subtype.
// However we may still need cast if we have a call tearoff.
return callTearoff;
}
- if (rules.isSubtypeOf2(to, from)) {
+ if (rules.isSubtypeOf(to, from)) {
// Assignable, but needs cast.
return true;
}
@@ -799,12 +799,12 @@
}
// fromT <: toT, no coercion needed.
- if (rules.isSubtypeOf2(from, to)) {
+ if (rules.isSubtypeOf(from, to)) {
return false;
}
// Down cast or legal sideways cast, coercion needed.
- if (rules.isAssignableTo2(from, to)) {
+ if (rules.isAssignableTo(from, to)) {
return true;
}
@@ -837,7 +837,7 @@
// want to warn if it's a legal subtype.
if (from is InterfaceType && rules.acceptsFunctionType(to)) {
var type = rules.getCallMethodType(from);
- if (type != null && rules.isSubtypeOf2(type, to)) {
+ if (type != null && rules.isSubtypeOf(type, to)) {
return;
}
}
@@ -959,7 +959,7 @@
nullabilitySuffix: _noneOrStarSuffix,
);
- if (rules.isSubtypeOf2(sequenceType, iterableType)) {
+ if (rules.isSubtypeOf(sequenceType, iterableType)) {
_recordImplicitCast(node.iterable, sequenceType, from: iterableType);
elementType = DynamicTypeImpl.instance;
}
diff --git a/pkg/analyzer/lib/src/workspace/bazel.dart b/pkg/analyzer/lib/src/workspace/bazel.dart
index b6eda24..d02f16b 100644
--- a/pkg/analyzer/lib/src/workspace/bazel.dart
+++ b/pkg/analyzer/lib/src/workspace/bazel.dart
@@ -368,6 +368,11 @@
/// The absolute path to the `bazel-genfiles` folder.
final String genfiles;
+ /// Sometimes `BUILD` files are not preserved, and `xyz.packages` files
+ /// are created instead. But looking for them is expensive, so we want
+ /// to avoid this in cases when `BUILD` files are always available.
+ final bool _lookForBuildFileSubstitutes;
+
/// The cache of packages. The key is the directory path, the value is
/// the corresponding package.
final Map<String, BazelWorkspacePackage> _directoryToPackage = {};
@@ -376,7 +381,13 @@
StreamController<BazelFileNotification>.broadcast();
BazelWorkspace._(
- this.provider, this.root, this.readonly, this.binPaths, this.genfiles);
+ this.provider,
+ this.root,
+ this.readonly,
+ this.binPaths,
+ this.genfiles, {
+ required bool lookForBuildFileSubstitutes,
+ }) : _lookForBuildFileSubstitutes = lookForBuildFileSubstitutes;
/// Stream of files that we tried to find along with their potential or actual
/// paths.
@@ -511,30 +522,8 @@
return packageRootedHere();
}
- // In some distributed build environments, BUILD files are not preserved.
- // We can still look for a ".packages" file in order to determine a
- // package's root. A ".packages" file found in [folder]'s sister path
- // under a "bin" path among [binPaths] denotes a Dart package.
- //
- // For example, if this BazelWorkspace's [root] is
- // "/build/work/abc123/workspace" with two "bin" folders,
- // "/build/work/abc123/workspace/blaze-out/host/bin/" and
- // "/build/work/abc123/workspace/blaze-out/k8-opt/bin/", and [folder]
- // is at "/build/work/abc123/workspace/foo/bar", then we must look for a
- // file ending in ".packages" in the folders
- // "/build/work/abc123/workspace/blaze-out/host/bin/foo/bar" and
- // "/build/work/abc123/workspace/blaze-out/k8-opt/bin/foo/bar".
-
- // [folder]'s path, relative to [root]. For example, "foo/bar".
- String relative = context.relative(folder.path, from: root);
- for (String bin in binPaths) {
- Folder binChild =
- provider.getFolder(context.normalize(context.join(bin, relative)));
- if (binChild.exists &&
- binChild.getChildren().any((c) => c.path.endsWith('.packages'))) {
- // [folder]'s sister folder within [bin] contains a ".packages" file.
- return packageRootedHere();
- }
+ if (_hasBuildFileSubstitute(folder)) {
+ return packageRootedHere();
}
// Go up a folder.
@@ -542,6 +531,42 @@
}
}
+ /// In some distributed build environments, BUILD files are not preserved.
+ /// We can still look for a ".packages" file in order to determine a
+ /// package's root. A ".packages" file found in [folder]'s sister path
+ /// under a "bin" path among [binPaths] denotes a Dart package.
+ ///
+ /// For example, if the [root] of this BazelWorkspace is
+ /// "/build/work/abc123/workspace" with two "bin" folders,
+ /// "/build/work/abc123/workspace/blaze-out/host/bin/" and
+ /// "/build/work/abc123/workspace/blaze-out/k8-opt/bin/", and [folder]
+ /// is at "/build/work/abc123/workspace/foo/bar", then we must look for a
+ /// file ending in ".packages" in the folders
+ /// "/build/work/abc123/workspace/blaze-out/host/bin/foo/bar" and
+ /// "/build/work/abc123/workspace/blaze-out/k8-opt/bin/foo/bar".
+ bool _hasBuildFileSubstitute(Folder folder) {
+ if (!_lookForBuildFileSubstitutes) {
+ return false;
+ }
+
+ path.Context context = provider.pathContext;
+
+ // [folder]'s path, relative to [root]. For example, "foo/bar".
+ String relative = context.relative(folder.path, from: root);
+
+ for (String bin in binPaths) {
+ Folder binChild =
+ provider.getFolder(context.normalize(context.join(bin, relative)));
+ if (binChild.exists &&
+ binChild.getChildren().any((c) => c.path.endsWith('.packages'))) {
+ // [folder]'s sister folder within [bin] contains a ".packages" file.
+ return true;
+ }
+ }
+
+ return false;
+ }
+
String? _relativeToRoot(String p) {
path.Context context = provider.pathContext;
// genfiles
@@ -582,7 +607,11 @@
/// BazelWorkspace rooted at _f_ is returned.
/// * If _f_ has a child file named "WORKSPACE", then a BazelWorkspace rooted
/// at _f_ is returned.
- static BazelWorkspace? find(ResourceProvider provider, String filePath) {
+ static BazelWorkspace? find(
+ ResourceProvider provider,
+ String filePath, {
+ bool lookForBuildFileSubstitutes = true,
+ }) {
Resource resource = provider.getResource(filePath);
if (resource is File && resource.parent != null) {
filePath = resource.parent!.path;
@@ -607,7 +636,8 @@
_findSymlinkPrefix(provider, root, binPaths: binPaths);
binPaths ??= [context.join(root, '$symlinkPrefix-bin')];
return BazelWorkspace._(provider, root, readonlyRoot, binPaths,
- context.join(root, '$symlinkPrefix-genfiles'));
+ context.join(root, '$symlinkPrefix-genfiles'),
+ lookForBuildFileSubstitutes: lookForBuildFileSubstitutes);
}
}
@@ -619,7 +649,8 @@
_findSymlinkPrefix(provider, root, binPaths: binPaths);
binPaths ??= [context.join(root, '$symlinkPrefix-bin')];
return BazelWorkspace._(provider, root, null /* readonly */, binPaths,
- context.join(root, '$symlinkPrefix-genfiles'));
+ context.join(root, '$symlinkPrefix-genfiles'),
+ lookForBuildFileSubstitutes: lookForBuildFileSubstitutes);
}
// Found the WORKSPACE file, must be a non-git workspace.
@@ -630,7 +661,8 @@
_findSymlinkPrefix(provider, root, binPaths: binPaths);
binPaths ??= [context.join(root, '$symlinkPrefix-bin')];
return BazelWorkspace._(provider, root, null /* readonly */, binPaths,
- context.join(root, '$symlinkPrefix-genfiles'));
+ context.join(root, '$symlinkPrefix-genfiles'),
+ lookForBuildFileSubstitutes: lookForBuildFileSubstitutes);
}
// Go up the folder.
diff --git a/pkg/analyzer/test/generated/type_system_test.dart b/pkg/analyzer/test/generated/type_system_test.dart
index 146d36f..6a50ac8 100644
--- a/pkg/analyzer/test/generated/type_system_test.dart
+++ b/pkg/analyzer/test/generated/type_system_test.dart
@@ -405,11 +405,11 @@
}
void _checkIsAssignableTo(DartType type1, DartType type2) {
- expect(typeSystem.isAssignableTo2(type1, type2), true);
+ expect(typeSystem.isAssignableTo(type1, type2), true);
}
void _checkIsNotAssignableTo(DartType type1, DartType type2) {
- expect(typeSystem.isAssignableTo2(type1, type2), false);
+ expect(typeSystem.isAssignableTo(type1, type2), false);
}
void _checkIsStrictAssignableTo(DartType type1, DartType type2) {
diff --git a/pkg/analyzer/test/id_tests/assigned_variables_test.dart b/pkg/analyzer/test/id_tests/assigned_variables_test.dart
index 1781d16..ef788ba 100644
--- a/pkg/analyzer/test/id_tests/assigned_variables_test.dart
+++ b/pkg/analyzer/test/id_tests/assigned_variables_test.dart
@@ -9,7 +9,6 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
import 'package:analyzer/src/util/ast_data_extractor.dart';
@@ -20,14 +19,12 @@
Directory dataDir = Directory.fromUri(Platform.script.resolve(
'../../../_fe_analyzer_shared/test/flow_analysis/assigned_variables/'
'data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<_Data>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest: runTestFor(
- const _AssignedVariablesDataComputer(), [analyzerNnbdConfig]));
- });
+ return runTests<_Data>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest: runTestFor(
+ const _AssignedVariablesDataComputer(), [analyzerNnbdConfig]));
}
class _AssignedVariablesDataComputer extends DataComputer<_Data> {
diff --git a/pkg/analyzer/test/id_tests/constant_test.dart b/pkg/analyzer/test/id_tests/constant_test.dart
index 79e212b..58b19d2 100644
--- a/pkg/analyzer/test/id_tests/constant_test.dart
+++ b/pkg/analyzer/test/id_tests/constant_test.dart
@@ -9,7 +9,6 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
@@ -21,14 +20,12 @@
main(List<String> args) async {
Directory dataDir = Directory.fromUri(Platform.script
.resolve('../../../_fe_analyzer_shared/test/constants/data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<String>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest: runTestFor(
- const ConstantsDataComputer(), [analyzerConstantUpdate2018Config]));
- });
+ return runTests<String>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest: runTestFor(
+ const ConstantsDataComputer(), [analyzerConstantUpdate2018Config]));
}
class ConstantsDataComputer extends DataComputer<String> {
diff --git a/pkg/analyzer/test/id_tests/definite_assignment_test.dart b/pkg/analyzer/test/id_tests/definite_assignment_test.dart
index 72071678..dd3fe0b 100644
--- a/pkg/analyzer/test/id_tests/definite_assignment_test.dart
+++ b/pkg/analyzer/test/id_tests/definite_assignment_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
@@ -21,14 +20,12 @@
Directory dataDir = Directory.fromUri(Platform.script.resolve(
'../../../_fe_analyzer_shared/test/flow_analysis/definite_assignment/'
'data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<String>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest: runTestFor(
- const _DefiniteAssignmentDataComputer(), [analyzerNnbdConfig]));
- });
+ return runTests<String>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest: runTestFor(
+ const _DefiniteAssignmentDataComputer(), [analyzerNnbdConfig]));
}
class _DefiniteAssignmentDataComputer extends DataComputer<String> {
diff --git a/pkg/analyzer/test/id_tests/definite_unassignment_test.dart b/pkg/analyzer/test/id_tests/definite_unassignment_test.dart
index 0f3cf47..7e4d258 100644
--- a/pkg/analyzer/test/id_tests/definite_unassignment_test.dart
+++ b/pkg/analyzer/test/id_tests/definite_unassignment_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
@@ -21,14 +20,12 @@
Directory dataDir = Directory.fromUri(Platform.script.resolve(
'../../../_fe_analyzer_shared/test/flow_analysis/definite_unassignment/'
'data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<String>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest: runTestFor(
- const _DefiniteAssignmentDataComputer(), [analyzerNnbdConfig]));
- });
+ return runTests<String>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest: runTestFor(
+ const _DefiniteAssignmentDataComputer(), [analyzerNnbdConfig]));
}
class _DefiniteAssignmentDataComputer extends DataComputer<String> {
diff --git a/pkg/analyzer/test/id_tests/inheritance_test.dart b/pkg/analyzer/test/id_tests/inheritance_test.dart
index a8a7dea..299ff7c 100644
--- a/pkg/analyzer/test/id_tests/inheritance_test.dart
+++ b/pkg/analyzer/test/id_tests/inheritance_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
@@ -20,21 +19,19 @@
main(List<String> args) async {
Directory dataDir = Directory.fromUri(Platform.script
.resolve('../../../_fe_analyzer_shared/test/inheritance/data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<String>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest:
- runTestFor(const _InheritanceDataComputer(), [analyzerNnbdConfig]),
- skipMap: {
- analyzerMarker: [
- // These are CFE-centric tests for an opt-in/opt-out sdk.
- 'object_opt_in',
- 'object_opt_out',
- ]
- });
- });
+ return runTests<String>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest:
+ runTestFor(const _InheritanceDataComputer(), [analyzerNnbdConfig]),
+ skipMap: {
+ analyzerMarker: [
+ // These are CFE-centric tests for an opt-in/opt-out sdk.
+ 'object_opt_in',
+ 'object_opt_out',
+ ]
+ });
}
String supertypeToString(InterfaceType type) {
diff --git a/pkg/analyzer/test/id_tests/nullability_test.dart b/pkg/analyzer/test/id_tests/nullability_test.dart
index b2f1561..6b98e40 100644
--- a/pkg/analyzer/test/id_tests/nullability_test.dart
+++ b/pkg/analyzer/test/id_tests/nullability_test.dart
@@ -9,7 +9,6 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_system.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
@@ -22,14 +21,12 @@
main(List<String> args) async {
Directory dataDir = Directory.fromUri(Platform.script.resolve(
'../../../_fe_analyzer_shared/test/flow_analysis/nullability/data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<String>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest:
- runTestFor(const _NullabilityDataComputer(), [analyzerNnbdConfig]));
- });
+ return runTests<String>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest:
+ runTestFor(const _NullabilityDataComputer(), [analyzerNnbdConfig]));
}
class FlowTestBase {
diff --git a/pkg/analyzer/test/id_tests/reachability_test.dart b/pkg/analyzer/test/id_tests/reachability_test.dart
index aff26d2..7b4c957 100644
--- a/pkg/analyzer/test/id_tests/reachability_test.dart
+++ b/pkg/analyzer/test/id_tests/reachability_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
import 'package:analyzer/src/util/ast_data_extractor.dart';
@@ -19,14 +18,12 @@
main(List<String> args) async {
Directory dataDir = Directory.fromUri(Platform.script.resolve(
'../../../_fe_analyzer_shared/test/flow_analysis/reachability/data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<Set<_ReachabilityAssertion>>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest: runTestFor(
- const _ReachabilityDataComputer(), [analyzerNnbdConfig]));
- });
+ return runTests<Set<_ReachabilityAssertion>>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest:
+ runTestFor(const _ReachabilityDataComputer(), [analyzerNnbdConfig]));
}
class FlowTestBase {
diff --git a/pkg/analyzer/test/id_tests/type_promotion_test.dart b/pkg/analyzer/test/id_tests/type_promotion_test.dart
index 302be7f..a5e0435 100644
--- a/pkg/analyzer/test/id_tests/type_promotion_test.dart
+++ b/pkg/analyzer/test/id_tests/type_promotion_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
import 'package:analyzer/src/util/ast_data_extractor.dart';
@@ -19,14 +18,12 @@
Directory dataDir = Directory.fromUri(Platform.script
.resolve('../../../_fe_analyzer_shared/test/flow_analysis/type_promotion/'
'data'));
- await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- return runTests<DartType>(dataDir,
- args: args,
- createUriForFileName: createUriForFileName,
- onFailure: onFailure,
- runTest: runTestFor(
- const _TypePromotionDataComputer(), [analyzerNnbdConfig]));
- });
+ return runTests<DartType>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest:
+ runTestFor(const _TypePromotionDataComputer(), [analyzerNnbdConfig]));
}
class _TypePromotionDataComputer extends DataComputer<DartType> {
diff --git a/pkg/analyzer/test/id_tests/why_not_promoted_test.dart b/pkg/analyzer/test/id_tests/why_not_promoted_test.dart
new file mode 100644
index 0000000..6cef947
--- /dev/null
+++ b/pkg/analyzer/test/id_tests/why_not_promoted_test.dart
@@ -0,0 +1,84 @@
+// Copyright (c) 2020, 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.
+
+import 'dart:io';
+
+import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
+import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/analysis/testing_data.dart';
+import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
+import 'package:analyzer/src/util/ast_data_extractor.dart';
+
+import '../util/id_testing_helper.dart';
+
+main(List<String> args) async {
+ Directory dataDir = Directory.fromUri(
+ Platform.script.resolve('../../../_fe_analyzer_shared/test/flow_analysis/'
+ 'why_not_promoted/data'));
+ return runTests<String?>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest: runTestFor(
+ const _WhyNotPromotedDataComputer(), [analyzerNnbdConfig]));
+}
+
+class _WhyNotPromotedDataComputer extends DataComputer<String?> {
+ const _WhyNotPromotedDataComputer();
+
+ @override
+ DataInterpreter<String?> get dataValidator =>
+ const _WhyNotPromotedDataInterpreter();
+
+ @override
+ bool get supportsErrors => true;
+
+ @override
+ void computeUnitData(TestingData testingData, CompilationUnit unit,
+ Map<Id, ActualData<String?>> actualMap) {
+ var flowResult =
+ testingData.uriToFlowAnalysisData[unit.declaredElement!.source.uri]!;
+ _WhyNotPromotedDataExtractor(
+ unit.declaredElement!.source.uri, actualMap, flowResult)
+ .run(unit);
+ }
+}
+
+class _WhyNotPromotedDataExtractor extends AstDataExtractor<String?> {
+ final FlowAnalysisDataForTesting _flowResult;
+
+ _WhyNotPromotedDataExtractor(
+ Uri uri, Map<Id, ActualData<String?>> actualMap, this._flowResult)
+ : super(uri, actualMap);
+
+ @override
+ String? computeNodeValue(Id id, AstNode node) {
+ String? nonPromotionReason = _flowResult.nonPromotionReasons[node];
+ if (nonPromotionReason != null) {
+ return 'notPromoted($nonPromotionReason)';
+ }
+ return _flowResult.nonPromotionReasonTargets[node];
+ }
+}
+
+class _WhyNotPromotedDataInterpreter implements DataInterpreter<String?> {
+ const _WhyNotPromotedDataInterpreter();
+
+ @override
+ String getText(String? actualData, [String? indentation]) =>
+ actualData.toString();
+
+ @override
+ String? isAsExpected(String? actualData, String? expectedData) {
+ if (actualData == expectedData) {
+ return null;
+ } else {
+ return 'Expected $expectedData, got $actualData';
+ }
+ }
+
+ @override
+ bool isEmpty(String? actualData) => actualData == null;
+}
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 4251d35..bdcdd67 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
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
@@ -2272,11 +2273,16 @@
_assertSource("@deprecated part 'a.dart';", directive);
}
- void test_visitPartOfDirective() {
- _assertSource(
- "part of l;",
- AstTestFactory.partOfDirective(
- AstTestFactory.libraryIdentifier2(["l"])));
+ void test_visitPartOfDirective_name() {
+ var unit = parseString(content: 'part of l;').unit;
+ var directive = unit.directives[0] as PartOfDirective;
+ _assertSource("part of l;", directive);
+ }
+
+ void test_visitPartOfDirective_uri() {
+ var unit = parseString(content: "part of 'a.dart';").unit;
+ var directive = unit.directives[0] as PartOfDirective;
+ _assertSource("part of 'a.dart';", directive);
}
void test_visitPartOfDirective_withMetadata() {
diff --git a/pkg/analyzer/test/src/dart/element/inheritance_manager3_test.dart b/pkg/analyzer/test/src/dart/element/inheritance_manager3_test.dart
index f1f5973..d584afe 100644
--- a/pkg/analyzer/test/src/dart/element/inheritance_manager3_test.dart
+++ b/pkg/analyzer/test/src/dart/element/inheritance_manager3_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -1325,15 +1324,12 @@
bool concrete = false,
bool forSuper = false,
}) {
- ExecutableElement? member;
- NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- member = manager.getMember2(
- findElement.classOrMixin(className),
- Name(null, name),
- concrete: concrete,
- forSuper: forSuper,
- );
- });
+ var member = manager.getMember2(
+ findElement.classOrMixin(className),
+ Name(null, name),
+ concrete: concrete,
+ forSuper: forSuper,
+ );
_assertExecutable(member, expected);
}
diff --git a/pkg/analyzer/test/src/dart/element/replace_top_bottom_test.dart b/pkg/analyzer/test/src/dart/element/replace_top_bottom_test.dart
index 8a6db58..54a3fd6 100644
--- a/pkg/analyzer/test/src/dart/element/replace_top_bottom_test.dart
+++ b/pkg/analyzer/test/src/dart/element/replace_top_bottom_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/variance.dart';
@@ -63,15 +62,13 @@
}
void _check(DartType type, String expectedStr, {String? typeStr}) {
- NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- if (typeStr != null) {
- expect(_typeString(type), typeStr);
- }
+ if (typeStr != null) {
+ expect(_typeString(type), typeStr);
+ }
- var result = typeSystem.replaceTopAndBottom(type);
- var resultStr = _typeString(result);
- expect(resultStr, expectedStr);
- });
+ var result = typeSystem.replaceTopAndBottom(type);
+ var resultStr = _typeString(result);
+ expect(resultStr, expectedStr);
}
String _typeString(DartType type) {
@@ -163,15 +160,13 @@
}
void _check(DartType type, String expectedStr, {String? typeStr}) {
- NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- if (typeStr != null) {
- expect(_typeString(type), typeStr);
- }
+ if (typeStr != null) {
+ expect(_typeString(type), typeStr);
+ }
- var result = typeSystem.replaceTopAndBottom(type);
- var resultStr = _typeString(result);
- expect(resultStr, expectedStr);
- });
+ var result = typeSystem.replaceTopAndBottom(type);
+ var resultStr = _typeString(result);
+ expect(resultStr, expectedStr);
}
String _typeString(DartType type) {
diff --git a/pkg/analyzer/test/src/dart/element/subtype_test.dart b/pkg/analyzer/test/src/dart/element/subtype_test.dart
index 2a22d03..4063e9f 100644
--- a/pkg/analyzer/test/src/dart/element/subtype_test.dart
+++ b/pkg/analyzer/test/src/dart/element/subtype_test.dart
@@ -287,7 +287,7 @@
}) {
assertExpectedString(T0, strT0);
assertExpectedString(T1, strT1);
- expect(typeSystem.isSubtypeOf2(T0, T1), isFalse);
+ expect(typeSystem.isSubtypeOf(T0, T1), isFalse);
}
void isNotSubtype2(
@@ -296,7 +296,7 @@
) {
var T0 = _getTypeByStr(strT0);
var T1 = _getTypeByStr(strT1);
- expect(typeSystem.isSubtypeOf2(T0, T1), isFalse);
+ expect(typeSystem.isSubtypeOf(T0, T1), isFalse);
}
void isNotSubtype3({
@@ -314,7 +314,7 @@
}) {
assertExpectedString(T0, strT0);
assertExpectedString(T1, strT1);
- expect(typeSystem.isSubtypeOf2(T0, T1), isTrue);
+ expect(typeSystem.isSubtypeOf(T0, T1), isTrue);
}
void isSubtype2(
@@ -323,7 +323,7 @@
) {
var T0 = _getTypeByStr(strT0);
var T1 = _getTypeByStr(strT1);
- expect(typeSystem.isSubtypeOf2(T0, T1), isTrue);
+ expect(typeSystem.isSubtypeOf(T0, T1), isTrue);
}
@override
@@ -5964,7 +5964,7 @@
void _checkIsNotSubtypeOf(DartType type1, DartType type2) {
var strType1 = _typeStr(type1);
var strType2 = _typeStr(type2);
- expect(typeSystem.isSubtypeOf2(type1, type2), false,
+ expect(typeSystem.isSubtypeOf(type1, type2), false,
reason: '$strType1 was not supposed to be a subtype of $strType2');
}
@@ -5976,7 +5976,7 @@
void _checkIsSubtypeOf(DartType type1, DartType type2) {
var strType1 = _typeStr(type1);
var strType2 = _typeStr(type2);
- expect(typeSystem.isSubtypeOf2(type1, type2), true,
+ expect(typeSystem.isSubtypeOf(type1, type2), true,
reason: '$strType1 is not a subtype of $strType2');
}
diff --git a/pkg/analyzer/test/src/dart/element/type_parameter_element_test.dart b/pkg/analyzer/test/src/dart/element/type_parameter_element_test.dart
index c809a6f..69ceb64 100644
--- a/pkg/analyzer/test/src/dart/element/type_parameter_element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/type_parameter_element_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -147,8 +146,6 @@
}
void _assertEqual(DartType T1, DartType T2, matcher) {
- NullSafetyUnderstandingFlag.enableNullSafetyTypes(() async {
- expect(T1 == T2, matcher);
- });
+ expect(T1 == T2, matcher);
}
}
diff --git a/pkg/analyzer/test/src/dart/element/upper_lower_bound_test.dart b/pkg/analyzer/test/src/dart/element/upper_lower_bound_test.dart
index 2c3a877..c68511d 100644
--- a/pkg/analyzer/test/src/dart/element/upper_lower_bound_test.dart
+++ b/pkg/analyzer/test/src/dart/element/upper_lower_bound_test.dart
@@ -4,7 +4,6 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_visitor.dart';
@@ -1435,8 +1434,8 @@
// Check that the result is a lower bound.
if (checkSubtype) {
- expect(typeSystem.isSubtypeOf2(result, T1), true);
- expect(typeSystem.isSubtypeOf2(result, T2), true);
+ expect(typeSystem.isSubtypeOf(result, T1), true);
+ expect(typeSystem.isSubtypeOf(result, T2), true);
}
// Check for symmetry.
@@ -3423,28 +3422,26 @@
}
void _checkLeastUpperBound(DartType T1, DartType T2, DartType expected) {
- NullSafetyUnderstandingFlag.enableNullSafetyTypes(() async {
- var expectedStr = _typeString(expected);
+ var expectedStr = _typeString(expected);
- var result = typeSystem.getLeastUpperBound(T1, T2);
- var resultStr = _typeString(result);
- expect(result, expected, reason: '''
+ var result = typeSystem.getLeastUpperBound(T1, T2);
+ var resultStr = _typeString(result);
+ expect(result, expected, reason: '''
expected: $expectedStr
actual: $resultStr
''');
- // Check that the result is an upper bound.
- expect(typeSystem.isSubtypeOf2(T1, result), true);
- expect(typeSystem.isSubtypeOf2(T2, result), true);
+ // Check that the result is an upper bound.
+ expect(typeSystem.isSubtypeOf(T1, result), true);
+ expect(typeSystem.isSubtypeOf(T2, result), true);
- // Check for symmetry.
- result = typeSystem.getLeastUpperBound(T2, T1);
- resultStr = _typeString(result);
- expect(result, expected, reason: '''
+ // Check for symmetry.
+ result = typeSystem.getLeastUpperBound(T2, T1);
+ resultStr = _typeString(result);
+ expect(result, expected, reason: '''
expected: $expectedStr
actual: $resultStr
''');
- });
}
String _typeParametersStr(DartType type) {
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index 28d8657..b842d4b 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -502,6 +502,13 @@
);
}
+ test_part_notInLibrary_libraryDoesNotExist() async {
+ // TODO(scheglov) Should report CompileTimeErrorCode.URI_DOES_NOT_EXIST
+ await assertNoErrorsInCode(r'''
+part of 'a.dart';
+''');
+ }
+
test_resolve_part_of() async {
newFile('/workspace/dart/test/lib/a.dart', content: r'''
part 'test.dart';
diff --git a/pkg/analyzer/test/src/dart/resolution/field_test.dart b/pkg/analyzer/test/src/dart/resolution/field_test.dart
index c8120a0..431a369 100644
--- a/pkg/analyzer/test/src/dart/resolution/field_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/field_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/error/hint_codes.dart';
+import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'context_collection_resolution.dart';
@@ -16,6 +17,19 @@
@reflectiveTest
class FieldTest extends PubPackageResolutionTest {
+ test_session_getterSetter() async {
+ await resolveTestCode('''
+class A {
+ var f = 0;
+}
+''');
+ var getter = findElement.getter('f');
+ expect(getter.session, result.session);
+
+ var setter = findElement.setter('f');
+ expect(setter.session, result.session);
+ }
+
test_type_inferred_int() async {
await resolveTestCode('''
class A {
diff --git a/pkg/analyzer/test/src/dart/resolution/top_level_variable_test.dart b/pkg/analyzer/test/src/dart/resolution/top_level_variable_test.dart
index fd045d0..60e2338 100644
--- a/pkg/analyzer/test/src/dart/resolution/top_level_variable_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/top_level_variable_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/error/hint_codes.dart';
+import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'context_collection_resolution.dart';
@@ -16,6 +17,17 @@
@reflectiveTest
class TopLevelVariableTest extends PubPackageResolutionTest {
+ test_session_getterSetter() async {
+ await resolveTestCode('''
+var v = 0;
+''');
+ var getter = findElement.topGet('v');
+ expect(getter.session, result.session);
+
+ var setter = findElement.topSet('v');
+ expect(setter.session, result.session);
+ }
+
test_type_inferred_int() async {
await resolveTestCode('''
var v = 0;
diff --git a/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart b/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart
index cb20c6d..fe447bc 100644
--- a/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart
@@ -19,6 +19,27 @@
@reflectiveTest
class AmbiguousImportTest extends PubPackageResolutionTest {
+ test_annotation_getter() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+const foo = 0;
+''');
+
+ newFile('$testPackageLibPath/b.dart', content: r'''
+const foo = 0;
+''');
+
+ await assertErrorsInCode(r'''
+import 'a.dart';
+import 'b.dart';
+
+@foo
+class A {}
+''', [
+ error(CompileTimeErrorCode.INVALID_ANNOTATION, 35, 4),
+ error(CompileTimeErrorCode.AMBIGUOUS_IMPORT, 36, 3),
+ ]);
+ }
+
test_as() async {
newFile("$testPackageLibPath/lib1.dart", content: '''
library lib1;
diff --git a/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart b/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart
index b94d780..9df668f 100644
--- a/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart
@@ -72,6 +72,6 @@
T genericRef<T extends Struct>(Pointer<T> p) =>
p.ref;
-''', [error(FfiCode.NON_CONSTANT_TYPE_ARGUMENT_WARNING, 72, 5)]);
+''', [error(FfiCode.NON_CONSTANT_TYPE_ARGUMENT, 72, 5)]);
}
}
diff --git a/pkg/analyzer/test/src/lint/lint_rule_test.dart b/pkg/analyzer/test/src/lint/lint_rule_test.dart
index c6a04fb..5db743a 100644
--- a/pkg/analyzer/test/src/lint/lint_rule_test.dart
+++ b/pkg/analyzer/test/src/lint/lint_rule_test.dart
@@ -5,6 +5,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
@@ -80,7 +81,7 @@
@override
void reportErrorForNode(ErrorCode errorCode, AstNode node,
- [List<Object?>? arguments]) {
+ [List<Object?>? arguments, List<DiagnosticMessage>? messages]) {
code = errorCode;
}
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
index 7dd1655..e8bce34 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
@@ -6,7 +6,6 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/src/context/context.dart';
import 'package:analyzer/src/dart/analysis/session.dart';
import 'package:analyzer/src/dart/element/class_hierarchy.dart';
@@ -103,11 +102,7 @@
),
);
- var linkResult = NullSafetyUnderstandingFlag.enableNullSafetyTypes(
- () {
- return link(elementFactory, inputLibraries, true);
- },
- );
+ var linkResult = link(elementFactory, inputLibraries, true);
elementFactory.addBundle(
BundleReader(
diff --git a/pkg/analyzer/test/src/workspace/bazel_test.dart b/pkg/analyzer/test/src/workspace/bazel_test.dart
index 00f80db..07dee14 100644
--- a/pkg/analyzer/test/src/workspace/bazel_test.dart
+++ b/pkg/analyzer/test/src/workspace/bazel_test.dart
@@ -676,6 +676,23 @@
expect(package, isNull);
}
+ void test_findPackageFor_noBuildFile_disabledPackagesFile() {
+ _addResources([
+ '/ws/blaze-out/host/bin/some/code/code.packages',
+ '/ws/some/code/lib/code.dart',
+ ]);
+ workspace = BazelWorkspace.find(
+ resourceProvider,
+ convertPath('/ws/some/code'),
+ lookForBuildFileSubstitutes: false,
+ )!;
+
+ package = workspace.findPackageFor(
+ convertPath('/ws/some/code/lib/code.dart'),
+ );
+ expect(package, isNull);
+ }
+
void test_findPackageFor_packagesFileExistsInOneOfSeveralBinPaths() {
_addResources([
'/ws/blaze-out/host/bin/some/code/code.packages',
diff --git a/pkg/analyzer/test/src/workspace/gn_test.dart b/pkg/analyzer/test/src/workspace/gn_test.dart
index 9441a01..d25eb2a 100644
--- a/pkg/analyzer/test/src/workspace/gn_test.dart
+++ b/pkg/analyzer/test/src/workspace/gn_test.dart
@@ -163,8 +163,8 @@
newFile('/workspace/.fx-build-dir', content: '$buildDir\n');
newFile(
'/workspace/out/debug-x87_128/dartlang/gen/some/code/foo_package_config.json');
- var workspace =
- GnWorkspace.find(resourceProvider, convertPath('/workspace/some/code'))!;
+ var workspace = GnWorkspace.find(
+ resourceProvider, convertPath('/workspace/some/code'))!;
expect(workspace.root, convertPath('/workspace'));
}
@@ -189,8 +189,8 @@
}
]
}''');
- var workspace =
- GnWorkspace.find(resourceProvider, convertPath('/workspace/some/code'))!;
+ var workspace = GnWorkspace.find(
+ resourceProvider, convertPath('/workspace/some/code'))!;
expect(workspace.root, convertPath('/workspace'));
expect(workspace.packageMap.length, 1);
expect(workspace.packageMap['flutter']![0].path,
@@ -218,8 +218,8 @@
}
]
}''');
- var workspace =
- GnWorkspace.find(resourceProvider, convertPath('/workspace/some/code'))!;
+ var workspace = GnWorkspace.find(
+ resourceProvider, convertPath('/workspace/some/code'))!;
expect(workspace.root, convertPath('/workspace'));
expect(workspace.packageMap.length, 1);
expect(workspace.packageMap['flutter']![0].path,
@@ -245,8 +245,8 @@
}
]
}''');
- var workspace =
- GnWorkspace.find(resourceProvider, convertPath('/workspace/some/code'))!;
+ var workspace = GnWorkspace.find(
+ resourceProvider, convertPath('/workspace/some/code'))!;
expect(workspace.root, convertPath('/workspace'));
expect(workspace.packageMap.length, 1);
expect(workspace.packageMap['flutter']![0].path,
@@ -273,8 +273,8 @@
}
]
}''');
- var workspace =
- GnWorkspace.find(resourceProvider, convertPath('/workspace/some/code'))!;
+ var workspace = GnWorkspace.find(
+ resourceProvider, convertPath('/workspace/some/code'))!;
expect(workspace.root, convertPath('/workspace'));
expect(workspace.packageMap.length, 1);
expect(workspace.packageMap['flutter']![0].path,
@@ -318,8 +318,8 @@
}
]
}''');
- var workspace =
- GnWorkspace.find(resourceProvider, convertPath('/workspace/some/code'))!;
+ var workspace = GnWorkspace.find(
+ resourceProvider, convertPath('/workspace/some/code'))!;
expect(workspace.root, convertPath('/workspace'));
expect(workspace.packageMap.length, 1);
expect(workspace.packageMap['rettulf']![0].path,
@@ -363,8 +363,8 @@
}
]
}''');
- var workspace =
- GnWorkspace.find(resourceProvider, convertPath('/workspace/some/code'))!;
+ var workspace = GnWorkspace.find(
+ resourceProvider, convertPath('/workspace/some/code'))!;
expect(workspace.root, convertPath('/workspace'));
expect(workspace.packageMap.length, 2);
expect(workspace.packageMap['flutter']![0].path,
diff --git a/pkg/analyzer/tool/experiments/generate.dart b/pkg/analyzer/tool/experiments/generate.dart
index 5fc75f1..f57961d 100644
--- a/pkg/analyzer/tool/experiments/generate.dart
+++ b/pkg/analyzer/tool/experiments/generate.dart
@@ -210,7 +210,7 @@
for (var key in keysSorted) {
var entry = features[key] as YamlMap;
bool shipped = entry['enabledIn'] != null;
- bool expired = entry['expired'];
+ bool? expired = entry['expired'];
out.write('''
/// Expiration status of the experiment "$key"
static const bool ${keyToIdentifier(key)} = ${expired == true};
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart
index 80b9579..17946b6 100644
--- a/pkg/analyzer/tool/messages/generate.dart
+++ b/pkg/analyzer/tool/messages/generate.dart
@@ -199,7 +199,7 @@
}
throw shouldRunFastaGenerateMessagesFirst;
}
- out.writeln('final fastaAnalyzerErrorCodes = <ErrorCode>[null,');
+ out.writeln('final fastaAnalyzerErrorCodes = <ErrorCode?>[null,');
for (var entry in sorted) {
List<String> name = nameForEntry(entry);
out.writeln('_${name[1]},');
diff --git a/pkg/analyzer/tool/update_id_tests.dart b/pkg/analyzer/tool/update_id_tests.dart
index 4f7a5d6..44a9384 100644
--- a/pkg/analyzer/tool/update_id_tests.dart
+++ b/pkg/analyzer/tool/update_id_tests.dart
@@ -17,4 +17,5 @@
'pkg/analyzer/test/id_tests/nullability_test.dart',
'pkg/analyzer/test/id_tests/reachability_test.dart',
'pkg/analyzer/test/id_tests/type_promotion_test.dart',
+ 'pkg/analyzer/test/id_tests/why_not_promoted_test.dart',
];
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index ae898a3..38e856c 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -14,7 +14,6 @@
import 'inferrer/abstract_value_domain.dart';
import 'js_backend/native_data.dart' show NativeBasicData;
import 'js_model/locals.dart';
-import 'kernel/dart2js_target.dart';
import 'universe/selector.dart' show Selector;
/// The common elements and types in Dart.
@@ -572,15 +571,6 @@
ClassEntity get metaNoInlineClass;
ClassEntity get metaTryInlineClass;
-
- /// Returns `true` if [function] is allowed to be external.
- ///
- /// This returns `true` for foreign helpers, from environment constructors and
- /// members of libraries that support native.
- ///
- /// This returns `false` for JS interop members which therefore must be
- /// allowed to be external through the JS interop annotation handling.
- bool isExternalAllowed(FunctionEntity function);
}
abstract class JCommonElements implements CommonElements {
@@ -2152,17 +2142,6 @@
}
@override
- bool isExternalAllowed(FunctionEntity function) {
- return isForeignHelper(function) ||
- (function is ConstructorEntity &&
- function.isFromEnvironmentConstructor) ||
- maybeEnableNative(function.library.canonicalUri) ||
- // TODO(johnniwinther): Remove this when importing dart:mirrors is
- // a compile-time error.
- function.library.canonicalUri == Uris.dart_mirrors;
- }
-
- @override
bool operatorEqHandlesNullArgument(FunctionEntity function) {
assert(function.name == '==',
failedAt(function, "Unexpected function $function."));
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index a0be968..ae4793a 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -527,10 +527,10 @@
MessageKind.NON_NATIVE_EXTERNAL: const MessageTemplate(
MessageKind.NON_NATIVE_EXTERNAL,
- "Only external js-interop functions are supported.",
+ "Non-native external members must be js-interop.",
howToFix:
- "Try removing 'external' keyword or annotating the function "
- "as a js-interop function."),
+ "Try removing the 'external' keyword, making it 'native', or "
+ "annotating the function as a js-interop function."),
MessageKind.NATIVE_NON_INSTANCE_IN_NON_NATIVE_CLASS: const MessageTemplate(
MessageKind.NATIVE_NON_INSTANCE_IN_NON_NATIVE_CLASS,
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index fe5ce5f..f5f74d3 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -2084,6 +2084,8 @@
assert(annotationData != null);
if (!maybeEnableNative(node.enclosingLibrary.importUri)) return false;
bool hasNativeBody = annotationData.hasNativeBody(node);
+ // TODO(rileyporter): Move this check on non-native external usage to
+ // js_interop_checks when `native` and `external` can be disambiguated.
if (!hasNativeBody &&
node.isExternal &&
!_nativeBasicData.isJsInteropMember(_elementMap.getMember(node))) {
diff --git a/pkg/compiler/lib/src/kernel/native_basic_data.dart b/pkg/compiler/lib/src/kernel/native_basic_data.dart
index 0b83ce2..d030007 100644
--- a/pkg/compiler/lib/src/kernel/native_basic_data.dart
+++ b/pkg/compiler/lib/src/kernel/native_basic_data.dart
@@ -49,9 +49,9 @@
@override
void extractJsInteropAnnotations(LibraryEntity library) {
- DiagnosticReporter reporter = elementMap.reporter;
+ // Unused reporter, add back in if uncommenting report lines down below.
+ // DiagnosticReporter reporter = elementMap.reporter;
KElementEnvironment elementEnvironment = elementMap.elementEnvironment;
- KCommonElements commonElements = elementMap.commonElements;
ir.Library libraryNode = elementMap.getLibraryNode(library);
String libraryName = annotationData.getJsInteropLibraryName(libraryNode);
@@ -85,10 +85,6 @@
// implicitly js-interop. For now we allow it.
isJsLibrary = true;
}
- } else if (function.isExternal &&
- !commonElements.isExternalAllowed(function)) {
- reporter.reportErrorMessage(
- function, MessageKind.NON_NATIVE_EXTERNAL);
}
}
});
@@ -144,29 +140,10 @@
}
});
} else {
- elementEnvironment.forEachLocalClassMember(cls, (MemberEntity member) {
- String memberName = getJsInteropName(
- library, elementEnvironment.getMemberMetadata(member));
- if (memberName == null && member is FunctionEntity) {
- if (member.isExternal &&
- !commonElements.isExternalAllowed(member)) {
- reporter.reportErrorMessage(
- member, MessageKind.NON_NATIVE_EXTERNAL);
- }
- }
- });
- elementEnvironment.forEachConstructor(cls,
- (ConstructorEntity constructor) {
- String memberName = getJsInteropName(
- library, elementEnvironment.getMemberMetadata(constructor));
- if (memberName == null) {
- if (constructor.isExternal &&
- !commonElements.isExternalAllowed(constructor)) {
- reporter.reportErrorMessage(
- constructor, MessageKind.NON_NATIVE_EXTERNAL);
- }
- }
- });
+ // TODO(44754): For now, this call is required to correctly load
+ // the environment for some of the tests in the _2 directories.
+ elementEnvironment.forEachConstructor(
+ cls, (ConstructorEntity constructor) {});
}
});
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index d0363bb..c2ff740 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -5,10 +5,13 @@
// @dart = 2.9
import 'dart:core' hide MapEntry;
+import 'dart:core' as core;
+import 'package:_fe_analyzer_shared/src/flow_analysis/flow_analysis.dart';
import 'package:_fe_analyzer_shared/src/util/link.dart';
import 'package:front_end/src/api_prototype/lowering_predicates.dart';
-import 'package:kernel/ast.dart';
+import 'package:kernel/ast.dart'
+ hide Reference; // Work around https://github.com/dart-lang/sdk/issues/44667
import 'package:kernel/src/legacy_erasure.dart';
import 'package:kernel/type_algebra.dart' show Substitution;
import 'package:kernel/type_environment.dart';
@@ -4738,12 +4741,31 @@
readResult ??= new ExpressionInferenceResult(readType, read);
if (!inferrer.isTopLevel && readTarget.isNullable) {
+ Map<DartType, NonPromotionReason> whyNotPromoted =
+ inferrer.flowAnalysis?.whyNotPromoted(receiver);
+ List<LocatedMessage> context;
+ if (whyNotPromoted != null && whyNotPromoted.isNotEmpty) {
+ _WhyNotPromotedVisitor whyNotPromotedVisitor =
+ new _WhyNotPromotedVisitor(inferrer);
+ for (core.MapEntry<DartType, NonPromotionReason> entry
+ in whyNotPromoted.entries) {
+ if (entry.key.isPotentiallyNullable) continue;
+ if (inferrer.dataForTesting != null) {
+ inferrer.dataForTesting.flowAnalysisResult
+ .nonPromotionReasons[read] = entry.value.shortName;
+ }
+ LocatedMessage message = entry.value.accept(whyNotPromotedVisitor);
+ context = [message];
+ break;
+ }
+ }
readResult = inferrer.wrapExpressionInferenceResultInProblem(
readResult,
templateNullablePropertyAccessError.withArguments(
propertyName.text, receiverType, inferrer.isNonNullableByDefault),
read.fileOffset,
- propertyName.text.length);
+ propertyName.text.length,
+ context: context);
}
return readResult;
}
@@ -5709,8 +5731,13 @@
ExpressionInferenceResult readResult = _computePropertyGet(
node.fileOffset, receiver, receiverType, node.name, typeContext,
isThisReceiver: node.receiver is ThisExpression);
- return inferrer.createNullAwareExpressionInferenceResult(
- readResult.inferredType, readResult.expression, nullAwareGuards);
+ inferrer.flowAnalysis.propertyGet(node, node.receiver, node.name.name);
+ ExpressionInferenceResult expressionInferenceResult =
+ inferrer.createNullAwareExpressionInferenceResult(
+ readResult.inferredType, readResult.expression, nullAwareGuards);
+ inferrer.flowAnalysis
+ .forwardExpression(expressionInferenceResult.nullAwareAction, node);
+ return expressionInferenceResult;
}
@override
@@ -5973,6 +6000,7 @@
@override
ExpressionInferenceResult visitSuperPropertyGet(
SuperPropertyGet node, DartType typeContext) {
+ inferrer.flowAnalysis.thisOrSuperPropertyGet(node, node.name.name);
if (node.interfaceTarget != null) {
inferrer.instrumentation?.record(
inferrer.uriForInstrumentation,
@@ -6160,6 +6188,7 @@
ExpressionInferenceResult visitThisExpression(
ThisExpression node, DartType typeContext) {
+ inferrer.flowAnalysis.thisOrSuper(node);
return new ExpressionInferenceResult(inferrer.thisType, node);
}
@@ -6280,7 +6309,7 @@
fileOffset: node.fileOffset,
isVoidAllowed: declaredOrInferredType is VoidType);
inferrer.flowAnalysis
- .write(variable, rhsResult.inferredType, rhsResult.expression);
+ .write(node, variable, rhsResult.inferredType, rhsResult.expression);
DartType resultType = rhsResult.inferredType;
Expression resultExpression;
if (variable.lateSetter != null) {
@@ -6956,6 +6985,44 @@
}
}
+class _WhyNotPromotedVisitor
+ implements
+ NonPromotionReasonVisitor<LocatedMessage, Node, Expression,
+ VariableDeclaration> {
+ final TypeInferrerImpl inferrer;
+
+ _WhyNotPromotedVisitor(this.inferrer);
+
+ @override
+ LocatedMessage visitDemoteViaExplicitWrite(
+ DemoteViaExplicitWrite<VariableDeclaration, Expression> reason) {
+ if (inferrer.dataForTesting != null) {
+ inferrer.dataForTesting.flowAnalysisResult
+ .nonPromotionReasonTargets[reason.writeExpression] = reason.shortName;
+ }
+ int offset = reason.writeExpression.fileOffset;
+ return templateVariableCouldBeNullDueToWrite
+ .withArguments(reason.variable.name)
+ .withLocation(inferrer.helper.uri, offset, noLength);
+ }
+
+ @override
+ LocatedMessage visitDemoteViaForEachVariableWrite(
+ DemoteViaForEachVariableWrite<VariableDeclaration, Node> reason) {
+ int offset = (reason.node as TreeNode).fileOffset;
+ return templateVariableCouldBeNullDueToWrite
+ .withArguments(reason.variable.name)
+ .withLocation(inferrer.helper.uri, offset, noLength);
+ }
+
+ @override
+ LocatedMessage visitFieldNotPromoted(FieldNotPromoted reason) {
+ return templateFieldNotPromoted
+ .withArguments(reason.propertyName)
+ .withoutLocation();
+ }
+}
+
class ForInResult {
final VariableDeclaration variable;
final Expression iterable;
@@ -7005,7 +7072,8 @@
isVoidAllowed: true);
variableSet.value = rhs..parent = variableSet;
- inferrer.flowAnalysis.write(variableSet.variable, rhsType, null);
+ inferrer.flowAnalysis
+ .write(variableSet, variableSet.variable, rhsType, null);
return variableSet;
}
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index 9d674c0..f2cb2c4 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -257,6 +257,14 @@
/// The assigned variables information that computed for the member.
AssignedVariablesForTesting<TreeNode, VariableDeclaration> assignedVariables;
+
+ /// For each expression that led to an error because it was not promoted, a
+ /// string describing the reason it was not promoted.
+ final Map<TreeNode, String> nonPromotionReasons = {};
+
+ /// For each auxiliary AST node pointed to by a non-promotion reason, a string
+ /// describing the non-promotion reason pointing to it.
+ final Map<TreeNode, String> nonPromotionReasonTargets = {};
}
/// CFE-specific implementation of [TypeOperations].
@@ -266,6 +274,9 @@
TypeOperationsCfe(this.typeEnvironment);
@override
+ DartType get topType => typeEnvironment.objectNullableRawType;
+
+ @override
TypeClassification classifyType(DartType type) {
if (type == null) {
// Note: this can happen during top-level inference.
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 0b50fbb..cfdc40c 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
@@ -1784,7 +1784,8 @@
return createNullAwareExpressionInferenceResult(
result.inferredType,
helper.wrapInProblem(
- result.nullAwareAction, message, fileOffset, length),
+ result.nullAwareAction, message, fileOffset, length,
+ context: context),
result.nullAwareGuards);
}
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 245cd2d..2eeae7a 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -344,6 +344,8 @@
FieldNonNullableWithoutInitializerError/example: Fail
FieldNonNullableWithoutInitializerWarning/analyzerCode: Fail
FieldNonNullableWithoutInitializerWarning/example: Fail
+FieldNotPromoted/analyzerCode: Fail
+FieldNotPromoted/example: Fail
FinalAndCovariant/part_wrapped_script2: Fail
FinalAndCovariant/script2: Fail
FinalFieldWithoutInitializer/example: Fail
@@ -484,6 +486,8 @@
JsInteropDartClassExtendsJSClass/example: Fail # Web compiler specific
JsInteropEnclosingClassJSAnnotation/analyzerCode: Fail # Web compiler specific
JsInteropEnclosingClassJSAnnotation/example: Fail # Web compiler specific
+JsInteropExternalMemberNotJSAnnotated/analyzerCode: Fail # Web compiler specific
+JsInteropExternalMemberNotJSAnnotated/example: Fail # Web compiler specific
JsInteropIndexNotSupported/analyzerCode: Fail # Web compiler specific
JsInteropIndexNotSupported/example: Fail # Web compiler specific
JsInteropJSClassExtendsDartClass/analyzerCode: Fail # Web compiler specific
@@ -793,6 +797,8 @@
ValueForRequiredParameterNotProvidedWarning/example: Fail
VarAsTypeName/part_wrapped_script1: Fail
VarAsTypeName/script1: Fail # Too many problems
+VariableCouldBeNullDueToWrite/analyzerCode: Fail
+VariableCouldBeNullDueToWrite/example: Fail
WeakWithStrongDillLibrary/analyzerCode: Fail
WeakWithStrongDillLibrary/example: Fail
WebLiteralCannotBeRepresentedExactly/analyzerCode: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 2e197e9..aa9fe7d 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -4584,6 +4584,13 @@
tip: "Use at most one of the 'in', 'out', or 'inout' modifiers."
analyzerCode: ParserErrorCode.MULTIPLE_VARIANCE_MODIFIERS
+VariableCouldBeNullDueToWrite:
+ template: "Variable '#name' could be null due to a write occurring here."
+ tip: "Try null checking the variable after the write."
+
+FieldNotPromoted:
+ template: "'#name' refers to a property so it could not be promoted."
+
NullablePropertyAccessError:
template: "Property '#name' cannot be accessed on '#type' because it is potentially null."
tip: "Try accessing using ?. instead."
@@ -4669,6 +4676,10 @@
template: "This is the enclosing class."
severity: CONTEXT
+JsInteropExternalMemberNotJSAnnotated:
+ template: "Only JS interop members may be 'external'."
+ tip: "Try removing the 'external' keyword or adding a JS interop annotation."
+
JsInteropIndexNotSupported:
template: "JS interop classes do not support [] and []= operator methods."
tip: "Try replacing with a normal method."
diff --git a/pkg/front_end/test/id_tests/why_not_promoted_test.dart b/pkg/front_end/test/id_tests/why_not_promoted_test.dart
new file mode 100644
index 0000000..0b0b6ee
--- /dev/null
+++ b/pkg/front_end/test/id_tests/why_not_promoted_test.dart
@@ -0,0 +1,93 @@
+// Copyright (c) 2020, 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
+
+import 'dart:io' show Directory, Platform;
+
+import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
+import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
+ show DataInterpreter, runTests;
+import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
+import 'package:front_end/src/fasta/builder/member_builder.dart';
+import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart';
+import 'package:front_end/src/testing/id_testing_helper.dart';
+import 'package:front_end/src/testing/id_testing_utils.dart';
+import 'package:kernel/ast.dart' hide Variance, MapEntry;
+
+main(List<String> args) async {
+ Directory dataDir = new Directory.fromUri(
+ Platform.script.resolve('../../../_fe_analyzer_shared/test/flow_analysis/'
+ 'why_not_promoted/data'));
+ await runTests<String>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest: runTestFor(
+ const WhyNotPromotedDataComputer(), [cfeNonNullableOnlyConfig]));
+}
+
+class WhyNotPromotedDataComputer extends DataComputer<String> {
+ const WhyNotPromotedDataComputer();
+
+ @override
+ DataInterpreter<String> get dataValidator =>
+ const _WhyNotPromotedDataInterpreter();
+
+ /// Errors are supported for testing erroneous code. The reported errors are
+ /// not tested.
+ @override
+ bool get supportsErrors => true;
+
+ /// Function that computes a data mapping for [member].
+ ///
+ /// Fills [actualMap] with the data.
+ void computeMemberData(
+ TestConfig config,
+ InternalCompilerResult compilerResult,
+ Member member,
+ Map<Id, ActualData<String>> actualMap,
+ {bool verbose}) {
+ MemberBuilderImpl memberBuilder =
+ lookupMemberBuilder(compilerResult, member);
+ member.accept(new WhyNotPromotedDataExtractor(compilerResult, actualMap,
+ memberBuilder.dataForTesting.inferenceData.flowAnalysisResult));
+ }
+}
+
+class WhyNotPromotedDataExtractor extends CfeDataExtractor<String> {
+ final FlowAnalysisResult _flowResult;
+
+ WhyNotPromotedDataExtractor(InternalCompilerResult compilerResult,
+ Map<Id, ActualData<String>> actualMap, this._flowResult)
+ : super(compilerResult, actualMap);
+
+ @override
+ String computeNodeValue(Id id, TreeNode node) {
+ String nonPromotionReason = _flowResult.nonPromotionReasons[node];
+ if (nonPromotionReason != null) {
+ return 'notPromoted($nonPromotionReason)';
+ }
+ return _flowResult.nonPromotionReasonTargets[node];
+ }
+}
+
+class _WhyNotPromotedDataInterpreter implements DataInterpreter<String> {
+ const _WhyNotPromotedDataInterpreter();
+
+ @override
+ String getText(String actualData, [String indentation]) => actualData;
+
+ @override
+ String isAsExpected(String actualData, String expectedData) {
+ if (actualData == expectedData) {
+ return null;
+ } else {
+ return 'Expected $expectedData, got $actualData';
+ }
+ }
+
+ @override
+ bool isEmpty(String actualData) => actualData == null;
+}
diff --git a/pkg/front_end/test/lint_test.status b/pkg/front_end/test/lint_test.status
index 2728954..aaa6e98 100644
--- a/pkg/front_end/test/lint_test.status
+++ b/pkg/front_end/test/lint_test.status
@@ -20,6 +20,7 @@
front_end/lib/src/fasta/kernel/body_builder/ImportsTwice: Fail
front_end/lib/src/fasta/kernel/constant_evaluator/ExplicitType: Pass
front_end/lib/src/fasta/kernel/expression_generator_helper/ImportsTwice: Fail
+front_end/lib/src/fasta/kernel/inference_visitor/ImportsTwice: Fail
front_end/lib/src/fasta/kernel/kernel_api/Exports: Fail
front_end/lib/src/fasta/kernel/kernel_ast_api/Exports: Fail
front_end/lib/src/fasta/kernel/kernel_builder/Exports: Fail
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index 572493d..92adf25 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -498,6 +498,7 @@
hacky
hadn't
hang
+happy
hardcode
harness
hashes
@@ -847,6 +848,7 @@
plugin
pm
pn
+pointed
pointwise
polluted
pool
diff --git a/pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.weak.transformed.expect b/pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.weak.transformed.expect
index c53e92f..94630fc 100644
--- a/pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.weak.transformed.expect
@@ -21,7 +21,7 @@
: super ffi::Struct::_fromPointer(#pointer)
;
static factory allocate(ffi::Allocator* allocator, core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
- return let final self::Coordinate* #t1 = ffi::StructPointer|get#ref<self::Coordinate*>(ffi::AllocatorAlloc|call<self::Coordinate*>(allocator)) in block {
+ return let final self::Coordinate* #t1 = new self::Coordinate::#fromTypedDataBase(allocator.{ffi::Allocator::allocate}<self::Coordinate*>(self::Coordinate::#sizeOf)!) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
index ac239e8..79439bc 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
@@ -37,7 +37,7 @@
set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void
return ffi::_storeIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi()), #externalFieldValue.{ffi::Pointer::address});
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
- return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(ffi::AllocatorAlloc|call<self::Coordinate>(allocator)) in block {
+ return let final self::Coordinate #t1 = new self::Coordinate::#fromTypedDataBase(allocator.{ffi::Allocator::allocate}<self::Coordinate>(self::Coordinate::#sizeOf)!) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
index ac239e8..79439bc 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
@@ -37,7 +37,7 @@
set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void
return ffi::_storeIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi()), #externalFieldValue.{ffi::Pointer::address});
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
- return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(ffi::AllocatorAlloc|call<self::Coordinate>(allocator)) in block {
+ return let final self::Coordinate #t1 = new self::Coordinate::#fromTypedDataBase(allocator.{ffi::Allocator::allocate}<self::Coordinate>(self::Coordinate::#sizeOf)!) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
diff --git a/pkg/front_end/tool/update_all.dart b/pkg/front_end/tool/update_all.dart
index 41ba6a1..c25162c 100644
--- a/pkg/front_end/tool/update_all.dart
+++ b/pkg/front_end/tool/update_all.dart
@@ -19,6 +19,7 @@
'pkg/front_end/test/id_tests/nullability_test.dart',
'pkg/front_end/test/id_tests/reachability_test.dart',
'pkg/front_end/test/id_tests/type_promotion_test.dart',
+ 'pkg/front_end/test/id_tests/why_not_promoted_test.dart',
'pkg/front_end/test/language_versioning/language_versioning_test.dart',
'pkg/front_end/test/patching/patching_test.dart',
'pkg/front_end/test/static_types/static_type_test.dart',
diff --git a/pkg/js/CHANGELOG.md b/pkg/js/CHANGELOG.md
index 17e9aa3..571726d 100644
--- a/pkg/js/CHANGELOG.md
+++ b/pkg/js/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.6.3
+
+* Stable release for null safety.
+
## 0.6.3-nullsafety.3
* Update SDK constraints to `>=2.12.0-0 <3.0.0` based on beta release
diff --git a/pkg/js/pubspec.yaml b/pkg/js/pubspec.yaml
index 90d0352..44b80a9 100644
--- a/pkg/js/pubspec.yaml
+++ b/pkg/js/pubspec.yaml
@@ -1,5 +1,5 @@
name: js
-version: 0.6.3-nullsafety.3
+version: 0.6.3
description: Annotations to create static Dart interfaces for JavaScript APIs.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/js
diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md
index e56752f..752be0d5 100644
--- a/pkg/meta/CHANGELOG.md
+++ b/pkg/meta/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.3.0
+
+* Stable release for null safety.
+
## 1.3.0-nullsafety.6
* Update SDK constraints to `>=2.12.0-0 <3.0.0` based on beta release
diff --git a/pkg/meta/pubspec.yaml b/pkg/meta/pubspec.yaml
index 835f447..efe6370 100644
--- a/pkg/meta/pubspec.yaml
+++ b/pkg/meta/pubspec.yaml
@@ -1,5 +1,5 @@
name: meta
-version: 1.3.0-nullsafety.6
+version: 1.3.0
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/meta
description: >
This library contains the declarations of annotations that developers can use
diff --git a/pkg/nnbd_migration/lib/src/decorated_type_operations.dart b/pkg/nnbd_migration/lib/src/decorated_type_operations.dart
index 4c776c8..0f9328a 100644
--- a/pkg/nnbd_migration/lib/src/decorated_type_operations.dart
+++ b/pkg/nnbd_migration/lib/src/decorated_type_operations.dart
@@ -21,6 +21,14 @@
this._typeSystem, this._variableRepository, this._graph);
@override
+ DecoratedType get topType {
+ // This is only needed for explaining to the user why fields aren't
+ // promoted, functionality of flow analysis that we don't take advantage of
+ // during migration. So this method should never be called.
+ throw StateError('Unexpected call to topType');
+ }
+
+ @override
TypeClassification classifyType(DecoratedType type) {
if (type.type.isDartCoreNull) {
return TypeClassification.nullOrEquivalent;
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index c074a4a..8138239 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -407,7 +407,7 @@
}
var expressionType = _handleAssignment(node.rightHandSide,
- destinationExpression: node.leftHandSide,
+ assignmentExpression: node,
compoundOperatorInfo: isCompound ? node : null,
questionAssignNode: isQuestionAssign ? node : null,
sourceIsSetupCall: sourceIsSetupCall);
@@ -1387,7 +1387,7 @@
if (operand is SimpleIdentifier) {
var element = getWriteOrReadElement(operand);
if (element is PromotableElement) {
- _flowAnalysis.write(element, writeType, null);
+ _flowAnalysis.write(node, element, writeType, null);
}
}
return targetType;
@@ -1438,7 +1438,7 @@
if (operand is SimpleIdentifier) {
var element = getWriteOrReadElement(operand);
if (element is PromotableElement) {
- _flowAnalysis.write(element, staticType, null);
+ _flowAnalysis.write(node, element, staticType, null);
}
}
}
@@ -2285,26 +2285,28 @@
/// Creates the necessary constraint(s) for an assignment of the given
/// [expression] to a destination whose type is [destinationType].
///
- /// Optionally, the caller may supply a [destinationExpression] instead of
+ /// Optionally, the caller may supply an [assignmentExpression] instead of
/// [destinationType]. In this case, then the type comes from visiting the
- /// destination expression. If the destination expression refers to a local
- /// variable, we mark it as assigned in flow analysis at the proper time.
+ /// LHS of the assignment expression. If the LHS of the assignment expression
+ /// refers to a local variable, we mark it as assigned in flow analysis at the
+ /// proper time.
///
/// Set [wrapFuture] to true to handle assigning Future<flatten(T)> to R.
DecoratedType _handleAssignment(Expression expression,
{DecoratedType destinationType,
- Expression destinationExpression,
+ AssignmentExpression assignmentExpression,
AssignmentExpression compoundOperatorInfo,
AssignmentExpression questionAssignNode,
bool fromDefaultValue = false,
bool wrapFuture = false,
bool sourceIsSetupCall = false}) {
assert(
- (destinationExpression == null) != (destinationType == null),
- 'Either destinationExpression or destinationType should be supplied, '
+ (assignmentExpression == null) != (destinationType == null),
+ 'Either assignmentExpression or destinationType should be supplied, '
'but not both');
PromotableElement destinationLocalVariable;
if (destinationType == null) {
+ var destinationExpression = assignmentExpression.leftHandSide;
if (destinationExpression is SimpleIdentifier) {
var element = getWriteOrReadElement(destinationExpression);
if (element is PromotableElement) {
@@ -2345,7 +2347,7 @@
source: destinationType,
destination: _createNonNullableType(compoundOperatorInfo),
hard: _postDominatedLocals
- .isReferenceInScope(destinationExpression));
+ .isReferenceInScope(assignmentExpression.leftHandSide));
DecoratedType compoundOperatorType = getOrComputeElementType(
compoundOperatorMethod,
targetType: destinationType);
@@ -2403,8 +2405,8 @@
}
}
if (destinationLocalVariable != null) {
- _flowAnalysis.write(destinationLocalVariable, sourceType,
- compoundOperatorInfo == null ? expression : null);
+ _flowAnalysis.write(assignmentExpression, destinationLocalVariable,
+ sourceType, compoundOperatorInfo == null ? expression : null);
}
if (questionAssignNode != null) {
_flowAnalysis.ifNullExpression_end();
@@ -2419,9 +2421,9 @@
_guards.removeLast();
}
}
- if (destinationExpression != null) {
- var element =
- _postDominatedLocals.referencedElement(destinationExpression);
+ if (assignmentExpression != null) {
+ var element = _postDominatedLocals
+ .referencedElement(assignmentExpression.leftHandSide);
if (element != null) {
_postDominatedLocals.removeFromAllScopes(element);
_elementsWrittenToInLocalFunction?.add(element);
diff --git a/pkg/nnbd_migration/lib/src/fix_builder.dart b/pkg/nnbd_migration/lib/src/fix_builder.dart
index 687b07b..0cb9d26 100644
--- a/pkg/nnbd_migration/lib/src/fix_builder.dart
+++ b/pkg/nnbd_migration/lib/src/fix_builder.dart
@@ -8,7 +8,6 @@
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_provider.dart';
@@ -206,12 +205,10 @@
/// makes note of changes that need to be made.
void visitAll() {
try {
- NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
- ElementTypeProvider.current = migrationResolutionHooks;
- unit.accept(_FixBuilderPreVisitor(this));
- unit.accept(_resolver);
- unit.accept(_FixBuilderPostVisitor(this));
- });
+ ElementTypeProvider.current = migrationResolutionHooks;
+ unit.accept(_FixBuilderPreVisitor(this));
+ unit.accept(_resolver);
+ unit.accept(_FixBuilderPostVisitor(this));
} catch (exception, stackTrace) {
if (listener != null) {
listener.reportException(source, unit, exception, stackTrace);
diff --git a/pkg/vm/lib/transformations/ffi.dart b/pkg/vm/lib/transformations/ffi.dart
index e27e3f3..1c16b1b 100644
--- a/pkg/vm/lib/transformations/ffi.dart
+++ b/pkg/vm/lib/transformations/ffi.dart
@@ -206,6 +206,7 @@
final Field pragmaOptions;
final Procedure listElementAt;
final Procedure numAddition;
+ final Procedure numMultiplication;
final Library ffiLibrary;
final Class allocatorClass;
@@ -267,6 +268,7 @@
pragmaOptions = coreTypes.pragmaOptions,
listElementAt = coreTypes.index.getMember('dart:core', 'List', '[]'),
numAddition = coreTypes.index.getMember('dart:core', 'num', '+'),
+ numMultiplication = coreTypes.index.getMember('dart:core', 'num', '*'),
ffiLibrary = index.getLibrary('dart:ffi'),
allocatorClass = index.getClass('dart:ffi', 'Allocator'),
nativeFunctionClass = index.getClass('dart:ffi', 'NativeFunction'),
@@ -410,6 +412,8 @@
return FunctionType(argumentTypes, returnType, Nullability.legacy);
}
+ /// The [NativeType] corresponding to [c]. Returns `null` for user-defined
+ /// structs.
NativeType getType(Class c) {
final int index = nativeTypesClasses.indexOf(c);
if (index == -1) {
@@ -417,6 +421,23 @@
}
return NativeType.values[index];
}
+
+ /// Expression that queries VM internals at runtime to figure out on which ABI
+ /// we are.
+ Expression runtimeBranchOnLayout(Map<Abi, int> values) {
+ return MethodInvocation(
+ ConstantExpression(
+ ListConstant(InterfaceType(intClass, Nullability.legacy), [
+ IntConstant(values[Abi.wordSize64]),
+ IntConstant(values[Abi.wordSize32Align32]),
+ IntConstant(values[Abi.wordSize32Align64])
+ ]),
+ InterfaceType(listClass, Nullability.legacy,
+ [InterfaceType(intClass, Nullability.legacy)])),
+ Name("[]"),
+ Arguments([StaticInvocation(abiMethod, Arguments([]))]),
+ listElementAt);
+ }
}
/// Contains all information collected by _FfiDefinitionTransformer that is
diff --git a/pkg/vm/lib/transformations/ffi_definitions.dart b/pkg/vm/lib/transformations/ffi_definitions.dart
index 853087e..b06c63f 100644
--- a/pkg/vm/lib/transformations/ffi_definitions.dart
+++ b/pkg/vm/lib/transformations/ffi_definitions.dart
@@ -496,23 +496,6 @@
InterfaceType(pragmaClass, Nullability.nonNullable, [])));
}
- /// Expression that queries VM internals at runtime to figure out on which ABI
- /// we are.
- Expression _runtimeBranchOnLayout(Map<Abi, int> values) {
- return MethodInvocation(
- ConstantExpression(
- ListConstant(InterfaceType(intClass, Nullability.legacy), [
- IntConstant(values[Abi.wordSize64]),
- IntConstant(values[Abi.wordSize32Align32]),
- IntConstant(values[Abi.wordSize32Align64])
- ]),
- InterfaceType(listClass, Nullability.legacy,
- [InterfaceType(intClass, Nullability.legacy)])),
- Name("[]"),
- Arguments([StaticInvocation(abiMethod, Arguments([]))]),
- listElementAt);
- }
-
Statement _generateGetterStatement(DartType dartType, NativeType type,
int fileOffset, Map<Abi, int> offsets) {
final bool isPointer = type == NativeType.kPointer;
@@ -558,7 +541,7 @@
addressGetter)
..fileOffset = fileOffset,
numAddition.name,
- Arguments([_runtimeBranchOnLayout(offsets)]),
+ Arguments([runtimeBranchOnLayout(offsets)]),
numAddition)
], types: [
dartType
@@ -594,9 +577,9 @@
typedDataOffsetInBytesGetter)
..fileOffset = fileOffset,
numAddition.name,
- Arguments([_runtimeBranchOnLayout(offsets)]),
+ Arguments([runtimeBranchOnLayout(offsets)]),
numAddition),
- _runtimeBranchOnLayout(lengths)
+ runtimeBranchOnLayout(lengths)
]),
byteBufferAsUint8List),
InterfaceType(objectClass, Nullability.nonNullable))
@@ -610,7 +593,7 @@
Arguments([
PropertyGet(ThisExpression(), addressOfField.name, addressOfField)
..fileOffset = fileOffset,
- _runtimeBranchOnLayout(offsets)
+ runtimeBranchOnLayout(offsets)
]))
..fileOffset = fileOffset;
if (isPointer) {
@@ -646,12 +629,12 @@
Arguments([
PropertyGet(ThisExpression(), addressOfField.name, addressOfField)
..fileOffset = fileOffset,
- _runtimeBranchOnLayout(offsets),
+ runtimeBranchOnLayout(offsets),
PropertyGet(
VariableGet(argument), addressOfField.name, addressOfField)
..fileOffset = fileOffset,
ConstantExpression(IntConstant(0)),
- _runtimeBranchOnLayout(lengths),
+ runtimeBranchOnLayout(lengths),
]))
..fileOffset = fileOffset);
}
@@ -669,7 +652,7 @@
Arguments([
PropertyGet(ThisExpression(), addressOfField.name, addressOfField)
..fileOffset = fileOffset,
- _runtimeBranchOnLayout(offsets),
+ runtimeBranchOnLayout(offsets),
argumentExpression
]))
..fileOffset = fileOffset);
@@ -719,7 +702,7 @@
final Field sizeOf = Field.immutable(name,
isStatic: true,
isFinal: true,
- initializer: _runtimeBranchOnLayout(sizes),
+ initializer: runtimeBranchOnLayout(sizes),
type: InterfaceType(intClass, Nullability.legacy),
fileUri: struct.fileUri,
getterReference: getterReference)
diff --git a/pkg/vm/lib/transformations/ffi_use_sites.dart b/pkg/vm/lib/transformations/ffi_use_sites.dart
index e963078..1f0aba6 100644
--- a/pkg/vm/lib/transformations/ffi_use_sites.dart
+++ b/pkg/vm/lib/transformations/ffi_use_sites.dart
@@ -27,7 +27,14 @@
import 'package:kernel/type_environment.dart';
import 'ffi.dart'
- show FfiTransformerData, NativeType, FfiTransformer, optimizedTypes;
+ show
+ FfiTransformerData,
+ NativeType,
+ FfiTransformer,
+ nativeTypeSizes,
+ WORD_SIZE,
+ UNKNOWN,
+ wordSize;
/// Checks and replaces calls to dart:ffi struct fields and methods.
void transformLibraries(
@@ -177,19 +184,24 @@
if (target == structPointerRef || target == structPointerElemAt) {
final DartType nativeType = node.arguments.types[0];
- _warningNativeTypeValid(nativeType, node, allowStructItself: false);
+ _ensureNativeTypeValid(nativeType, node, allowStructItself: false);
- // TODO(http://dartbug.com/38721): Replace calls with direct
- // constructor invocations.
+ return _replaceRef(node);
} else if (target == sizeOfMethod) {
final DartType nativeType = node.arguments.types[0];
+ // TODO(http://dartbug.com/38721): Change this to an error after
+ // package:ffi is no longer using sizeOf generically.
if (!isFfiLibrary) {
_warningNativeTypeValid(nativeType, node);
}
- // TODO(http://dartbug.com/38721): Replace calls with constant
- // expressions.
+ if (nativeType is InterfaceType) {
+ Expression inlineSizeOf = _inlineSizeOf(nativeType);
+ if (inlineSizeOf != null) {
+ return inlineSizeOf;
+ }
+ }
} else if (target == lookupFunctionMethod) {
final DartType nativeType = InterfaceType(
nativeFunctionClass, Nullability.legacy, [node.arguments.types[0]]);
@@ -303,8 +315,29 @@
_ensureNativeTypeValid(nativeType, node);
- // TODO(http://dartbug.com/38721): Inline the body to get rid of a
- // generic invocation of sizeOf.
+ // TODO(http://dartbug.com/38721): Change this to an error.
+ if (nativeType is TypeParameterType) {
+ // Do not rewire generic invocations.
+ return node;
+ }
+
+ // Inline the body to get rid of a generic invocation of sizeOf.
+ // TODO(http://dartbug.com/39964): Add `allignmentOf<T>()` call.
+ Expression sizeInBytes = _inlineSizeOf(nativeType);
+ if (sizeInBytes != null) {
+ if (node.arguments.positional.length == 2) {
+ sizeInBytes = MethodInvocation(
+ node.arguments.positional[1],
+ numMultiplication.name,
+ Arguments([sizeInBytes]),
+ numMultiplication);
+ }
+ return MethodInvocation(
+ node.arguments.positional[0],
+ allocatorAllocateMethod.name,
+ Arguments([sizeInBytes], types: node.arguments.types),
+ allocatorAllocateMethod);
+ }
}
} on _FfiStaticTypeError {
// It's OK to swallow the exception because the diagnostics issued will
@@ -315,6 +348,28 @@
return node;
}
+ Expression _inlineSizeOf(InterfaceType nativeType) {
+ final Class nativeClass = nativeType.classNode;
+ final NativeType nt = getType(nativeClass);
+ if (nt == null) {
+ // User-defined structs.
+ Field sizeOfField = nativeClass.fields.single;
+ return StaticGet(sizeOfField);
+ }
+ final int size = nativeTypeSizes[nt.index];
+ if (size == WORD_SIZE) {
+ return runtimeBranchOnLayout(wordSize);
+ }
+ if (size != UNKNOWN) {
+ return ConstantExpression(
+ IntConstant(size),
+ InterfaceType(listClass, Nullability.legacy,
+ [InterfaceType(intClass, Nullability.legacy)]));
+ }
+ // Size unknown.
+ return null;
+ }
+
// We need to replace calls to 'DynamicLibrary.lookupFunction' with explicit
// Kernel, because we cannot have a generic call to 'asFunction' in its body.
//
@@ -383,6 +438,28 @@
return StaticGet(field);
}
+ Expression _replaceRef(StaticInvocation node) {
+ final dartType = node.arguments.types[0];
+ final clazz = (dartType as InterfaceType).classNode;
+ final constructor = clazz.constructors
+ .firstWhere((c) => c.name == Name("#fromTypedDataBase"));
+ Expression pointer = NullCheck(node.arguments.positional[0]);
+ if (node.arguments.positional.length == 2) {
+ pointer = MethodInvocation(
+ pointer,
+ offsetByMethod.name,
+ Arguments([
+ MethodInvocation(
+ node.arguments.positional[1],
+ numMultiplication.name,
+ Arguments([_inlineSizeOf(dartType)]),
+ numMultiplication)
+ ]),
+ offsetByMethod);
+ }
+ return ConstructorInvocation(constructor, Arguments([pointer]));
+ }
+
@override
visitMethodInvocation(MethodInvocation node) {
super.visitMethodInvocation(node);
@@ -396,20 +473,26 @@
_warningNativeTypeValid(nativeType, node);
+ // TODO(http://dartbug.com/38721): Change this to an error.
if (nativeType is TypeParameterType) {
// Do not rewire generic invocations.
return node;
}
- final Class nativeClass = (nativeType as InterfaceType).classNode;
- final NativeType nt = getType(nativeClass);
- if (optimizedTypes.contains(nt)) {
- final typeArguments = [
- if (nt == NativeType.kPointer) _pointerTypeGetTypeArg(nativeType)
- ];
- return StaticInvocation(
- elementAtMethods[nt],
- Arguments([node.receiver, node.arguments.positional[0]],
- types: typeArguments));
+
+ Expression inlineSizeOf = _inlineSizeOf(nativeType);
+ if (inlineSizeOf != null) {
+ // Generates `receiver.offsetBy(inlineSizeOfExpression)`.
+ return MethodInvocation(
+ node.receiver,
+ offsetByMethod.name,
+ Arguments([
+ MethodInvocation(
+ node.arguments.positional.single,
+ numMultiplication.name,
+ Arguments([inlineSizeOf]),
+ numMultiplication)
+ ]),
+ offsetByMethod);
}
}
} on _FfiStaticTypeError {
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index 41fb6f8..7289341 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -946,6 +946,32 @@
IOBuffer::Finalizer);
}
+void CObject::ShrinkIOBuffer(Dart_CObject* cobject, int64_t new_length) {
+ if (cobject == nullptr) return;
+ ASSERT(cobject->type == Dart_CObject_kExternalTypedData);
+
+ const auto old_data = cobject->value.as_external_typed_data.data;
+ const auto old_length = cobject->value.as_external_typed_data.length;
+
+ // We only shrink IOBuffers, never grow them.
+ ASSERT(0 <= new_length && new_length <= old_length);
+
+ // We only reallocate if we think the freed space is worth reallocating.
+ // We consider it worthwhile when freed space is >=25% and we have at
+ // least 100 free bytes.
+ const auto free_memory = old_length - new_length;
+ if ((old_length >> 2) <= free_memory && 100 <= free_memory) {
+ const auto new_data = IOBuffer::Reallocate(old_data, new_length);
+ if (new_data != nullptr) {
+ cobject->value.as_external_typed_data.data = new_data;
+ cobject->value.as_external_typed_data.peer = new_data;
+ }
+ }
+
+ // The typed data object always has to have the shranken length.
+ cobject->value.as_external_typed_data.length = new_length;
+}
+
void CObject::FreeIOBufferData(Dart_CObject* cobject) {
ASSERT(cobject->type == Dart_CObject_kExternalTypedData);
cobject->value.as_external_typed_data.callback(
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index f7f1d8d..7ff1580 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -353,6 +353,7 @@
Dart_HandleFinalizer callback);
static Dart_CObject* NewIOBuffer(int64_t length);
+ static void ShrinkIOBuffer(Dart_CObject* cobject, int64_t new_length);
static void FreeIOBufferData(Dart_CObject* object);
Dart_CObject* AsApiCObject() { return cobject_; }
@@ -568,9 +569,6 @@
intptr_t Length() const {
return cobject_->value.as_external_typed_data.length;
}
- void SetLength(intptr_t length) {
- cobject_->value.as_external_typed_data.length = length;
- }
uint8_t* Data() const { return cobject_->value.as_external_typed_data.data; }
void* Peer() const { return cobject_->value.as_external_typed_data.peer; }
Dart_HandleFinalizer Callback() const {
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index cbeb39a..8e377a1 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -1246,9 +1246,12 @@
CObject::FreeIOBufferData(io_buffer);
return CObject::NewOSError();
}
- CObjectExternalUint8Array* external_array =
- new CObjectExternalUint8Array(io_buffer);
- external_array->SetLength(bytes_read);
+
+ // Possibly shrink the used malloc() storage if the actual number of bytes is
+ // significantly lower.
+ CObject::ShrinkIOBuffer(io_buffer, bytes_read);
+
+ auto external_array = new CObjectExternalUint8Array(io_buffer);
CObjectArray* result = new CObjectArray(CObject::NewArray(2));
result->SetAt(0, new CObjectIntptr(CObject::NewInt32(0)));
result->SetAt(1, external_array);
@@ -1278,9 +1281,12 @@
CObject::FreeIOBufferData(io_buffer);
return CObject::NewOSError();
}
- CObjectExternalUint8Array* external_array =
- new CObjectExternalUint8Array(io_buffer);
- external_array->SetLength(bytes_read);
+
+ // Possibly shrink the used malloc() storage if the actual number of bytes is
+ // significantly lower.
+ CObject::ShrinkIOBuffer(io_buffer, bytes_read);
+
+ auto external_array = new CObjectExternalUint8Array(io_buffer);
CObjectArray* result = new CObjectArray(CObject::NewArray(3));
result->SetAt(0, new CObjectIntptr(CObject::NewInt32(0)));
result->SetAt(1, new CObjectInt64(CObject::NewInt64(bytes_read)));
diff --git a/runtime/bin/io_buffer.cc b/runtime/bin/io_buffer.cc
index c0e8066..fce6d2c 100644
--- a/runtime/bin/io_buffer.cc
+++ b/runtime/bin/io_buffer.cc
@@ -28,7 +28,23 @@
}
uint8_t* IOBuffer::Allocate(intptr_t size) {
- return reinterpret_cast<uint8_t*>(calloc(size, sizeof(uint8_t)));
+ return static_cast<uint8_t*>(calloc(size, sizeof(uint8_t)));
+}
+
+uint8_t* IOBuffer::Reallocate(uint8_t* buffer, intptr_t new_size) {
+ if (new_size == 0) {
+ // The call to `realloc()` below has a corner case if the new size is 0:
+ // It can return `nullptr` in that case even though `malloc(0)` would
+ // return a unique non-`nullptr` value. To avoid returning `nullptr` on
+ // successful realloc, we handle this case specially.
+ auto new_buffer = IOBuffer::Allocate(0);
+ if (new_buffer != nullptr) {
+ free(buffer);
+ return new_buffer;
+ }
+ return buffer;
+ }
+ return static_cast<uint8_t*>(realloc(buffer, new_size));
}
} // namespace bin
diff --git a/runtime/bin/io_buffer.h b/runtime/bin/io_buffer.h
index 79b4fb9..2823352 100644
--- a/runtime/bin/io_buffer.h
+++ b/runtime/bin/io_buffer.h
@@ -20,6 +20,9 @@
// Allocate IO buffer storage.
static uint8_t* Allocate(intptr_t size);
+ // Reallocate IO buffer storage.
+ static uint8_t* Reallocate(uint8_t* buffer, intptr_t new_size);
+
// Function for disposing of IO buffer storage. All backing storage
// for IO buffers must be freed using this function.
static void Free(void* buffer) { free(buffer); }
diff --git a/runtime/lib/ffi.cc b/runtime/lib/ffi.cc
index d703d0b..3a6bb40 100644
--- a/runtime/lib/ffi.cc
+++ b/runtime/lib/ffi.cc
@@ -116,7 +116,7 @@
DEFINE_NATIVE_ENTRY(Ffi_loadStruct, 0, 2) {
GET_NON_NULL_NATIVE_ARGUMENT(Pointer, pointer, arguments->NativeArgAt(0));
const AbstractType& pointer_type_arg =
- AbstractType::Handle(pointer.type_argument());
+ AbstractType::Handle(arguments->NativeTypeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1));
// TODO(36370): Make representation consistent with kUnboxedFfiIntPtr.
diff --git a/runtime/vm/compiler/offsets_extractor.cc b/runtime/vm/compiler/offsets_extractor.cc
index c89ff54..b0d76f8 100644
--- a/runtime/vm/compiler/offsets_extractor.cc
+++ b/runtime/vm/compiler/offsets_extractor.cc
@@ -18,17 +18,23 @@
#include "vm/timeline.h"
#if defined(TARGET_ARCH_ARM)
-#define ARCH_DEF "defined(TARGET_ARCH_ARM)"
+#define ARCH_DEF_CPU "defined(TARGET_ARCH_ARM)"
#elif defined(TARGET_ARCH_X64)
-#define ARCH_DEF "defined(TARGET_ARCH_X64)"
+#define ARCH_DEF_CPU "defined(TARGET_ARCH_X64)"
#elif defined(TARGET_ARCH_IA32)
-#define ARCH_DEF "defined(TARGET_ARCH_IA32)"
+#define ARCH_DEF_CPU "defined(TARGET_ARCH_IA32)"
#elif defined(TARGET_ARCH_ARM64)
-#define ARCH_DEF "defined(TARGET_ARCH_ARM64)"
+#define ARCH_DEF_CPU "defined(TARGET_ARCH_ARM64)"
#else
#error Unknown architecture
#endif
+#if defined(DART_COMPRESSED_POINTERS)
+#define ARCH_DEF ARCH_DEF_CPU " && defined(DART_COMPRESSED_POINTERS)"
+#else
+#define ARCH_DEF ARCH_DEF_CPU " && !defined(DART_COMPRESSED_POINTERS)"
+#endif
+
namespace dart {
void Assert::Fail(const char* format, ...) {
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 63898cb..c4743e3 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -17,7 +17,7 @@
#if !defined(PRODUCT)
-#if defined(TARGET_ARCH_ARM)
+#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
76;
static constexpr dart::compiler::target::word
@@ -545,9 +545,9 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 16;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 8;
-#endif // defined(TARGET_ARCH_ARM)
+#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_X64)
+#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
116;
static constexpr dart::compiler::target::word
@@ -1083,9 +1083,9 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_X64)
+#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_IA32)
+#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
76;
static constexpr dart::compiler::target::word
@@ -1610,9 +1610,9 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 16;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 8;
-#endif // defined(TARGET_ARCH_IA32)
+#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_ARM64)
+#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
116;
static constexpr dart::compiler::target::word
@@ -2149,11 +2149,1088 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_ARM64)
+#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word Function_usage_counter_offset =
+ 116;
+static constexpr dart::compiler::target::word
+ ICData_receivers_static_type_offset = 32;
+static constexpr dart::compiler::target::word
+ ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word ContextScope_element_size = 64;
+static constexpr dart::compiler::target::word
+ ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word ExceptionHandlers_element_size =
+ 12;
+static constexpr dart::compiler::target::word ObjectPool_elements_start_offset =
+ 16;
+static constexpr dart::compiler::target::word ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetJIT = 40;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetAOT = 22;
+static constexpr dart::compiler::target::word
+ Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word OldPage_kBytesPerCardLog2 = 10;
+static constexpr dart::compiler::target::word
+ NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_kTestResult = 0;
+static constexpr dart::compiler::target::word TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_count_offset =
+ 32;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_size_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_name_offset =
+ 0;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word Array_data_offset = 24;
+static constexpr dart::compiler::target::word Array_length_offset = 16;
+static constexpr dart::compiler::target::word Array_tags_offset = 0;
+static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word Class_declaration_type_offset =
+ 104;
+static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
+ 164;
+static constexpr dart::compiler::target::word Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word
+ SharedClassTable_class_heap_stats_table_offset = 0;
+static constexpr dart::compiler::target::word Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word Code_saved_instructions_offset =
+ 48;
+static constexpr dart::compiler::target::word Code_owner_offset = 56;
+static constexpr dart::compiler::target::word Context_num_variables_offset = 8;
+static constexpr dart::compiler::target::word Context_parent_offset = 16;
+static constexpr dart::compiler::target::word Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 80;
+static constexpr dart::compiler::target::word
+ Field_guarded_list_length_in_object_offset_offset = 88;
+static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
+ 48;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 82;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 90;
+static constexpr dart::compiler::target::word Function_code_offset = 72;
+static constexpr dart::compiler::target::word Function_data_offset = 56;
+static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
+ 8, 16};
+static constexpr dart::compiler::target::word Function_kind_tag_offset = 104;
+static constexpr dart::compiler::target::word Function_packed_fields_offset =
+ 108;
+static constexpr dart::compiler::target::word Function_parameter_names_offset =
+ 40;
+static constexpr dart::compiler::target::word Function_signature_offset = 48;
+static constexpr dart::compiler::target::word FutureOr_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word GrowableObjectArray_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word OldPage_card_table_offset = 40;
+static constexpr dart::compiler::target::word
+ CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word ICData_owner_offset = 40;
+static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
+static constexpr dart::compiler::target::word Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
+static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
+static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
+static constexpr dart::compiler::target::word
+ Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word Isolate_single_step_offset = 96;
+static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word LinkedHashMap_hash_mask_offset =
+ 24;
+static constexpr dart::compiler::target::word LinkedHashMap_index_offset = 16;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word LinkedHashMap_used_data_offset =
+ 40;
+static constexpr dart::compiler::target::word LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word MarkingStackBlock_top_offset = 8;
+static constexpr dart::compiler::target::word MegamorphicCache_buckets_offset =
+ 24;
+static constexpr dart::compiler::target::word MegamorphicCache_mask_offset = 32;
+static constexpr dart::compiler::target::word Mint_value_offset = 8;
+static constexpr dart::compiler::target::word NativeArguments_argc_tag_offset =
+ 8;
+static constexpr dart::compiler::target::word NativeArguments_argv_offset = 16;
+static constexpr dart::compiler::target::word NativeArguments_retval_offset =
+ 24;
+static constexpr dart::compiler::target::word NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word ObjectStore_double_type_offset =
+ 256;
+static constexpr dart::compiler::target::word ObjectStore_int_type_offset = 136;
+static constexpr dart::compiler::target::word ObjectStore_string_type_offset =
+ 312;
+static constexpr dart::compiler::target::word ObjectStore_type_type_offset = 96;
+static constexpr dart::compiler::target::word OneByteString_data_offset = 16;
+static constexpr dart::compiler::target::word PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word Pointer_type_arguments_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_target_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word StoreBufferBlock_pointers_offset =
+ 16;
+static constexpr dart::compiler::target::word StoreBufferBlock_top_offset = 8;
+static constexpr dart::compiler::target::word String_hash_offset = 4;
+static constexpr dart::compiler::target::word String_length_offset = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word Thread_active_exception_offset =
+ 1392;
+static constexpr dart::compiler::target::word Thread_active_stacktrace_offset =
+ 1400;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word Thread_api_top_scope_offset =
+ 1472;
+static constexpr dart::compiler::target::word
+ Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word Thread_bool_false_offset = 208;
+static constexpr dart::compiler::target::word Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1488;
+static constexpr dart::compiler::target::word
+ Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 432;
+static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
+ 608;
+static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
+ 440;
+static constexpr dart::compiler::target::word Thread_double_abs_address_offset =
+ 680;
+static constexpr dart::compiler::target::word
+ Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word Thread_execution_state_offset =
+ 1432;
+static constexpr dart::compiler::target::word
+ Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word Thread_float_not_address_offset =
+ 688;
+static constexpr dart::compiler::target::word
+ Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word Thread_global_object_pool_offset =
+ 1408;
+static constexpr dart::compiler::target::word
+ Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
+ 1464;
+static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word Thread_field_table_values_offset =
+ 128;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_without_fpu_regs_stub_offset = 264;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word Thread_object_null_offset = 192;
+static constexpr dart::compiler::target::word
+ Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1416;
+static constexpr dart::compiler::target::word
+ Thread_saved_shadow_call_stack_offset = 1424;
+static constexpr dart::compiler::target::word Thread_safepoint_state_offset =
+ 1440;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word Thread_stack_limit_offset = 64;
+static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset =
+ 112;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word Thread_store_buffer_block_offset =
+ 152;
+static constexpr dart::compiler::target::word
+ Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word Thread_top_offset = 96;
+static constexpr dart::compiler::target::word Thread_top_resource_offset = 40;
+static constexpr dart::compiler::target::word
+ Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word Thread_write_barrier_code_offset =
+ 216;
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset =
+ 72;
+static constexpr dart::compiler::target::word Thread_callback_code_offset =
+ 1448;
+static constexpr dart::compiler::target::word
+ Thread_callback_stack_return_offset = 1456;
+static constexpr dart::compiler::target::word TimelineStream_enabled_offset =
+ 16;
+static constexpr dart::compiler::target::word TwoByteString_data_offset = 16;
+static constexpr dart::compiler::target::word Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word Type_hash_offset = 40;
+static constexpr dart::compiler::target::word Type_type_class_id_offset = 24;
+static constexpr dart::compiler::target::word Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 60;
+static constexpr dart::compiler::target::word TypeParameter_nullability_offset =
+ 63;
+static constexpr dart::compiler::target::word
+ TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
+static constexpr dart::compiler::target::word TypeArguments_nullability_offset =
+ 32;
+static constexpr dart::compiler::target::word TypeArguments_types_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62;
+static constexpr dart::compiler::target::word TypeParameter_name_offset = 24;
+static constexpr dart::compiler::target::word TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16;
+static constexpr dart::compiler::target::word TypedDataView_data_offset = 24;
+static constexpr dart::compiler::target::word
+ TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_value_offset = 16;
+static constexpr dart::compiler::target::word Array_elements_start_offset = 24;
+static constexpr dart::compiler::target::word Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word TypeArguments_element_size = 8;
+static constexpr dart::compiler::target::word ClassTable_elements_start_offset =
+ 0;
+static constexpr dart::compiler::target::word ClassTable_element_size = 1;
+static constexpr dart::compiler::target::word Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, -1, -1, 1336, 1344,
+ 1352, 1360, 1368, -1, 1376, 1384, -1, -1};
+static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
+static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word Array_header_size = 24;
+static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word Class_InstanceSize = 200;
+static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word Code_InstanceSize = 176;
+static constexpr dart::compiler::target::word CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word CompressedStackMaps_HeaderSize =
+ 16;
+static constexpr dart::compiler::target::word Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word Context_header_size = 24;
+static constexpr dart::compiler::target::word ContextScope_InstanceSize = 16;
+static constexpr dart::compiler::target::word Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word DynamicLibrary_InstanceSize = 16;
+static constexpr dart::compiler::target::word ExceptionHandlers_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word ExternalTypedData_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Field_InstanceSize = 96;
+static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word Function_InstanceSize = 128;
+static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72;
+static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word ICData_InstanceSize = 56;
+static constexpr dart::compiler::target::word Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word Instructions_UnalignedHeaderSize =
+ 16;
+static constexpr dart::compiler::target::word
+ InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize =
+ 120;
+static constexpr dart::compiler::target::word LanguageError_InstanceSize = 48;
+static constexpr dart::compiler::target::word Library_InstanceSize = 160;
+static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40;
+static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56;
+static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word MegamorphicCache_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word MirrorReference_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word NativeArguments_StructSize = 32;
+static constexpr dart::compiler::target::word Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
+static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40;
+static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word Script_InstanceSize = 104;
+static constexpr dart::compiler::target::word SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word String_InstanceSize = 16;
+static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64;
+static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40;
+static constexpr dart::compiler::target::word UnhandledException_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word Function_usage_counter_offset =
+ 116;
+static constexpr dart::compiler::target::word
+ ICData_receivers_static_type_offset = 32;
+static constexpr dart::compiler::target::word
+ ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word ContextScope_element_size = 64;
+static constexpr dart::compiler::target::word
+ ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word ExceptionHandlers_element_size =
+ 12;
+static constexpr dart::compiler::target::word ObjectPool_elements_start_offset =
+ 16;
+static constexpr dart::compiler::target::word ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetJIT = 48;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetAOT = 20;
+static constexpr dart::compiler::target::word
+ Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word OldPage_kBytesPerCardLog2 = 10;
+static constexpr dart::compiler::target::word
+ NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_kTestResult = 0;
+static constexpr dart::compiler::target::word TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_count_offset =
+ 32;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_size_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_name_offset =
+ 0;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word Array_data_offset = 24;
+static constexpr dart::compiler::target::word Array_length_offset = 16;
+static constexpr dart::compiler::target::word Array_tags_offset = 0;
+static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word Class_declaration_type_offset =
+ 104;
+static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
+ 164;
+static constexpr dart::compiler::target::word Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word
+ SharedClassTable_class_heap_stats_table_offset = 0;
+static constexpr dart::compiler::target::word Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word Code_saved_instructions_offset =
+ 48;
+static constexpr dart::compiler::target::word Code_owner_offset = 56;
+static constexpr dart::compiler::target::word Context_num_variables_offset = 8;
+static constexpr dart::compiler::target::word Context_parent_offset = 16;
+static constexpr dart::compiler::target::word Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 80;
+static constexpr dart::compiler::target::word
+ Field_guarded_list_length_in_object_offset_offset = 88;
+static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
+ 48;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 82;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 90;
+static constexpr dart::compiler::target::word Function_code_offset = 72;
+static constexpr dart::compiler::target::word Function_data_offset = 56;
+static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
+ 8, 16};
+static constexpr dart::compiler::target::word Function_kind_tag_offset = 104;
+static constexpr dart::compiler::target::word Function_packed_fields_offset =
+ 108;
+static constexpr dart::compiler::target::word Function_parameter_names_offset =
+ 40;
+static constexpr dart::compiler::target::word Function_signature_offset = 48;
+static constexpr dart::compiler::target::word FutureOr_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word GrowableObjectArray_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word OldPage_card_table_offset = 40;
+static constexpr dart::compiler::target::word
+ CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word ICData_owner_offset = 40;
+static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
+static constexpr dart::compiler::target::word Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
+static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
+static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
+static constexpr dart::compiler::target::word
+ Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word Isolate_single_step_offset = 96;
+static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word LinkedHashMap_hash_mask_offset =
+ 24;
+static constexpr dart::compiler::target::word LinkedHashMap_index_offset = 16;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word LinkedHashMap_used_data_offset =
+ 40;
+static constexpr dart::compiler::target::word LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word MarkingStackBlock_top_offset = 8;
+static constexpr dart::compiler::target::word MegamorphicCache_buckets_offset =
+ 24;
+static constexpr dart::compiler::target::word MegamorphicCache_mask_offset = 32;
+static constexpr dart::compiler::target::word Mint_value_offset = 8;
+static constexpr dart::compiler::target::word NativeArguments_argc_tag_offset =
+ 8;
+static constexpr dart::compiler::target::word NativeArguments_argv_offset = 16;
+static constexpr dart::compiler::target::word NativeArguments_retval_offset =
+ 24;
+static constexpr dart::compiler::target::word NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word ObjectStore_double_type_offset =
+ 256;
+static constexpr dart::compiler::target::word ObjectStore_int_type_offset = 136;
+static constexpr dart::compiler::target::word ObjectStore_string_type_offset =
+ 312;
+static constexpr dart::compiler::target::word ObjectStore_type_type_offset = 96;
+static constexpr dart::compiler::target::word OneByteString_data_offset = 16;
+static constexpr dart::compiler::target::word PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word Pointer_type_arguments_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_target_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word StoreBufferBlock_pointers_offset =
+ 16;
+static constexpr dart::compiler::target::word StoreBufferBlock_top_offset = 8;
+static constexpr dart::compiler::target::word String_hash_offset = 4;
+static constexpr dart::compiler::target::word String_length_offset = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word Thread_active_exception_offset =
+ 1464;
+static constexpr dart::compiler::target::word Thread_active_stacktrace_offset =
+ 1472;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word Thread_api_top_scope_offset =
+ 1544;
+static constexpr dart::compiler::target::word
+ Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word Thread_bool_false_offset = 208;
+static constexpr dart::compiler::target::word Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1560;
+static constexpr dart::compiler::target::word
+ Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 432;
+static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
+ 608;
+static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
+ 440;
+static constexpr dart::compiler::target::word Thread_double_abs_address_offset =
+ 680;
+static constexpr dart::compiler::target::word
+ Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word Thread_execution_state_offset =
+ 1504;
+static constexpr dart::compiler::target::word
+ Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word Thread_float_not_address_offset =
+ 688;
+static constexpr dart::compiler::target::word
+ Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word Thread_global_object_pool_offset =
+ 1480;
+static constexpr dart::compiler::target::word
+ Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
+ 1536;
+static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word Thread_field_table_values_offset =
+ 128;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_without_fpu_regs_stub_offset = 264;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word Thread_object_null_offset = 192;
+static constexpr dart::compiler::target::word
+ Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1488;
+static constexpr dart::compiler::target::word
+ Thread_saved_shadow_call_stack_offset = 1496;
+static constexpr dart::compiler::target::word Thread_safepoint_state_offset =
+ 1512;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word Thread_stack_limit_offset = 64;
+static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset =
+ 112;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word Thread_store_buffer_block_offset =
+ 152;
+static constexpr dart::compiler::target::word
+ Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word Thread_top_offset = 96;
+static constexpr dart::compiler::target::word Thread_top_resource_offset = 40;
+static constexpr dart::compiler::target::word
+ Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word Thread_write_barrier_code_offset =
+ 216;
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset =
+ 72;
+static constexpr dart::compiler::target::word Thread_callback_code_offset =
+ 1520;
+static constexpr dart::compiler::target::word
+ Thread_callback_stack_return_offset = 1528;
+static constexpr dart::compiler::target::word TimelineStream_enabled_offset =
+ 16;
+static constexpr dart::compiler::target::word TwoByteString_data_offset = 16;
+static constexpr dart::compiler::target::word Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word Type_hash_offset = 40;
+static constexpr dart::compiler::target::word Type_type_class_id_offset = 24;
+static constexpr dart::compiler::target::word Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 60;
+static constexpr dart::compiler::target::word TypeParameter_nullability_offset =
+ 63;
+static constexpr dart::compiler::target::word
+ TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
+static constexpr dart::compiler::target::word TypeArguments_nullability_offset =
+ 32;
+static constexpr dart::compiler::target::word TypeArguments_types_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62;
+static constexpr dart::compiler::target::word TypeParameter_name_offset = 24;
+static constexpr dart::compiler::target::word TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16;
+static constexpr dart::compiler::target::word TypedDataView_data_offset = 24;
+static constexpr dart::compiler::target::word
+ TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_value_offset = 16;
+static constexpr dart::compiler::target::word Array_elements_start_offset = 24;
+static constexpr dart::compiler::target::word Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word TypeArguments_element_size = 8;
+static constexpr dart::compiler::target::word ClassTable_elements_start_offset =
+ 0;
+static constexpr dart::compiler::target::word ClassTable_element_size = 1;
+static constexpr dart::compiler::target::word Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384,
+ 1392, 1400, 1408, 1416, -1, -1, -1, -1, 1424, 1432, -1,
+ -1, 1440, 1448, 1456, -1, -1, -1, -1, -1, -1};
+static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
+static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word Array_header_size = 24;
+static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word Class_InstanceSize = 200;
+static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word Code_InstanceSize = 176;
+static constexpr dart::compiler::target::word CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word CompressedStackMaps_HeaderSize =
+ 16;
+static constexpr dart::compiler::target::word Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word Context_header_size = 24;
+static constexpr dart::compiler::target::word ContextScope_InstanceSize = 16;
+static constexpr dart::compiler::target::word Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word DynamicLibrary_InstanceSize = 16;
+static constexpr dart::compiler::target::word ExceptionHandlers_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word ExternalTypedData_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Field_InstanceSize = 96;
+static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word Function_InstanceSize = 128;
+static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72;
+static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word ICData_InstanceSize = 56;
+static constexpr dart::compiler::target::word Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word Instructions_UnalignedHeaderSize =
+ 16;
+static constexpr dart::compiler::target::word
+ InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize =
+ 120;
+static constexpr dart::compiler::target::word LanguageError_InstanceSize = 48;
+static constexpr dart::compiler::target::word Library_InstanceSize = 160;
+static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40;
+static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56;
+static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word MegamorphicCache_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word MirrorReference_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word NativeArguments_StructSize = 32;
+static constexpr dart::compiler::target::word Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
+static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40;
+static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word Script_InstanceSize = 104;
+static constexpr dart::compiler::target::word SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word String_InstanceSize = 16;
+static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64;
+static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40;
+static constexpr dart::compiler::target::word UnhandledException_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
#else // !defined(PRODUCT)
-#if defined(TARGET_ARCH_ARM)
+#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
76;
static constexpr dart::compiler::target::word
@@ -2675,9 +3752,9 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 16;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 8;
-#endif // defined(TARGET_ARCH_ARM)
+#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_X64)
+#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
116;
static constexpr dart::compiler::target::word
@@ -3207,9 +4284,9 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_X64)
+#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_IA32)
+#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
76;
static constexpr dart::compiler::target::word
@@ -3728,9 +4805,9 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 16;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 8;
-#endif // defined(TARGET_ARCH_IA32)
+#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_ARM64)
+#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word Function_usage_counter_offset =
116;
static constexpr dart::compiler::target::word
@@ -4261,13 +5338,1078 @@
static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
static constexpr dart::compiler::target::word
WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_ARM64)
+#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word Function_usage_counter_offset =
+ 116;
+static constexpr dart::compiler::target::word
+ ICData_receivers_static_type_offset = 32;
+static constexpr dart::compiler::target::word
+ ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word ContextScope_element_size = 64;
+static constexpr dart::compiler::target::word
+ ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word ExceptionHandlers_element_size =
+ 12;
+static constexpr dart::compiler::target::word ObjectPool_elements_start_offset =
+ 16;
+static constexpr dart::compiler::target::word ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetJIT = 40;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetAOT = 22;
+static constexpr dart::compiler::target::word
+ Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word OldPage_kBytesPerCardLog2 = 10;
+static constexpr dart::compiler::target::word
+ NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_kTestResult = 0;
+static constexpr dart::compiler::target::word TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_count_offset =
+ 32;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_size_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_name_offset =
+ 0;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word Array_data_offset = 24;
+static constexpr dart::compiler::target::word Array_length_offset = 16;
+static constexpr dart::compiler::target::word Array_tags_offset = 0;
+static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word Class_declaration_type_offset =
+ 104;
+static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
+ 164;
+static constexpr dart::compiler::target::word Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word Code_saved_instructions_offset =
+ 48;
+static constexpr dart::compiler::target::word Code_owner_offset = 56;
+static constexpr dart::compiler::target::word Context_num_variables_offset = 8;
+static constexpr dart::compiler::target::word Context_parent_offset = 16;
+static constexpr dart::compiler::target::word Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 80;
+static constexpr dart::compiler::target::word
+ Field_guarded_list_length_in_object_offset_offset = 88;
+static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
+ 48;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 82;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 90;
+static constexpr dart::compiler::target::word Function_code_offset = 72;
+static constexpr dart::compiler::target::word Function_data_offset = 56;
+static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
+ 8, 16};
+static constexpr dart::compiler::target::word Function_kind_tag_offset = 104;
+static constexpr dart::compiler::target::word Function_packed_fields_offset =
+ 108;
+static constexpr dart::compiler::target::word Function_parameter_names_offset =
+ 40;
+static constexpr dart::compiler::target::word Function_signature_offset = 48;
+static constexpr dart::compiler::target::word FutureOr_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word GrowableObjectArray_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word OldPage_card_table_offset = 40;
+static constexpr dart::compiler::target::word
+ CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word ICData_owner_offset = 40;
+static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
+static constexpr dart::compiler::target::word Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
+static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
+static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
+static constexpr dart::compiler::target::word
+ Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word LinkedHashMap_hash_mask_offset =
+ 24;
+static constexpr dart::compiler::target::word LinkedHashMap_index_offset = 16;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word LinkedHashMap_used_data_offset =
+ 40;
+static constexpr dart::compiler::target::word LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word MarkingStackBlock_top_offset = 8;
+static constexpr dart::compiler::target::word MegamorphicCache_buckets_offset =
+ 24;
+static constexpr dart::compiler::target::word MegamorphicCache_mask_offset = 32;
+static constexpr dart::compiler::target::word Mint_value_offset = 8;
+static constexpr dart::compiler::target::word NativeArguments_argc_tag_offset =
+ 8;
+static constexpr dart::compiler::target::word NativeArguments_argv_offset = 16;
+static constexpr dart::compiler::target::word NativeArguments_retval_offset =
+ 24;
+static constexpr dart::compiler::target::word NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word ObjectStore_double_type_offset =
+ 256;
+static constexpr dart::compiler::target::word ObjectStore_int_type_offset = 136;
+static constexpr dart::compiler::target::word ObjectStore_string_type_offset =
+ 312;
+static constexpr dart::compiler::target::word ObjectStore_type_type_offset = 96;
+static constexpr dart::compiler::target::word OneByteString_data_offset = 16;
+static constexpr dart::compiler::target::word PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word Pointer_type_arguments_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_target_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word StoreBufferBlock_pointers_offset =
+ 16;
+static constexpr dart::compiler::target::word StoreBufferBlock_top_offset = 8;
+static constexpr dart::compiler::target::word String_hash_offset = 4;
+static constexpr dart::compiler::target::word String_length_offset = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word Thread_active_exception_offset =
+ 1392;
+static constexpr dart::compiler::target::word Thread_active_stacktrace_offset =
+ 1400;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word Thread_api_top_scope_offset =
+ 1472;
+static constexpr dart::compiler::target::word
+ Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word Thread_bool_false_offset = 208;
+static constexpr dart::compiler::target::word Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1488;
+static constexpr dart::compiler::target::word
+ Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 432;
+static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
+ 608;
+static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
+ 440;
+static constexpr dart::compiler::target::word Thread_double_abs_address_offset =
+ 680;
+static constexpr dart::compiler::target::word
+ Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word Thread_execution_state_offset =
+ 1432;
+static constexpr dart::compiler::target::word
+ Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word Thread_float_not_address_offset =
+ 688;
+static constexpr dart::compiler::target::word
+ Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word Thread_global_object_pool_offset =
+ 1408;
+static constexpr dart::compiler::target::word
+ Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
+ 1464;
+static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word Thread_field_table_values_offset =
+ 128;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_without_fpu_regs_stub_offset = 264;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word Thread_object_null_offset = 192;
+static constexpr dart::compiler::target::word
+ Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1416;
+static constexpr dart::compiler::target::word
+ Thread_saved_shadow_call_stack_offset = 1424;
+static constexpr dart::compiler::target::word Thread_safepoint_state_offset =
+ 1440;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word Thread_stack_limit_offset = 64;
+static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset =
+ 112;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word Thread_store_buffer_block_offset =
+ 152;
+static constexpr dart::compiler::target::word
+ Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word Thread_top_offset = 96;
+static constexpr dart::compiler::target::word Thread_top_resource_offset = 40;
+static constexpr dart::compiler::target::word
+ Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word Thread_write_barrier_code_offset =
+ 216;
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset =
+ 72;
+static constexpr dart::compiler::target::word Thread_callback_code_offset =
+ 1448;
+static constexpr dart::compiler::target::word
+ Thread_callback_stack_return_offset = 1456;
+static constexpr dart::compiler::target::word TimelineStream_enabled_offset =
+ 16;
+static constexpr dart::compiler::target::word TwoByteString_data_offset = 16;
+static constexpr dart::compiler::target::word Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word Type_hash_offset = 40;
+static constexpr dart::compiler::target::word Type_type_class_id_offset = 24;
+static constexpr dart::compiler::target::word Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 60;
+static constexpr dart::compiler::target::word TypeParameter_nullability_offset =
+ 63;
+static constexpr dart::compiler::target::word
+ TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
+static constexpr dart::compiler::target::word TypeArguments_nullability_offset =
+ 32;
+static constexpr dart::compiler::target::word TypeArguments_types_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62;
+static constexpr dart::compiler::target::word TypeParameter_name_offset = 24;
+static constexpr dart::compiler::target::word TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16;
+static constexpr dart::compiler::target::word TypedDataView_data_offset = 24;
+static constexpr dart::compiler::target::word
+ TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_value_offset = 16;
+static constexpr dart::compiler::target::word Array_elements_start_offset = 24;
+static constexpr dart::compiler::target::word Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word TypeArguments_element_size = 8;
+static constexpr dart::compiler::target::word Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, -1, -1, 1336, 1344,
+ 1352, 1360, 1368, -1, 1376, 1384, -1, -1};
+static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
+static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word Array_header_size = 24;
+static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word Class_InstanceSize = 200;
+static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word Code_InstanceSize = 144;
+static constexpr dart::compiler::target::word CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word CompressedStackMaps_HeaderSize =
+ 16;
+static constexpr dart::compiler::target::word Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word Context_header_size = 24;
+static constexpr dart::compiler::target::word ContextScope_InstanceSize = 16;
+static constexpr dart::compiler::target::word Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word DynamicLibrary_InstanceSize = 16;
+static constexpr dart::compiler::target::word ExceptionHandlers_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word ExternalTypedData_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Field_InstanceSize = 96;
+static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word Function_InstanceSize = 128;
+static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72;
+static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word ICData_InstanceSize = 56;
+static constexpr dart::compiler::target::word Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word Instructions_UnalignedHeaderSize =
+ 16;
+static constexpr dart::compiler::target::word
+ InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize =
+ 120;
+static constexpr dart::compiler::target::word LanguageError_InstanceSize = 48;
+static constexpr dart::compiler::target::word Library_InstanceSize = 160;
+static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40;
+static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56;
+static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word MegamorphicCache_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word MirrorReference_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word NativeArguments_StructSize = 32;
+static constexpr dart::compiler::target::word Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
+static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word Script_InstanceSize = 88;
+static constexpr dart::compiler::target::word SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word String_InstanceSize = 16;
+static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64;
+static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40;
+static constexpr dart::compiler::target::word UnhandledException_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word Function_usage_counter_offset =
+ 116;
+static constexpr dart::compiler::target::word
+ ICData_receivers_static_type_offset = 32;
+static constexpr dart::compiler::target::word
+ ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word ContextScope_element_size = 64;
+static constexpr dart::compiler::target::word
+ ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word ExceptionHandlers_element_size =
+ 12;
+static constexpr dart::compiler::target::word ObjectPool_elements_start_offset =
+ 16;
+static constexpr dart::compiler::target::word ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetJIT = 48;
+static constexpr dart::compiler::target::word
+ Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ Instructions_kPolymorphicEntryOffsetAOT = 20;
+static constexpr dart::compiler::target::word
+ Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word OldPage_kBytesPerCardLog2 = 10;
+static constexpr dart::compiler::target::word
+ NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_kTestResult = 0;
+static constexpr dart::compiler::target::word TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_count_offset =
+ 32;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_size_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word ArgumentsDescriptor_name_offset =
+ 0;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word Array_data_offset = 24;
+static constexpr dart::compiler::target::word Array_length_offset = 16;
+static constexpr dart::compiler::target::word Array_tags_offset = 0;
+static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word Class_declaration_type_offset =
+ 104;
+static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
+ 164;
+static constexpr dart::compiler::target::word Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word Code_saved_instructions_offset =
+ 48;
+static constexpr dart::compiler::target::word Code_owner_offset = 56;
+static constexpr dart::compiler::target::word Context_num_variables_offset = 8;
+static constexpr dart::compiler::target::word Context_parent_offset = 16;
+static constexpr dart::compiler::target::word Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 80;
+static constexpr dart::compiler::target::word
+ Field_guarded_list_length_in_object_offset_offset = 88;
+static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
+ 48;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 82;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 90;
+static constexpr dart::compiler::target::word Function_code_offset = 72;
+static constexpr dart::compiler::target::word Function_data_offset = 56;
+static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
+ 8, 16};
+static constexpr dart::compiler::target::word Function_kind_tag_offset = 104;
+static constexpr dart::compiler::target::word Function_packed_fields_offset =
+ 108;
+static constexpr dart::compiler::target::word Function_parameter_names_offset =
+ 40;
+static constexpr dart::compiler::target::word Function_signature_offset = 48;
+static constexpr dart::compiler::target::word FutureOr_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word GrowableObjectArray_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word OldPage_card_table_offset = 40;
+static constexpr dart::compiler::target::word
+ CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word ICData_owner_offset = 40;
+static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
+static constexpr dart::compiler::target::word Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
+static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
+static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
+static constexpr dart::compiler::target::word
+ Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word LinkedHashMap_hash_mask_offset =
+ 24;
+static constexpr dart::compiler::target::word LinkedHashMap_index_offset = 16;
+static constexpr dart::compiler::target::word
+ LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word LinkedHashMap_used_data_offset =
+ 40;
+static constexpr dart::compiler::target::word LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word MarkingStackBlock_top_offset = 8;
+static constexpr dart::compiler::target::word MegamorphicCache_buckets_offset =
+ 24;
+static constexpr dart::compiler::target::word MegamorphicCache_mask_offset = 32;
+static constexpr dart::compiler::target::word Mint_value_offset = 8;
+static constexpr dart::compiler::target::word NativeArguments_argc_tag_offset =
+ 8;
+static constexpr dart::compiler::target::word NativeArguments_argv_offset = 16;
+static constexpr dart::compiler::target::word NativeArguments_retval_offset =
+ 24;
+static constexpr dart::compiler::target::word NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word ObjectStore_double_type_offset =
+ 256;
+static constexpr dart::compiler::target::word ObjectStore_int_type_offset = 136;
+static constexpr dart::compiler::target::word ObjectStore_string_type_offset =
+ 312;
+static constexpr dart::compiler::target::word ObjectStore_type_type_offset = 96;
+static constexpr dart::compiler::target::word OneByteString_data_offset = 16;
+static constexpr dart::compiler::target::word PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word Pointer_type_arguments_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_target_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word StoreBufferBlock_pointers_offset =
+ 16;
+static constexpr dart::compiler::target::word StoreBufferBlock_top_offset = 8;
+static constexpr dart::compiler::target::word String_hash_offset = 4;
+static constexpr dart::compiler::target::word String_length_offset = 8;
+static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word Thread_active_exception_offset =
+ 1464;
+static constexpr dart::compiler::target::word Thread_active_stacktrace_offset =
+ 1472;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word Thread_api_top_scope_offset =
+ 1544;
+static constexpr dart::compiler::target::word
+ Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word Thread_bool_false_offset = 208;
+static constexpr dart::compiler::target::word Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1560;
+static constexpr dart::compiler::target::word
+ Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 432;
+static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
+ 608;
+static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
+ 440;
+static constexpr dart::compiler::target::word Thread_double_abs_address_offset =
+ 680;
+static constexpr dart::compiler::target::word
+ Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word Thread_execution_state_offset =
+ 1504;
+static constexpr dart::compiler::target::word
+ Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word Thread_float_not_address_offset =
+ 688;
+static constexpr dart::compiler::target::word
+ Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word Thread_global_object_pool_offset =
+ 1480;
+static constexpr dart::compiler::target::word
+ Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
+ 1536;
+static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word Thread_field_table_values_offset =
+ 128;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ Thread_late_initialization_error_shared_without_fpu_regs_stub_offset = 264;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word Thread_object_null_offset = 192;
+static constexpr dart::compiler::target::word
+ Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1488;
+static constexpr dart::compiler::target::word
+ Thread_saved_shadow_call_stack_offset = 1496;
+static constexpr dart::compiler::target::word Thread_safepoint_state_offset =
+ 1512;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word Thread_stack_limit_offset = 64;
+static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset =
+ 112;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word Thread_store_buffer_block_offset =
+ 152;
+static constexpr dart::compiler::target::word
+ Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word Thread_top_offset = 96;
+static constexpr dart::compiler::target::word Thread_top_resource_offset = 40;
+static constexpr dart::compiler::target::word
+ Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word Thread_write_barrier_code_offset =
+ 216;
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset =
+ 72;
+static constexpr dart::compiler::target::word Thread_callback_code_offset =
+ 1520;
+static constexpr dart::compiler::target::word
+ Thread_callback_stack_return_offset = 1528;
+static constexpr dart::compiler::target::word TimelineStream_enabled_offset =
+ 16;
+static constexpr dart::compiler::target::word TwoByteString_data_offset = 16;
+static constexpr dart::compiler::target::word Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word Type_hash_offset = 40;
+static constexpr dart::compiler::target::word Type_type_class_id_offset = 24;
+static constexpr dart::compiler::target::word Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 60;
+static constexpr dart::compiler::target::word TypeParameter_nullability_offset =
+ 63;
+static constexpr dart::compiler::target::word
+ TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
+static constexpr dart::compiler::target::word TypeArguments_nullability_offset =
+ 32;
+static constexpr dart::compiler::target::word TypeArguments_types_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40;
+static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62;
+static constexpr dart::compiler::target::word TypeParameter_name_offset = 24;
+static constexpr dart::compiler::target::word TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16;
+static constexpr dart::compiler::target::word TypedDataView_data_offset = 24;
+static constexpr dart::compiler::target::word
+ TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word WeakProperty_value_offset = 16;
+static constexpr dart::compiler::target::word Array_elements_start_offset = 24;
+static constexpr dart::compiler::target::word Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word TypeArguments_element_size = 8;
+static constexpr dart::compiler::target::word Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384,
+ 1392, 1400, 1408, 1416, -1, -1, -1, -1, 1424, 1432, -1,
+ -1, 1440, 1448, 1456, -1, -1, -1, -1, -1, -1};
+static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
+static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word Array_header_size = 24;
+static constexpr dart::compiler::target::word Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word Class_InstanceSize = 200;
+static constexpr dart::compiler::target::word Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word Code_InstanceSize = 144;
+static constexpr dart::compiler::target::word CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word CompressedStackMaps_HeaderSize =
+ 16;
+static constexpr dart::compiler::target::word Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word Context_header_size = 24;
+static constexpr dart::compiler::target::word ContextScope_InstanceSize = 16;
+static constexpr dart::compiler::target::word Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word DynamicLibrary_InstanceSize = 16;
+static constexpr dart::compiler::target::word ExceptionHandlers_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word
+ ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word ExternalTypedData_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Field_InstanceSize = 96;
+static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word Function_InstanceSize = 128;
+static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72;
+static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word ICData_InstanceSize = 56;
+static constexpr dart::compiler::target::word Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word Instructions_UnalignedHeaderSize =
+ 16;
+static constexpr dart::compiler::target::word
+ InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize =
+ 120;
+static constexpr dart::compiler::target::word LanguageError_InstanceSize = 48;
+static constexpr dart::compiler::target::word Library_InstanceSize = 160;
+static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40;
+static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56;
+static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word MegamorphicCache_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word MirrorReference_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word NativeArguments_StructSize = 32;
+static constexpr dart::compiler::target::word Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
+static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word Script_InstanceSize = 88;
+static constexpr dart::compiler::target::word SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word String_InstanceSize = 16;
+static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
+static constexpr dart::compiler::target::word Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64;
+static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
+static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40;
+static constexpr dart::compiler::target::word UnhandledException_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word WeakProperty_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
#endif // !defined(PRODUCT)
#if !defined(PRODUCT)
-#if defined(TARGET_ARCH_ARM)
+#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word
AOT_ContextScope_elements_start_offset = 12;
static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
@@ -4856,9 +6998,9 @@
16;
static constexpr dart::compiler::target::word
AOT_WeakSerializationReference_InstanceSize = 8;
-#endif // defined(TARGET_ARCH_ARM)
+#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_X64)
+#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word
AOT_ContextScope_elements_start_offset = 16;
static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
@@ -5451,12 +7593,12 @@
32;
static constexpr dart::compiler::target::word
AOT_WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_X64)
+#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_IA32)
-#endif // defined(TARGET_ARCH_IA32)
+#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
+#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_ARM64)
+#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word
AOT_ContextScope_elements_start_offset = 16;
static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
@@ -6050,11 +8192,1202 @@
32;
static constexpr dart::compiler::target::word
AOT_WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_ARM64)
+#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word
+ AOT_ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_element_size = 12;
+static constexpr dart::compiler::target::word
+ AOT_ObjectPool_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word AOT_Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word AOT_Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetJIT = 40;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetAOT = 22;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_kBytesPerCardLog2 =
+ 10;
+static constexpr dart::compiler::target::word
+ AOT_NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word AOT_String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word AOT_SubtypeTestCache_kTestResult =
+ 0;
+static constexpr dart::compiler::target::word AOT_TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AOT_AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_count_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_size_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_name_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_data_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_length_offset = 16;
+static constexpr dart::compiler::target::word AOT_Array_tags_offset = 0;
+static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_Class_declaration_type_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Class_num_type_arguments_offset = 164;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word
+ AOT_SharedClassTable_class_heap_stats_table_offset = 0;
+static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word AOT_Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word AOT_Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word AOT_Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Code_saved_instructions_offset = 48;
+static constexpr dart::compiler::target::word AOT_Code_owner_offset = 56;
+static constexpr dart::compiler::target::word AOT_Context_num_variables_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_Context_parent_offset = 16;
+static constexpr dart::compiler::target::word AOT_Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word AOT_Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word AOT_Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word AOT_Field_guarded_cid_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_in_object_offset_offset = 76;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_offset = 48;
+static constexpr dart::compiler::target::word AOT_Field_is_nullable_offset = 74;
+static constexpr dart::compiler::target::word AOT_Field_kind_bits_offset = 78;
+static constexpr dart::compiler::target::word AOT_Function_code_offset = 72;
+static constexpr dart::compiler::target::word AOT_Function_data_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_Function_entry_point_offset[] = {8, 16};
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Function_packed_fields_offset = 84;
+static constexpr dart::compiler::target::word
+ AOT_Function_parameter_names_offset = 40;
+static constexpr dart::compiler::target::word AOT_Function_signature_offset =
+ 48;
+static constexpr dart::compiler::target::word
+ AOT_FutureOr_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_card_table_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word AOT_ICData_owner_offset = 32;
+static constexpr dart::compiler::target::word AOT_ICData_state_bits_offset = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
+ 48;
+static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word AOT_Isolate_single_step_offset =
+ 96;
+static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_hash_mask_offset = 24;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_index_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_used_data_offset = 40;
+static constexpr dart::compiler::target::word AOT_LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_MarkingStackBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_buckets_offset = 24;
+static constexpr dart::compiler::target::word AOT_MegamorphicCache_mask_offset =
+ 32;
+static constexpr dart::compiler::target::word AOT_Mint_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_argc_tag_offset = 8;
+static constexpr dart::compiler::target::word AOT_NativeArguments_argv_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_retval_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_double_type_offset = 256;
+static constexpr dart::compiler::target::word AOT_ObjectStore_int_type_offset =
+ 136;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_string_type_offset = 312;
+static constexpr dart::compiler::target::word AOT_ObjectStore_type_type_offset =
+ 96;
+static constexpr dart::compiler::target::word AOT_OneByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Pointer_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_target_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word
+ AOT_StoreBufferBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_StoreBufferBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_String_hash_offset = 4;
+static constexpr dart::compiler::target::word AOT_String_length_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_exception_offset = 1392;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_stacktrace_offset = 1400;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word AOT_Thread_api_top_scope_offset =
+ 1472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word AOT_Thread_bool_false_offset =
+ 208;
+static constexpr dart::compiler::target::word AOT_Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ AOT_Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
+ 1488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
+ 432;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_entry_offset = 608;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_stub_offset = 440;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_abs_address_offset = 680;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word AOT_Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word
+ AOT_Thread_execution_state_offset = 1432;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_not_address_offset = 688;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word
+ AOT_Thread_global_object_pool_offset = 1408;
+static constexpr dart::compiler::target::word
+ AOT_Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_through_ffi_offset = 1464;
+static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Thread_field_table_values_offset = 128;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ AOT_Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ AOT_Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_without_fpu_regs_stub_offset =
+ 264;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word AOT_Thread_object_null_offset =
+ 192;
+static constexpr dart::compiler::target::word
+ AOT_Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset =
+ 1416;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_shadow_call_stack_offset = 1424;
+static constexpr dart::compiler::target::word
+ AOT_Thread_safepoint_state_offset = 1440;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word AOT_Thread_stack_limit_offset =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_stack_limit_offset = 112;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word
+ AOT_Thread_store_buffer_block_offset = 152;
+static constexpr dart::compiler::target::word
+ AOT_Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word AOT_Thread_top_offset = 96;
+static constexpr dart::compiler::target::word AOT_Thread_top_resource_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word AOT_Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_code_offset = 216;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_mask_offset = 72;
+static constexpr dart::compiler::target::word AOT_Thread_callback_code_offset =
+ 1448;
+static constexpr dart::compiler::target::word
+ AOT_Thread_callback_stack_return_offset = 1456;
+static constexpr dart::compiler::target::word
+ AOT_TimelineStream_enabled_offset = 16;
+static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40;
+static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
+ 60;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_nullability_offset = 63;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_nullability_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset =
+ 62;
+static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ AOT_TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word AOT_UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_value_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word AOT_TypeArguments_element_size =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_ClassTable_elements_start_offset = 0;
+static constexpr dart::compiler::target::word AOT_ClassTable_element_size = 1;
+static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, -1, -1, 1336, 1344,
+ 1352, 1360, 1368, -1, 1376, 1384, -1, -1};
+static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
+static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
+static constexpr dart::compiler::target::word AOT_CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_CompressedStackMaps_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Context_header_size = 24;
+static constexpr dart::compiler::target::word AOT_ContextScope_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_DynamicLibrary_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_FfiTrampolineData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Field_InstanceSize = 80;
+static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize =
+ 72;
+static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_ICData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_UnalignedHeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_KernelProgramInfo_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 152;
+static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_LocalVarDescriptors_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_MirrorReference_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_NativeArguments_StructSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
+ 64;
+static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_WeakProperty_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word
+ AOT_ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_element_size = 12;
+static constexpr dart::compiler::target::word
+ AOT_ObjectPool_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word AOT_Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word AOT_Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetJIT = 48;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetAOT = 20;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_kBytesPerCardLog2 =
+ 10;
+static constexpr dart::compiler::target::word
+ AOT_NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word AOT_String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word AOT_SubtypeTestCache_kTestResult =
+ 0;
+static constexpr dart::compiler::target::word AOT_TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AOT_AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_count_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_size_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_name_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_data_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_length_offset = 16;
+static constexpr dart::compiler::target::word AOT_Array_tags_offset = 0;
+static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_Class_declaration_type_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Class_num_type_arguments_offset = 164;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word
+ AOT_SharedClassTable_class_heap_stats_table_offset = 0;
+static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word AOT_Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word AOT_Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word AOT_Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Code_saved_instructions_offset = 48;
+static constexpr dart::compiler::target::word AOT_Code_owner_offset = 56;
+static constexpr dart::compiler::target::word AOT_Context_num_variables_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_Context_parent_offset = 16;
+static constexpr dart::compiler::target::word AOT_Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word AOT_Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word AOT_Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word AOT_Field_guarded_cid_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_in_object_offset_offset = 76;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_offset = 48;
+static constexpr dart::compiler::target::word AOT_Field_is_nullable_offset = 74;
+static constexpr dart::compiler::target::word AOT_Field_kind_bits_offset = 78;
+static constexpr dart::compiler::target::word AOT_Function_code_offset = 72;
+static constexpr dart::compiler::target::word AOT_Function_data_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_Function_entry_point_offset[] = {8, 16};
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Function_packed_fields_offset = 84;
+static constexpr dart::compiler::target::word
+ AOT_Function_parameter_names_offset = 40;
+static constexpr dart::compiler::target::word AOT_Function_signature_offset =
+ 48;
+static constexpr dart::compiler::target::word
+ AOT_FutureOr_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_card_table_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word AOT_ICData_owner_offset = 32;
+static constexpr dart::compiler::target::word AOT_ICData_state_bits_offset = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
+ 48;
+static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word AOT_Isolate_single_step_offset =
+ 96;
+static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_hash_mask_offset = 24;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_index_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_used_data_offset = 40;
+static constexpr dart::compiler::target::word AOT_LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_MarkingStackBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_buckets_offset = 24;
+static constexpr dart::compiler::target::word AOT_MegamorphicCache_mask_offset =
+ 32;
+static constexpr dart::compiler::target::word AOT_Mint_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_argc_tag_offset = 8;
+static constexpr dart::compiler::target::word AOT_NativeArguments_argv_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_retval_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_double_type_offset = 256;
+static constexpr dart::compiler::target::word AOT_ObjectStore_int_type_offset =
+ 136;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_string_type_offset = 312;
+static constexpr dart::compiler::target::word AOT_ObjectStore_type_type_offset =
+ 96;
+static constexpr dart::compiler::target::word AOT_OneByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Pointer_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_target_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word
+ AOT_StoreBufferBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_StoreBufferBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_String_hash_offset = 4;
+static constexpr dart::compiler::target::word AOT_String_length_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_exception_offset = 1464;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_stacktrace_offset = 1472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word AOT_Thread_api_top_scope_offset =
+ 1544;
+static constexpr dart::compiler::target::word
+ AOT_Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word AOT_Thread_bool_false_offset =
+ 208;
+static constexpr dart::compiler::target::word AOT_Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ AOT_Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
+ 1560;
+static constexpr dart::compiler::target::word
+ AOT_Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
+ 432;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_entry_offset = 608;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_stub_offset = 440;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_abs_address_offset = 680;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word AOT_Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word
+ AOT_Thread_execution_state_offset = 1504;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_not_address_offset = 688;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word
+ AOT_Thread_global_object_pool_offset = 1480;
+static constexpr dart::compiler::target::word
+ AOT_Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_through_ffi_offset = 1536;
+static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Thread_field_table_values_offset = 128;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ AOT_Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ AOT_Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_without_fpu_regs_stub_offset =
+ 264;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word AOT_Thread_object_null_offset =
+ 192;
+static constexpr dart::compiler::target::word
+ AOT_Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset =
+ 1488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_shadow_call_stack_offset = 1496;
+static constexpr dart::compiler::target::word
+ AOT_Thread_safepoint_state_offset = 1512;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word AOT_Thread_stack_limit_offset =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_stack_limit_offset = 112;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word
+ AOT_Thread_store_buffer_block_offset = 152;
+static constexpr dart::compiler::target::word
+ AOT_Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word AOT_Thread_top_offset = 96;
+static constexpr dart::compiler::target::word AOT_Thread_top_resource_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word AOT_Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_code_offset = 216;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_mask_offset = 72;
+static constexpr dart::compiler::target::word AOT_Thread_callback_code_offset =
+ 1520;
+static constexpr dart::compiler::target::word
+ AOT_Thread_callback_stack_return_offset = 1528;
+static constexpr dart::compiler::target::word
+ AOT_TimelineStream_enabled_offset = 16;
+static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40;
+static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
+ 60;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_nullability_offset = 63;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_nullability_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset =
+ 62;
+static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ AOT_TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word AOT_UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_value_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word AOT_TypeArguments_element_size =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_ClassTable_elements_start_offset = 0;
+static constexpr dart::compiler::target::word AOT_ClassTable_element_size = 1;
+static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384,
+ 1392, 1400, 1408, 1416, -1, -1, -1, -1, 1424, 1432, -1,
+ -1, 1440, 1448, 1456, -1, -1, -1, -1, -1, -1};
+static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
+static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 152;
+static constexpr dart::compiler::target::word AOT_CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_CompressedStackMaps_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Context_header_size = 24;
+static constexpr dart::compiler::target::word AOT_ContextScope_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_DynamicLibrary_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_FfiTrampolineData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Field_InstanceSize = 80;
+static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize =
+ 72;
+static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_ICData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_UnalignedHeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_KernelProgramInfo_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 152;
+static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_LocalVarDescriptors_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_MirrorReference_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_NativeArguments_StructSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
+ 64;
+static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_WeakProperty_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
#else // !defined(PRODUCT)
-#if defined(TARGET_ARCH_ARM)
+#if defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word
AOT_ContextScope_elements_start_offset = 12;
static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
@@ -6636,9 +9969,9 @@
16;
static constexpr dart::compiler::target::word
AOT_WeakSerializationReference_InstanceSize = 8;
-#endif // defined(TARGET_ARCH_ARM)
+#endif // defined(TARGET_ARCH_ARM) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_X64)
+#if defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word
AOT_ContextScope_elements_start_offset = 16;
static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
@@ -7224,12 +10557,12 @@
32;
static constexpr dart::compiler::target::word
AOT_WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_X64)
+#endif // defined(TARGET_ARCH_X64) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_IA32)
-#endif // defined(TARGET_ARCH_IA32)
+#if defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
+#endif // defined(TARGET_ARCH_IA32) && !defined(DART_COMPRESSED_POINTERS)
-#if defined(TARGET_ARCH_ARM64)
+#if defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
static constexpr dart::compiler::target::word
AOT_ContextScope_elements_start_offset = 16;
static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
@@ -7816,7 +11149,1184 @@
32;
static constexpr dart::compiler::target::word
AOT_WeakSerializationReference_InstanceSize = 16;
-#endif // defined(TARGET_ARCH_ARM64)
+#endif // defined(TARGET_ARCH_ARM64) && !defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word
+ AOT_ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_element_size = 12;
+static constexpr dart::compiler::target::word
+ AOT_ObjectPool_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word AOT_Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word AOT_Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetJIT = 40;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetAOT = 22;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_kBytesPerCardLog2 =
+ 10;
+static constexpr dart::compiler::target::word
+ AOT_NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word AOT_String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word AOT_SubtypeTestCache_kTestResult =
+ 0;
+static constexpr dart::compiler::target::word AOT_TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AOT_AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_count_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_size_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_name_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_data_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_length_offset = 16;
+static constexpr dart::compiler::target::word AOT_Array_tags_offset = 0;
+static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_Class_declaration_type_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Class_num_type_arguments_offset = 164;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word AOT_Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word AOT_Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word AOT_Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Code_saved_instructions_offset = 48;
+static constexpr dart::compiler::target::word AOT_Code_owner_offset = 56;
+static constexpr dart::compiler::target::word AOT_Context_num_variables_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_Context_parent_offset = 16;
+static constexpr dart::compiler::target::word AOT_Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word AOT_Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word AOT_Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word AOT_Field_guarded_cid_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_in_object_offset_offset = 76;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_offset = 48;
+static constexpr dart::compiler::target::word AOT_Field_is_nullable_offset = 74;
+static constexpr dart::compiler::target::word AOT_Field_kind_bits_offset = 78;
+static constexpr dart::compiler::target::word AOT_Function_code_offset = 72;
+static constexpr dart::compiler::target::word AOT_Function_data_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_Function_entry_point_offset[] = {8, 16};
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Function_packed_fields_offset = 84;
+static constexpr dart::compiler::target::word
+ AOT_Function_parameter_names_offset = 40;
+static constexpr dart::compiler::target::word AOT_Function_signature_offset =
+ 48;
+static constexpr dart::compiler::target::word
+ AOT_FutureOr_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_card_table_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word AOT_ICData_owner_offset = 32;
+static constexpr dart::compiler::target::word AOT_ICData_state_bits_offset = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
+ 48;
+static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_hash_mask_offset = 24;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_index_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_used_data_offset = 40;
+static constexpr dart::compiler::target::word AOT_LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_MarkingStackBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_buckets_offset = 24;
+static constexpr dart::compiler::target::word AOT_MegamorphicCache_mask_offset =
+ 32;
+static constexpr dart::compiler::target::word AOT_Mint_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_argc_tag_offset = 8;
+static constexpr dart::compiler::target::word AOT_NativeArguments_argv_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_retval_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_double_type_offset = 256;
+static constexpr dart::compiler::target::word AOT_ObjectStore_int_type_offset =
+ 136;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_string_type_offset = 312;
+static constexpr dart::compiler::target::word AOT_ObjectStore_type_type_offset =
+ 96;
+static constexpr dart::compiler::target::word AOT_OneByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Pointer_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_target_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word
+ AOT_StoreBufferBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_StoreBufferBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_String_hash_offset = 4;
+static constexpr dart::compiler::target::word AOT_String_length_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_exception_offset = 1392;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_stacktrace_offset = 1400;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word AOT_Thread_api_top_scope_offset =
+ 1472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word AOT_Thread_bool_false_offset =
+ 208;
+static constexpr dart::compiler::target::word AOT_Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ AOT_Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
+ 1488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
+ 432;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_entry_offset = 608;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_stub_offset = 440;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_abs_address_offset = 680;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word AOT_Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word
+ AOT_Thread_execution_state_offset = 1432;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_not_address_offset = 688;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word
+ AOT_Thread_global_object_pool_offset = 1408;
+static constexpr dart::compiler::target::word
+ AOT_Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_through_ffi_offset = 1464;
+static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Thread_field_table_values_offset = 128;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ AOT_Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ AOT_Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_without_fpu_regs_stub_offset =
+ 264;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word AOT_Thread_object_null_offset =
+ 192;
+static constexpr dart::compiler::target::word
+ AOT_Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset =
+ 1416;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_shadow_call_stack_offset = 1424;
+static constexpr dart::compiler::target::word
+ AOT_Thread_safepoint_state_offset = 1440;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word AOT_Thread_stack_limit_offset =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_stack_limit_offset = 112;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word
+ AOT_Thread_store_buffer_block_offset = 152;
+static constexpr dart::compiler::target::word
+ AOT_Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word AOT_Thread_top_offset = 96;
+static constexpr dart::compiler::target::word AOT_Thread_top_resource_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word AOT_Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_code_offset = 216;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_mask_offset = 72;
+static constexpr dart::compiler::target::word AOT_Thread_callback_code_offset =
+ 1448;
+static constexpr dart::compiler::target::word
+ AOT_Thread_callback_stack_return_offset = 1456;
+static constexpr dart::compiler::target::word
+ AOT_TimelineStream_enabled_offset = 16;
+static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40;
+static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
+ 60;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_nullability_offset = 63;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_nullability_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset =
+ 62;
+static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ AOT_TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word AOT_UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_value_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word AOT_TypeArguments_element_size =
+ 8;
+static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, -1, -1, 1336, 1344,
+ 1352, 1360, 1368, -1, 1376, 1384, -1, -1};
+static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
+static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_CompressedStackMaps_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Context_header_size = 24;
+static constexpr dart::compiler::target::word AOT_ContextScope_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_DynamicLibrary_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_FfiTrampolineData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Field_InstanceSize = 80;
+static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize =
+ 72;
+static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_ICData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_UnalignedHeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_KernelProgramInfo_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 152;
+static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_LocalVarDescriptors_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_MirrorReference_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_NativeArguments_StructSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
+ 64;
+static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_WeakProperty_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_X64) && defined(DART_COMPRESSED_POINTERS)
+
+#if defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
+static constexpr dart::compiler::target::word
+ AOT_ContextScope_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ContextScope_element_size =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_elements_start_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_element_size = 12;
+static constexpr dart::compiler::target::word
+ AOT_ObjectPool_elements_start_offset = 16;
+static constexpr dart::compiler::target::word AOT_ObjectPool_element_size = 8;
+static constexpr dart::compiler::target::word AOT_Array_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word AOT_Array_kMaxNewSpaceElements =
+ 32765;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetJIT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetJIT = 48;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kMonomorphicEntryOffsetAOT = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kPolymorphicEntryOffsetAOT = 20;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kBarePayloadAlignment = 4;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_kNonBarePayloadAlignment = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_kBytesPerCardLog2 =
+ 10;
+static constexpr dart::compiler::target::word
+ AOT_NativeEntry_kNumCallWrapperArguments = 2;
+static constexpr dart::compiler::target::word AOT_String_kMaxElements =
+ 2305843009213693951;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kFunctionTypeArguments = 5;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceClassIdOrFunction = 1;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kDestinationType = 2;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceDelayedFunctionTypeArguments = 7;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceParentFunctionTypeArguments = 6;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstanceTypeArguments = 3;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kInstantiatorTypeArguments = 4;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_kTestEntryLength = 8;
+static constexpr dart::compiler::target::word AOT_SubtypeTestCache_kTestResult =
+ 0;
+static constexpr dart::compiler::target::word AOT_TypeArguments_kMaxElements =
+ 576460752303423487;
+static constexpr dart::compiler::target::word
+ AOT_AbstractType_type_test_stub_entry_point_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_count_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_size_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_first_named_entry_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_named_entry_size = 16;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_name_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_position_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_positional_count_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_ArgumentsDescriptor_type_args_len_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_data_offset = 24;
+static constexpr dart::compiler::target::word AOT_Array_length_offset = 16;
+static constexpr dart::compiler::target::word AOT_Array_tags_offset = 0;
+static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_Class_declaration_type_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Class_num_type_arguments_offset = 164;
+static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
+static constexpr dart::compiler::target::word
+ AOT_Class_host_type_arguments_field_offset_in_words_offset = 176;
+static constexpr dart::compiler::target::word AOT_Closure_context_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Closure_delayed_type_arguments_offset = 24;
+static constexpr dart::compiler::target::word AOT_Closure_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Closure_function_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word AOT_Closure_hash_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_Closure_instantiator_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_ClosureData_default_type_arguments_info_offset = 40;
+static constexpr dart::compiler::target::word AOT_Code_object_pool_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_Code_saved_instructions_offset = 48;
+static constexpr dart::compiler::target::word AOT_Code_owner_offset = 56;
+static constexpr dart::compiler::target::word AOT_Context_num_variables_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_Context_parent_offset = 16;
+static constexpr dart::compiler::target::word AOT_Double_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_external_data_offset = 16;
+static constexpr dart::compiler::target::word AOT_Float32x4_value_offset = 8;
+static constexpr dart::compiler::target::word AOT_Float64x2_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Field_initializer_function_offset = 32;
+static constexpr dart::compiler::target::word
+ AOT_Field_host_offset_or_field_id_offset = 40;
+static constexpr dart::compiler::target::word AOT_Field_guarded_cid_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_in_object_offset_offset = 76;
+static constexpr dart::compiler::target::word
+ AOT_Field_guarded_list_length_offset = 48;
+static constexpr dart::compiler::target::word AOT_Field_is_nullable_offset = 74;
+static constexpr dart::compiler::target::word AOT_Field_kind_bits_offset = 78;
+static constexpr dart::compiler::target::word AOT_Function_code_offset = 72;
+static constexpr dart::compiler::target::word AOT_Function_data_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_Function_entry_point_offset[] = {8, 16};
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Function_packed_fields_offset = 84;
+static constexpr dart::compiler::target::word
+ AOT_Function_parameter_names_offset = 40;
+static constexpr dart::compiler::target::word AOT_Function_signature_offset =
+ 48;
+static constexpr dart::compiler::target::word
+ AOT_FutureOr_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_length_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word AOT_OldPage_card_table_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_CallSiteData_arguments_descriptor_offset = 16;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedMask = 3;
+static constexpr dart::compiler::target::word AOT_ICData_NumArgsTestedShift = 0;
+static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 24;
+static constexpr dart::compiler::target::word AOT_ICData_owner_offset = 32;
+static constexpr dart::compiler::target::word AOT_ICData_state_bits_offset = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_shared_class_table_offset = 72;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_class_table_table_offset = 80;
+static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
+ 48;
+static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_Isolate_cached_object_store_offset = 64;
+static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_deleted_keys_offset = 48;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_hash_mask_offset = 24;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_index_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_type_arguments_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_LinkedHashMap_used_data_offset = 40;
+static constexpr dart::compiler::target::word AOT_LocalHandle_ptr_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_MarkingStackBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_MarkingStackBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_buckets_offset = 24;
+static constexpr dart::compiler::target::word AOT_MegamorphicCache_mask_offset =
+ 32;
+static constexpr dart::compiler::target::word AOT_Mint_value_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_argc_tag_offset = 8;
+static constexpr dart::compiler::target::word AOT_NativeArguments_argv_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_retval_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_NativeArguments_thread_offset = 0;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_double_type_offset = 256;
+static constexpr dart::compiler::target::word AOT_ObjectStore_int_type_offset =
+ 136;
+static constexpr dart::compiler::target::word
+ AOT_ObjectStore_string_type_offset = 312;
+static constexpr dart::compiler::target::word AOT_ObjectStore_type_type_offset =
+ 96;
+static constexpr dart::compiler::target::word AOT_OneByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_PointerBase_data_field_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Pointer_type_arguments_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_entry_point_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_lower_limit_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_target_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_upper_limit_offset = 26;
+static constexpr dart::compiler::target::word
+ AOT_StoreBufferBlock_pointers_offset = 16;
+static constexpr dart::compiler::target::word AOT_StoreBufferBlock_top_offset =
+ 8;
+static constexpr dart::compiler::target::word AOT_String_hash_offset = 4;
+static constexpr dart::compiler::target::word AOT_String_length_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_cache_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_Thread_AllocateArray_entry_point_offset = 720;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_exception_offset = 1464;
+static constexpr dart::compiler::target::word
+ AOT_Thread_active_stacktrace_offset = 1472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_code_offset = 224;
+static constexpr dart::compiler::target::word
+ AOT_Thread_array_write_barrier_entry_point_offset = 512;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_entry_point_offset = 528;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_with_fpu_regs_stub_offset = 344;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_entry_point_offset = 536;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_mint_without_fpu_regs_stub_offset = 352;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_entry_point_offset = 544;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_stub_offset = 360;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_entry_point_offset = 552;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_parameterized_stub_offset = 368;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_entry_point_offset = 560;
+static constexpr dart::compiler::target::word
+ AOT_Thread_allocate_object_slow_stub_offset = 376;
+static constexpr dart::compiler::target::word AOT_Thread_api_top_scope_offset =
+ 1544;
+static constexpr dart::compiler::target::word
+ AOT_Thread_auto_scope_native_wrapper_entry_point_offset = 648;
+static constexpr dart::compiler::target::word AOT_Thread_bool_false_offset =
+ 208;
+static constexpr dart::compiler::target::word AOT_Thread_bool_true_offset = 200;
+static constexpr dart::compiler::target::word
+ AOT_Thread_bootstrap_native_wrapper_entry_point_offset = 632;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_entry_point_offset = 520;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_to_runtime_stub_offset = 256;
+static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
+ 1560;
+static constexpr dart::compiler::target::word
+ AOT_Thread_dispatch_table_array_offset = 88;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
+ 600;
+static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
+ 432;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_entry_offset = 608;
+static constexpr dart::compiler::target::word
+ AOT_Thread_deoptimize_stub_offset = 440;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_abs_address_offset = 680;
+static constexpr dart::compiler::target::word
+ AOT_Thread_double_negate_address_offset = 672;
+static constexpr dart::compiler::target::word AOT_Thread_end_offset = 104;
+static constexpr dart::compiler::target::word
+ AOT_Thread_enter_safepoint_stub_offset = 480;
+static constexpr dart::compiler::target::word
+ AOT_Thread_execution_state_offset = 1504;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_safepoint_stub_offset = 488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_stub_offset = 496;
+static constexpr dart::compiler::target::word
+ AOT_Thread_call_native_through_safepoint_entry_point_offset = 616;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_allocation_stub_code_offset = 240;
+static constexpr dart::compiler::target::word
+ AOT_Thread_fix_callers_target_code_offset = 232;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_absolute_address_offset = 704;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_negate_address_offset = 696;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_not_address_offset = 688;
+static constexpr dart::compiler::target::word
+ AOT_Thread_float_zerow_address_offset = 712;
+static constexpr dart::compiler::target::word
+ AOT_Thread_global_object_pool_offset = 1480;
+static constexpr dart::compiler::target::word
+ AOT_Thread_invoke_dart_code_stub_offset = 248;
+static constexpr dart::compiler::target::word
+ AOT_Thread_exit_through_ffi_offset = 1536;
+static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
+static constexpr dart::compiler::target::word
+ AOT_Thread_field_table_values_offset = 128;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_return_stub_offset = 448;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_deopt_from_throw_stub_offset = 456;
+static constexpr dart::compiler::target::word
+ AOT_Thread_lazy_specialize_type_test_stub_offset = 472;
+static constexpr dart::compiler::target::word
+ AOT_Thread_marking_stack_block_offset = 160;
+static constexpr dart::compiler::target::word
+ AOT_Thread_megamorphic_call_checked_entry_offset = 584;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_entry_offset = 592;
+static constexpr dart::compiler::target::word
+ AOT_Thread_switchable_call_miss_stub_offset = 400;
+static constexpr dart::compiler::target::word
+ AOT_Thread_no_scope_native_wrapper_entry_point_offset = 640;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_with_fpu_regs_stub_offset = 272;
+static constexpr dart::compiler::target::word
+ AOT_Thread_late_initialization_error_shared_without_fpu_regs_stub_offset =
+ 264;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_with_fpu_regs_stub_offset = 288;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_error_shared_without_fpu_regs_stub_offset = 280;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_with_fpu_regs_stub_offset = 320;
+static constexpr dart::compiler::target::word
+ AOT_Thread_null_cast_error_shared_without_fpu_regs_stub_offset = 312;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_with_fpu_regs_stub_offset = 336;
+static constexpr dart::compiler::target::word
+ AOT_Thread_range_error_shared_without_fpu_regs_stub_offset = 328;
+static constexpr dart::compiler::target::word AOT_Thread_object_null_offset =
+ 192;
+static constexpr dart::compiler::target::word
+ AOT_Thread_predefined_symbols_address_offset = 656;
+static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset =
+ 1488;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_shadow_call_stack_offset = 1496;
+static constexpr dart::compiler::target::word
+ AOT_Thread_safepoint_state_offset = 1512;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_stub_offset = 464;
+static constexpr dart::compiler::target::word
+ AOT_Thread_slow_type_test_entry_point_offset = 624;
+static constexpr dart::compiler::target::word AOT_Thread_stack_limit_offset =
+ 64;
+static constexpr dart::compiler::target::word
+ AOT_Thread_saved_stack_limit_offset = 112;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_flags_offset = 120;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 576;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 392;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 568;
+static constexpr dart::compiler::target::word
+ AOT_Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 384;
+static constexpr dart::compiler::target::word
+ AOT_Thread_store_buffer_block_offset = 152;
+static constexpr dart::compiler::target::word
+ AOT_Thread_top_exit_frame_info_offset = 144;
+static constexpr dart::compiler::target::word AOT_Thread_top_offset = 96;
+static constexpr dart::compiler::target::word AOT_Thread_top_resource_offset =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_Thread_unboxed_int64_runtime_arg_offset = 184;
+static constexpr dart::compiler::target::word AOT_Thread_vm_tag_offset = 176;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_code_offset = 216;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_entry_point_offset = 504;
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_mask_offset = 72;
+static constexpr dart::compiler::target::word AOT_Thread_callback_code_offset =
+ 1520;
+static constexpr dart::compiler::target::word
+ AOT_Thread_callback_stack_return_offset = 1528;
+static constexpr dart::compiler::target::word
+ AOT_TimelineStream_enabled_offset = 16;
+static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32;
+static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40;
+static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48;
+static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49;
+static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_packed_fields_offset = 64;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_parameter_types_offset = 40;
+static constexpr dart::compiler::target::word
+ AOT_FunctionType_type_parameters_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_parameterized_class_id_offset = 56;
+static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
+ 60;
+static constexpr dart::compiler::target::word
+ AOT_TypeParameter_nullability_offset = 63;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_instantiations_offset = 8;
+static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_nullability_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset =
+ 62;
+static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset =
+ 24;
+static constexpr dart::compiler::target::word
+ AOT_TypedDataView_offset_in_bytes_offset = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_exception_offset = 8;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_stacktrace_offset = 16;
+static constexpr dart::compiler::target::word AOT_UserTag_tag_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_expected_cid_offset = 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_entrypoint_offset = 24;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_target_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_key_offset = 8;
+static constexpr dart::compiler::target::word AOT_WeakProperty_value_offset =
+ 16;
+static constexpr dart::compiler::target::word AOT_Array_elements_start_offset =
+ 24;
+static constexpr dart::compiler::target::word AOT_Array_element_size = 8;
+static constexpr dart::compiler::target::word
+ AOT_TypeArguments_elements_start_offset = 40;
+static constexpr dart::compiler::target::word AOT_TypeArguments_element_size =
+ 8;
+static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {
+ 8, 24, 16, 32};
+static constexpr dart::compiler::target::word
+ AOT_Thread_write_barrier_wrappers_thread_offset[] = {
+ 1304, 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384,
+ 1392, 1400, 1408, 1416, -1, -1, -1, -1, 1424, 1432, -1,
+ -1, 1440, 1448, 1456, -1, -1, -1, -1, -1, -1};
+static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Array_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Array_header_size = 24;
+static constexpr dart::compiler::target::word AOT_Bool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Capability_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_Class_InstanceSize = 184;
+static constexpr dart::compiler::target::word AOT_Closure_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_ClosureData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Code_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_CodeSourceMap_HeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_CompressedStackMaps_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Context_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Context_header_size = 24;
+static constexpr dart::compiler::target::word AOT_ContextScope_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Double_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_DynamicLibrary_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_ExceptionHandlers_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_ExternalOneByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTwoByteString_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_ExternalTypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_FfiTrampolineData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Field_InstanceSize = 80;
+static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize =
+ 72;
+static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_GrowableObjectArray_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_ICData_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Instance_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_Instructions_UnalignedHeaderSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_InstructionsSection_UnalignedHeaderSize = 40;
+static constexpr dart::compiler::target::word AOT_Int32x4_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_Integer_InstanceSize = 8;
+static constexpr dart::compiler::target::word
+ AOT_KernelProgramInfo_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize =
+ 48;
+static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 152;
+static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize =
+ 56;
+static constexpr dart::compiler::target::word
+ AOT_LocalVarDescriptors_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_MegamorphicCache_InstanceSize = 48;
+static constexpr dart::compiler::target::word AOT_Mint_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_MirrorReference_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word
+ AOT_MonomorphicSmiableCall_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Namespace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_NativeArguments_StructSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_Number_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_Object_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_ObjectPool_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
+static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
+static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 88;
+static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24;
+static constexpr dart::compiler::target::word
+ AOT_SingleTargetCache_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16;
+static constexpr dart::compiler::target::word
+ AOT_SubtypeTestCache_InstanceSize = 16;
+static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 32;
+static constexpr dart::compiler::target::word
+ AOT_TransferableTypedData_InstanceSize = 8;
+static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize =
+ 16;
+static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56;
+static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
+ 64;
+static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
+static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
+ 24;
+static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize =
+ 40;
+static constexpr dart::compiler::target::word
+ AOT_UnhandledException_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word AOT_UnwindError_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_UserTag_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_WeakProperty_InstanceSize =
+ 32;
+static constexpr dart::compiler::target::word
+ AOT_WeakSerializationReference_InstanceSize = 16;
+#endif // defined(TARGET_ARCH_ARM64) && defined(DART_COMPRESSED_POINTERS)
#endif // !defined(PRODUCT)
diff --git a/sdk/lib/_internal/vm/lib/ffi_allocation_patch.dart b/sdk/lib/_internal/vm/lib/ffi_allocation_patch.dart
index 5b794e6..daa428e 100644
--- a/sdk/lib/_internal/vm/lib/ffi_allocation_patch.dart
+++ b/sdk/lib/_internal/vm/lib/ffi_allocation_patch.dart
@@ -9,8 +9,6 @@
import 'dart:isolate';
extension AllocatorAlloc on Allocator {
- // TODO(http://dartbug.com/38721): Implement this in the CFE to remove the
- // invocation of sizeOf<T> to enable tree shaking.
// TODO(http://dartbug.com/39964): Add `alignmentOf<T>()` call.
@patch
Pointer<T> call<T extends NativeType>([int count = 1]) {
diff --git a/sdk/lib/_internal/vm/lib/ffi_patch.dart b/sdk/lib/_internal/vm/lib/ffi_patch.dart
index 8bc4c14..dd18559 100644
--- a/sdk/lib/_internal/vm/lib/ffi_patch.dart
+++ b/sdk/lib/_internal/vm/lib/ffi_patch.dart
@@ -204,6 +204,13 @@
Pointer<S> _loadPointer<S extends NativeType>(
Pointer pointer, int offsetInBytes) native "Ffi_loadPointer";
+S _loadStructNoStruct<S extends Struct>(Pointer<S> pointer, int index) {
+ if (S == Struct) {
+ throw ArgumentError("S should be a subtype of Struct.");
+ }
+ return _loadStruct(pointer, index);
+}
+
S _loadStruct<S extends Struct>(Pointer<S> pointer, int index)
native "Ffi_loadStruct";
@@ -511,10 +518,10 @@
extension StructPointer<T extends Struct> on Pointer<T> {
@patch
- T get ref => _loadStruct(this, 0);
+ T get ref => _loadStructNoStruct(this, 0);
@patch
- T operator [](int index) => _loadStruct(this, index);
+ T operator [](int index) => _loadStructNoStruct(this, index);
}
extension NativePort on SendPort {
diff --git a/sdk/lib/ffi/ffi.dart b/sdk/lib/ffi/ffi.dart
index 22ea459..aef06c1 100644
--- a/sdk/lib/ffi/ffi.dart
+++ b/sdk/lib/ffi/ffi.dart
@@ -545,9 +545,7 @@
/// The [address] must be aligned according to the struct alignment rules of
/// the platform.
///
- /// Support for invoking this extension method with non-constant [T] will be
- /// removed in the next stable version of Dart and it will become mandatory
- /// to invoke it with a compile-time constant [T].
+ /// This extension method must be invoked with a compile-time constant [T].
external T get ref;
/// Creates a reference to access the fields of this struct backed by native
@@ -556,9 +554,7 @@
/// The [address] must be aligned according to the struct alignment rules of
/// the platform.
///
- /// Support for invoking this extension method with non-constant [T] will be
- /// removed in the next stable version of Dart and it will become mandatory
- /// to invoke it with a compile-time constant [T].
+ /// This extension method must be invoked with a compile-time constant [T].
external T operator [](int index);
}
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 3208f10..9d54f24 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -17,27 +17,30 @@
Language/Expressions/Shift/integer_t01: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Shift/integer_t02: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign
+Language/Functions/External_Functions/not_connected_to_a_body_t01: SkipByDesign # Non-JS-interop external members are not supported
Language/Libraries_and_Scripts/Scripts/main_optional_parameters_t01: SkipByDesign # https://github.com/dart-lang/co19/issues/952
Language/Libraries_and_Scripts/Scripts/main_optional_parameters_t03: SkipByDesign # https://github.com/dart-lang/co19/issues/952
+Language/Libraries_and_Scripts/Scripts/top_level_syntax_t01: SkipByDesign # Non-JS-interop external members are not supported
+Language/Libraries_and_Scripts/top_level_syntax_t01: SkipByDesign # Non-JS-interop external members are not supported
Language/Metadata/before*: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/523.
Language/Reference/Operator_Precedence/precedence_15_unary_prefix_t08: SkipByDesign # binary '~' produces different results in JavaScript and Dart
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t01: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t02: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t03: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A02_t01: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A02_t04: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t01: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t02: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t03: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t04: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t06: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A04_t01: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A04_t02: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t01: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t02: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t03: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/syntax_A01_t03: SkipByDesign # External variables are not supported by dart2js
-LanguageFeatures/Abstract-external-fields/syntax_A02_t03: SkipByDesign # External variables are not supported by dart2js
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t01: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t02: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t03: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A02_t01: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A02_t04: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t01: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t02: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t03: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t04: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t06: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A04_t01: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A04_t02: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t01: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t02: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t03: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/syntax_A01_t03: SkipByDesign # Non-JS-interop external members are not supported
+LanguageFeatures/Abstract-external-fields/syntax_A02_t03: SkipByDesign # Non-JS-interop external members are not supported
LibTest/core/DateTime/DateTime.fromMicrosecondsSinceEpoch_A01_t01: SkipByDesign # microseconds are not supported in JavaScript
LibTest/core/DateTime/microsecond_A01_t01: SkipByDesign # microseconds are not supported in JavaScript
LibTest/core/DateTime/microsecondsSinceEpoch_A01_t01: SkipByDesign # microseconds are not supported in JavaScript
diff --git a/tests/co19/co19-dartdevc.status b/tests/co19/co19-dartdevc.status
index 776d905..e0a2172 100644
--- a/tests/co19/co19-dartdevc.status
+++ b/tests/co19/co19-dartdevc.status
@@ -68,10 +68,30 @@
Language/Expressions/Shift/integer_t01: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Shift/integer_t02: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign # dart:isolate not supported.
+Language/Functions/External_Functions/not_connected_to_a_body_t01: SkipByDesign # External variables are not supported
+Language/Libraries_and_Scripts/Scripts/top_level_syntax_t01: SkipByDesign # External variables are not supported
+Language/Libraries_and_Scripts/top_level_syntax_t01: SkipByDesign # External variables are not supported
Language/Metadata/before*: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/523.
Language/Reference/Operator_Precedence/precedence_15_unary_prefix_t08: SkipByDesign # binary '~' produces different results in JavaScript and Dart
Language/Types/Interface_Types/subtype_t27: Skip # Times out
Language/Types/Interface_Types/subtype_t28: Skip # Times out
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t01: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t02: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t03: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A02_t01: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A02_t04: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t01: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t02: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t03: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t04: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t06: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A04_t01: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A04_t02: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t01: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t02: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t03: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/syntax_A01_t03: SkipByDesign # External variables are not supported
+LanguageFeatures/Abstract-external-fields/syntax_A02_t03: SkipByDesign # External variables are not supported
LibTest/core/DateTime/DateTime.fromMicrosecondsSinceEpoch_A01_t01: SkipByDesign # microseconds are not supported in JavaScript
LibTest/core/DateTime/microsecond_A01_t01: SkipByDesign # microseconds are not supported in JavaScript
LibTest/core/DateTime/microsecondsSinceEpoch_A01_t01: SkipByDesign # microseconds are not supported in JavaScript
diff --git a/tests/co19_2/co19_2-dart2js.status b/tests/co19_2/co19_2-dart2js.status
index dddded9..0d620e8 100644
--- a/tests/co19_2/co19_2-dart2js.status
+++ b/tests/co19_2/co19_2-dart2js.status
@@ -5,6 +5,9 @@
[ $compiler == dart2js ]
Language/Expressions/Null/instance_of_class_null_t01: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/522.
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign
+Language/Functions/External_Functions/not_connected_to_a_body_t01: SkipByDesign # Non-JS-interop external members are not supported
+Language/Libraries_and_Scripts/Scripts/top_level_syntax_t01: SkipByDesign # Non-JS-interop external members are not supported
+Language/Libraries_and_Scripts/top_level_syntax_t01: SkipByDesign # Non-JS-interop external members are not supported
Language/Metadata/before*: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/523.
LibTest/io/*: SkipByDesign # dart:io not supported.
LibTest/isolate/*: SkipByDesign # dart:isolate not supported.
diff --git a/tests/co19_2/co19_2-dartdevc.status b/tests/co19_2/co19_2-dartdevc.status
index 087f30b..7497344 100644
--- a/tests/co19_2/co19_2-dartdevc.status
+++ b/tests/co19_2/co19_2-dartdevc.status
@@ -56,6 +56,9 @@
Language/Expressions/Function_Invocation/async_generator_invokation_t10: Skip # Times out
Language/Expressions/Null/instance_of_class_null_t01: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/522.
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign # dart:isolate not supported.
+Language/Functions/External_Functions/not_connected_to_a_body_t01: SkipByDesign # External variables are not supported
+Language/Libraries_and_Scripts/Scripts/top_level_syntax_t01: SkipByDesign # External variables are not supported
+Language/Libraries_and_Scripts/top_level_syntax_t01: SkipByDesign # External variables are not supported
Language/Metadata/before*: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/523.
Language/Types/Interface_Types/subtype_t27: Skip # Times out
Language/Types/Interface_Types/subtype_t28: Skip # Times out
diff --git a/tests/dart2js/jsinterop_test.dart b/tests/dart2js/jsinterop_test.dart
index 34784e4..994f1f1 100644
--- a/tests/dart2js/jsinterop_test.dart
+++ b/tests/dart2js/jsinterop_test.dart
@@ -52,10 +52,10 @@
Class.generative();
factory Class.fact() => null as dynamic;
- // NON_NATIVE_EXTERNAL //# 08: compile-time error
+ // GENERIC //# 08: compile-time error
external Class.externalGenerative(); //# 08: continued
- // NON_NATIVE_EXTERNAL //# 09: compile-time error
+ // GENERIC //# 09: compile-time error
external factory Class.externalFact(); //# 09: continued
@JS('a') // GENERIC //# 10: compile-time error
@@ -104,22 +104,22 @@
@JS('a') // GENERIC //# 21: compile-time error
static staticJsInteropMethod() {} //# 21: continued
- // NON_NATIVE_EXTERNAL //# 22: compile-time error
+ // GENERIC //# 22: compile-time error
external get externalInstanceGetter; //# 22: continued
- // NON_NATIVE_EXTERNAL //# 23: compile-time error
+ // GENERIC //# 23: compile-time error
external set externalInstanceSetter(_); //# 23: continued
- // NON_NATIVE_EXTERNAL //# 24: compile-time error
+ // GENERIC //# 24: compile-time error
external externalInstanceMethod(); //# 24: continued
- // NON_NATIVE_EXTERNAL //# 25: compile-time error
+ // GENERIC //# 25: compile-time error
external static get externalStaticGetter; //# 25: continued
- // NON_NATIVE_EXTERNAL //# 26: compile-time error
+ // GENERIC //# 26: compile-time error
external static set externalStaticSetter(_); //# 26: continued
- // NON_NATIVE_EXTERNAL //# 27: compile-time error
+ // GENERIC //# 27: compile-time error
external static externalStaticMethod(); //# 27: continued
@JS('a') // GENERIC //# 28: compile-time error
diff --git a/tests/dart2js/non_jsinterop_test.dart b/tests/dart2js/non_jsinterop_test.dart
index 91af080..550ea27 100644
--- a/tests/dart2js/non_jsinterop_test.dart
+++ b/tests/dart2js/non_jsinterop_test.dart
@@ -32,13 +32,13 @@
@JS('a') // JS_INTEROP_NON_EXTERNAL_MEMBER //# 04: compile-time error
topLevelJsInteropFunction() {} //# 04: continued
-// NON_NATIVE_EXTERNAL //# 05: compile-time error
+// GENERIC //# 05: compile-time error
external get externalTopLevelGetter; //# 05: continued
-// NON_NATIVE_EXTERNAL //# 06: compile-time error
+// GENERIC //# 06: compile-time error
external set externalTopLevelSetter(_); //# 06: continued
-// NON_NATIVE_EXTERNAL //# 07: compile-time error
+// GENERIC //# 07: compile-time error
external externalTopLevelFunction(); //# 07: continued
@JS('a')
@@ -54,10 +54,10 @@
Class.generative();
factory Class.fact() => null as dynamic;
- // NON_NATIVE_EXTERNAL //# 08: compile-time error
+ // GENERIC //# 08: compile-time error
external Class.externalGenerative(); //# 08: continued
- // NON_NATIVE_EXTERNAL //# 09: compile-time error
+ // GENERIC //# 09: compile-time error
external factory Class.externalFact(); //# 09: continued
@JS('a') // GENERIC //# 11: compile-time error
@@ -103,22 +103,22 @@
@JS('a') // GENERIC //# 21: compile-time error
static staticJsInteropMethod() {} //# 21: continued
- // NON_NATIVE_EXTERNAL //# 22: compile-time error
+ // GENERIC //# 22: compile-time error
external get externalInstanceGetter; //# 22: continued
- // NON_NATIVE_EXTERNAL //# 23: compile-time error
+ // GENERIC //# 23: compile-time error
external set externalInstanceSetter(_); //# 23: continued
- // NON_NATIVE_EXTERNAL //# 24: compile-time error
+ // GENERIC //# 24: compile-time error
external externalInstanceMethod(); //# 24: continued
- // NON_NATIVE_EXTERNAL //# 25: compile-time error
+ // GENERIC //# 25: compile-time error
external static get externalStaticGetter; //# 25: continued
- // NON_NATIVE_EXTERNAL //# 26: compile-time error
+ // GENERIC //# 26: compile-time error
external static set externalStaticSetter(_); //# 26: continued
- // NON_NATIVE_EXTERNAL //# 27: compile-time error
+ // GENERIC //# 27: compile-time error
external static externalStaticMethod(); //# 27: continued
@JS('a') // GENERIC //# 28: compile-time error
diff --git a/tests/dart2js_2/jsinterop_test.dart b/tests/dart2js_2/jsinterop_test.dart
index ea9d508..5ee057c 100644
--- a/tests/dart2js_2/jsinterop_test.dart
+++ b/tests/dart2js_2/jsinterop_test.dart
@@ -54,10 +54,10 @@
Class.generative();
factory Class.fact() => null as dynamic;
- // NON_NATIVE_EXTERNAL //# 08: compile-time error
+ // GENERIC //# 08: compile-time error
external Class.externalGenerative(); //# 08: continued
- // NON_NATIVE_EXTERNAL //# 09: compile-time error
+ // GENERIC //# 09: compile-time error
external factory Class.externalFact(); //# 09: continued
@JS('a') // GENERIC //# 10: compile-time error
@@ -106,22 +106,22 @@
@JS('a') // GENERIC //# 21: compile-time error
static staticJsInteropMethod() {} //# 21: continued
- // NON_NATIVE_EXTERNAL //# 22: compile-time error
+ // GENERIC //# 22: compile-time error
external get externalInstanceGetter; //# 22: continued
- // NON_NATIVE_EXTERNAL //# 23: compile-time error
+ // GENERIC //# 23: compile-time error
external set externalInstanceSetter(_); //# 23: continued
- // NON_NATIVE_EXTERNAL //# 24: compile-time error
+ // GENERIC //# 24: compile-time error
external externalInstanceMethod(); //# 24: continued
- // NON_NATIVE_EXTERNAL //# 25: compile-time error
+ // GENERIC //# 25: compile-time error
external static get externalStaticGetter; //# 25: continued
- // NON_NATIVE_EXTERNAL //# 26: compile-time error
+ // GENERIC //# 26: compile-time error
external static set externalStaticSetter(_); //# 26: continued
- // NON_NATIVE_EXTERNAL //# 27: compile-time error
+ // GENERIC //# 27: compile-time error
external static externalStaticMethod(); //# 27: continued
@JS('a') // GENERIC //# 28: compile-time error
diff --git a/tests/dart2js_2/non_jsinterop_test.dart b/tests/dart2js_2/non_jsinterop_test.dart
index 7b533ac..5406438 100644
--- a/tests/dart2js_2/non_jsinterop_test.dart
+++ b/tests/dart2js_2/non_jsinterop_test.dart
@@ -34,13 +34,13 @@
@JS('a') // JS_INTEROP_NON_EXTERNAL_MEMBER //# 04: compile-time error
topLevelJsInteropFunction() {} //# 04: continued
-// NON_NATIVE_EXTERNAL //# 05: compile-time error
+// GENERIC //# 05: compile-time error
external get externalTopLevelGetter; //# 05: continued
-// NON_NATIVE_EXTERNAL //# 06: compile-time error
+// GENERIC //# 06: compile-time error
external set externalTopLevelSetter(_); //# 06: continued
-// NON_NATIVE_EXTERNAL //# 07: compile-time error
+// GENERIC //# 07: compile-time error
external externalTopLevelFunction(); //# 07: continued
@JS('a')
@@ -56,10 +56,10 @@
Class.generative();
factory Class.fact() => null as dynamic;
- // NON_NATIVE_EXTERNAL //# 08: compile-time error
+ // GENERIC //# 08: compile-time error
external Class.externalGenerative(); //# 08: continued
- // NON_NATIVE_EXTERNAL //# 09: compile-time error
+ // GENERIC //# 09: compile-time error
external factory Class.externalFact(); //# 09: continued
@JS('a') // GENERIC //# 11: compile-time error
@@ -105,22 +105,22 @@
@JS('a') // GENERIC //# 21: compile-time error
static staticJsInteropMethod() {} //# 21: continued
- // NON_NATIVE_EXTERNAL //# 22: compile-time error
+ // GENERIC //# 22: compile-time error
external get externalInstanceGetter; //# 22: continued
- // NON_NATIVE_EXTERNAL //# 23: compile-time error
+ // GENERIC //# 23: compile-time error
external set externalInstanceSetter(_); //# 23: continued
- // NON_NATIVE_EXTERNAL //# 24: compile-time error
+ // GENERIC //# 24: compile-time error
external externalInstanceMethod(); //# 24: continued
- // NON_NATIVE_EXTERNAL //# 25: compile-time error
+ // GENERIC //# 25: compile-time error
external static get externalStaticGetter; //# 25: continued
- // NON_NATIVE_EXTERNAL //# 26: compile-time error
+ // GENERIC //# 26: compile-time error
external static set externalStaticSetter(_); //# 26: continued
- // NON_NATIVE_EXTERNAL //# 27: compile-time error
+ // GENERIC //# 27: compile-time error
external static externalStaticMethod(); //# 27: continued
@JS('a') // GENERIC //# 28: compile-time error
diff --git a/tests/ffi/sizeof_test.dart b/tests/ffi/sizeof_test.dart
index fd02efc..35cb36c 100644
--- a/tests/ffi/sizeof_test.dart
+++ b/tests/ffi/sizeof_test.dart
@@ -8,6 +8,20 @@
import "package:expect/expect.dart";
+import "coordinate.dart";
+
+get is32Bit => 4 == sizeOf<IntPtr>();
+get is64Bit => 8 == sizeOf<IntPtr>();
+
void main() async {
- Expect.equals(true, 4 == sizeOf<Pointer>() || 8 == sizeOf<Pointer>());
+ if (is32Bit) {
+ Expect.equals(4, sizeOf<Pointer>());
+ // Struct is 20 bytes on ia32 and arm32-iOS, but 24 bytes on arm32-Android
+ // and arm32-Linux due to alignment.
+ Expect.isTrue(20 == sizeOf<Coordinate>() || 24 == sizeOf<Coordinate>());
+ } else if (is64Bit) {
+ Expect.equals(8, sizeOf<Pointer>());
+ Expect.equals(24, sizeOf<Coordinate>());
+ }
+ Expect.throws(() => sizeOf<Void>());
}
diff --git a/tests/ffi/structs_test.dart b/tests/ffi/structs_test.dart
index e339437..68ee219 100644
--- a/tests/ffi/structs_test.dart
+++ b/tests/ffi/structs_test.dart
@@ -18,6 +18,7 @@
for (int i = 0; i < 100; i++) {
testStructAllocate();
testStructFromAddress();
+ testStructIndexedAccess();
testStructWithNulls();
testTypeTest();
testUtf8();
@@ -25,7 +26,7 @@
}
}
-/// allocates each coordinate separately in c memory
+/// Allocates each coordinate separately in c memory.
void testStructAllocate() {
final c1 = calloc<Coordinate>()
..ref.x = 10.0
@@ -54,7 +55,7 @@
calloc.free(c3);
}
-/// allocates coordinates consecutively in c memory
+/// Allocates coordinates consecutively in c memory.
void testStructFromAddress() {
Pointer<Coordinate> c1 = calloc(3);
Pointer<Coordinate> c2 = c1.elementAt(1);
@@ -84,6 +85,34 @@
calloc.free(c1);
}
+/// Allocates coordinates consecutively in c memory.
+void testStructIndexedAccess() {
+ Pointer<Coordinate> cs = calloc(3);
+ cs[0]
+ ..x = 10.0
+ ..y = 10.0
+ ..next = cs.elementAt(2);
+ cs[1]
+ ..x = 20.0
+ ..y = 20.0
+ ..next = cs;
+ cs[2]
+ ..x = 30.0
+ ..y = 30.0
+ ..next = cs.elementAt(1);
+
+ Coordinate currentCoordinate = cs.ref;
+ Expect.equals(10.0, currentCoordinate.x);
+ currentCoordinate = currentCoordinate.next.ref;
+ Expect.equals(30.0, currentCoordinate.x);
+ currentCoordinate = currentCoordinate.next.ref;
+ Expect.equals(20.0, currentCoordinate.x);
+ currentCoordinate = currentCoordinate.next.ref;
+ Expect.equals(10.0, currentCoordinate.x);
+
+ calloc.free(cs);
+}
+
void testStructWithNulls() {
final coordinate = calloc<Coordinate>()
..ref.x = 10.0
diff --git a/tests/ffi/vmspecific_static_checks_test.dart b/tests/ffi/vmspecific_static_checks_test.dart
index 94a11e1..c2150f8 100644
--- a/tests/ffi/vmspecific_static_checks_test.dart
+++ b/tests/ffi/vmspecific_static_checks_test.dart
@@ -610,18 +610,18 @@
void testRefStruct() {
final myStructPointer = calloc<TestStruct13>();
Pointer<Struct> structPointer = myStructPointer;
- structPointer.ref; //# 1330: ok
+ structPointer.ref; //# 1330: compile-time error
calloc.free(myStructPointer);
}
-T genericRef<T extends Struct>(Pointer<T> p) => //# 1200: ok
- p.ref; //# 1200: ok
+T genericRef<T extends Struct>(Pointer<T> p) => //# 1200: compile-time error
+ p.ref; //# 1200: compile-time error
-T genericRef2<T extends Struct>(Pointer<T> p) => //# 1201: ok
- p.cast<T>().ref; //# 1201: ok
+T genericRef2<T extends Struct>(Pointer<T> p) => //# 1201: compile-time error
+ p.cast<T>().ref; //# 1201: compile-time error
-T genericRef3<T extends Struct>(Pointer<T> p) => //# 1202: ok
- p[0]; //# 1202: ok
+T genericRef3<T extends Struct>(Pointer<T> p) => //# 1202: compile-time error
+ p[0]; //# 1202: compile-time error
void testSizeOfGeneric() {
int generic<T extends Pointer>() {
diff --git a/tests/ffi_2/sizeof_test.dart b/tests/ffi_2/sizeof_test.dart
index fd02efc..35cb36c 100644
--- a/tests/ffi_2/sizeof_test.dart
+++ b/tests/ffi_2/sizeof_test.dart
@@ -8,6 +8,20 @@
import "package:expect/expect.dart";
+import "coordinate.dart";
+
+get is32Bit => 4 == sizeOf<IntPtr>();
+get is64Bit => 8 == sizeOf<IntPtr>();
+
void main() async {
- Expect.equals(true, 4 == sizeOf<Pointer>() || 8 == sizeOf<Pointer>());
+ if (is32Bit) {
+ Expect.equals(4, sizeOf<Pointer>());
+ // Struct is 20 bytes on ia32 and arm32-iOS, but 24 bytes on arm32-Android
+ // and arm32-Linux due to alignment.
+ Expect.isTrue(20 == sizeOf<Coordinate>() || 24 == sizeOf<Coordinate>());
+ } else if (is64Bit) {
+ Expect.equals(8, sizeOf<Pointer>());
+ Expect.equals(24, sizeOf<Coordinate>());
+ }
+ Expect.throws(() => sizeOf<Void>());
}
diff --git a/tests/ffi_2/structs_test.dart b/tests/ffi_2/structs_test.dart
index e339437..68ee219 100644
--- a/tests/ffi_2/structs_test.dart
+++ b/tests/ffi_2/structs_test.dart
@@ -18,6 +18,7 @@
for (int i = 0; i < 100; i++) {
testStructAllocate();
testStructFromAddress();
+ testStructIndexedAccess();
testStructWithNulls();
testTypeTest();
testUtf8();
@@ -25,7 +26,7 @@
}
}
-/// allocates each coordinate separately in c memory
+/// Allocates each coordinate separately in c memory.
void testStructAllocate() {
final c1 = calloc<Coordinate>()
..ref.x = 10.0
@@ -54,7 +55,7 @@
calloc.free(c3);
}
-/// allocates coordinates consecutively in c memory
+/// Allocates coordinates consecutively in c memory.
void testStructFromAddress() {
Pointer<Coordinate> c1 = calloc(3);
Pointer<Coordinate> c2 = c1.elementAt(1);
@@ -84,6 +85,34 @@
calloc.free(c1);
}
+/// Allocates coordinates consecutively in c memory.
+void testStructIndexedAccess() {
+ Pointer<Coordinate> cs = calloc(3);
+ cs[0]
+ ..x = 10.0
+ ..y = 10.0
+ ..next = cs.elementAt(2);
+ cs[1]
+ ..x = 20.0
+ ..y = 20.0
+ ..next = cs;
+ cs[2]
+ ..x = 30.0
+ ..y = 30.0
+ ..next = cs.elementAt(1);
+
+ Coordinate currentCoordinate = cs.ref;
+ Expect.equals(10.0, currentCoordinate.x);
+ currentCoordinate = currentCoordinate.next.ref;
+ Expect.equals(30.0, currentCoordinate.x);
+ currentCoordinate = currentCoordinate.next.ref;
+ Expect.equals(20.0, currentCoordinate.x);
+ currentCoordinate = currentCoordinate.next.ref;
+ Expect.equals(10.0, currentCoordinate.x);
+
+ calloc.free(cs);
+}
+
void testStructWithNulls() {
final coordinate = calloc<Coordinate>()
..ref.x = 10.0
diff --git a/tests/ffi_2/vmspecific_static_checks_test.dart b/tests/ffi_2/vmspecific_static_checks_test.dart
index 369a8de..88e5b2c 100644
--- a/tests/ffi_2/vmspecific_static_checks_test.dart
+++ b/tests/ffi_2/vmspecific_static_checks_test.dart
@@ -608,18 +608,18 @@
void testRefStruct() {
final myStructPointer = calloc<TestStruct13>();
Pointer<Struct> structPointer = myStructPointer;
- structPointer.ref; //# 1330: ok
+ structPointer.ref; //# 1330: compile-time error
calloc.free(myStructPointer);
}
-T genericRef<T extends Struct>(Pointer<T> p) => //# 1200: ok
- p.ref; //# 1200: ok
+T genericRef<T extends Struct>(Pointer<T> p) => //# 1200: compile-time error
+ p.ref; //# 1200: compile-time error
-T genericRef2<T extends Struct>(Pointer<T> p) => //# 1201: ok
- p.cast<T>().ref; //# 1201: ok
+T genericRef2<T extends Struct>(Pointer<T> p) => //# 1201: compile-time error
+ p.cast<T>().ref; //# 1201: compile-time error
-T genericRef3<T extends Struct>(Pointer<T> p) => //# 1202: ok
- p[0]; //# 1202: ok
+T genericRef3<T extends Struct>(Pointer<T> p) => //# 1202: compile-time error
+ p[0]; //# 1202: compile-time error
void testSizeOfGeneric() {
int generic<T extends Pointer>() {
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index e0b4991..dbac77c 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -4,6 +4,7 @@
# Sections in this file should contain "$compiler == dart2js".
[ $compiler == dart2js ]
+external_abstract_fields/external_fields_test: SkipByDesign # Non-JS-interop external members are not supported
mixin_method_override_test/G5: Skip # Issue 34354
number/int64_literal_runtime*_test: Skip # This is testing Dart 2.0 int64 semantics
vm/*: SkipByDesign # Tests for the VM.
diff --git a/tests/language/language_dartdevc.status b/tests/language/language_dartdevc.status
index d92526e..0c012d1 100644
--- a/tests/language/language_dartdevc.status
+++ b/tests/language/language_dartdevc.status
@@ -18,6 +18,7 @@
[ $compiler == dartdevc || $compiler == dartdevk ]
async_star/throw_in_catch_test: Skip # Times out. Issue 29920
+external_abstract_fields/external_fields_test: SkipByDesign # Non-JS-interop external members are not supported
number/int64_literal_runtime*_test: Skip # This is testing Dart 2.0 int64 semantics.
superinterface_variance/*: Skip # Issue dart-lang/language#113
vm/*: SkipByDesign # VM only tests.; VM only tests.
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index e0b4991..dbac77c 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -4,6 +4,7 @@
# Sections in this file should contain "$compiler == dart2js".
[ $compiler == dart2js ]
+external_abstract_fields/external_fields_test: SkipByDesign # Non-JS-interop external members are not supported
mixin_method_override_test/G5: Skip # Issue 34354
number/int64_literal_runtime*_test: Skip # This is testing Dart 2.0 int64 semantics
vm/*: SkipByDesign # Tests for the VM.
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index d92526e..0c012d1 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -18,6 +18,7 @@
[ $compiler == dartdevc || $compiler == dartdevk ]
async_star/throw_in_catch_test: Skip # Times out. Issue 29920
+external_abstract_fields/external_fields_test: SkipByDesign # Non-JS-interop external members are not supported
number/int64_literal_runtime*_test: Skip # This is testing Dart 2.0 int64 semantics.
superinterface_variance/*: Skip # Issue dart-lang/language#113
vm/*: SkipByDesign # VM only tests.; VM only tests.
diff --git a/tests/lib/js/external_nonjs_static_test.dart b/tests/lib/js/external_nonjs_static_test.dart
new file mode 100644
index 0000000..47b6252
--- /dev/null
+++ b/tests/lib/js/external_nonjs_static_test.dart
@@ -0,0 +1,101 @@
+// 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.
+
+// Checks for static errors using external without the @JS() annotation,
+// in a library without a @JS() annotation
+
+library external_nonjs_static_test;
+
+import 'package:js/js.dart';
+
+external var topLevelField;
+// ^
+// [web] Only JS interop members may be 'external'.
+
+external final topLevelFinalField;
+// ^
+// [web] Only JS interop members may be 'external'.
+
+external get topLevelGetter;
+// ^
+// [web] Only JS interop members may be 'external'.
+
+external set topLevelSetter(_);
+// ^
+// [web] Only JS interop members may be 'external'.
+
+external topLevelFunction();
+// ^
+// [web] Only JS interop members may be 'external'.
+
+class Constructors {
+ external Constructors();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external Constructors.namedConstructor();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external factory Constructors.namedFactory();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class Members {
+ external var field;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external final finalField;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external get instanceGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external set instanceSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external instanceMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class StaticMembers {
+ external static var staticField;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static final staticFinalField;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static get staticGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static set staticSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static staticMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+@anonymous
+class AnonymousClass {
+ external var field;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external factory AnonymousClass({var field});
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+main() {}
diff --git a/tests/lib/js/external_static_test.dart b/tests/lib/js/external_static_test.dart
new file mode 100644
index 0000000..8fac26db
--- /dev/null
+++ b/tests/lib/js/external_static_test.dart
@@ -0,0 +1,89 @@
+// 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.
+
+// Checks for static errors using external without the @JS() annotation,
+// in a library with a @JS() annotation
+
+@JS()
+library external_static_test;
+
+import 'package:js/js.dart';
+
+// external top level members ok in @JS() library.
+external var topLevelField;
+external final topLevelFinalField;
+external get topLevelGetter;
+external set topLevelSetter(_);
+external topLevelFunction();
+
+class Constructors {
+ external Constructors();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external Constructors.namedConstructor();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external factory Constructors.namedFactory();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class Members {
+ external var field;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external final finalField;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external get instanceGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external set instanceSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external instanceMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class StaticMembers {
+ external static var staticField;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static final staticFinalField;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static get staticGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static set staticSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static staticMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+@anonymous
+class AnonymousClass {
+ external var field;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external factory AnonymousClass({var field});
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+main() {}
diff --git a/tests/lib_2/js/external_nonjs_static_test.dart b/tests/lib_2/js/external_nonjs_static_test.dart
new file mode 100644
index 0000000..3359f0b
--- /dev/null
+++ b/tests/lib_2/js/external_nonjs_static_test.dart
@@ -0,0 +1,73 @@
+// 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.
+
+// Checks for static errors using external without the @JS() annotation,
+// in a library without a @JS() annotation
+
+library external_nonjs_static_test;
+
+import 'package:js/js.dart';
+
+external get topLevelGetter;
+// ^
+// [web] Only JS interop members may be 'external'.
+
+external set topLevelSetter(_);
+// ^
+// [web] Only JS interop members may be 'external'.
+
+external topLevelFunction();
+// ^
+// [web] Only JS interop members may be 'external'.
+
+class Constructors {
+ external Constructors();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external Constructors.namedConstructor();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external factory Constructors.namedFactory();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class Members {
+ external get instanceGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external set instanceSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external instanceMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class StaticMembers {
+ external static get staticGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static set staticSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static staticMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+@anonymous
+class AnonymousClass {
+ external factory AnonymousClass();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+main() {}
diff --git a/tests/lib_2/js/external_static_test.dart b/tests/lib_2/js/external_static_test.dart
new file mode 100644
index 0000000..9326b9e
--- /dev/null
+++ b/tests/lib_2/js/external_static_test.dart
@@ -0,0 +1,67 @@
+// 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.
+
+// Checks for static errors using external without the @JS() annotation,
+// in a library with a @JS() annotation
+
+@JS()
+library external_static_test;
+
+import 'package:js/js.dart';
+
+// external top level members ok in @JS() library.
+external get topLevelGetter;
+external set topLevelSetter(_);
+external topLevelFunction();
+
+class Constructors {
+ external Constructors();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external Constructors.namedConstructor();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external factory Constructors.namedFactory();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class Members {
+ external get instanceGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external set instanceSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external instanceMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+class StaticMembers {
+ external static get staticGetter;
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static set staticSetter(_);
+ // ^
+ // [web] Only JS interop members may be 'external'.
+
+ external static staticMethod();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+@anonymous
+class AnonymousClass {
+ external factory AnonymousClass();
+ // ^
+ // [web] Only JS interop members may be 'external'.
+}
+
+main() {}
diff --git a/tests/standalone/io/large_file_read_small_file_test.dart b/tests/standalone/io/large_file_read_small_file_test.dart
new file mode 100644
index 0000000..a4bedf3
--- /dev/null
+++ b/tests/standalone/io/large_file_read_small_file_test.dart
@@ -0,0 +1,54 @@
+// 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.
+
+import 'dart:io';
+
+import 'package:expect/expect.dart';
+import 'package:path/path.dart' as path;
+
+Future runWithTempDir(Future Function(String dir) callback) async {
+ final tempDir = Directory.systemTemp.createTempSync("large_file_read");
+ try {
+ await callback(tempDir.path);
+ } finally {
+ tempDir.delete(recursive: true);
+ }
+}
+
+main() async {
+ // MSAN's malloc implementation will not free memory when shrinking
+ // allocations via realloc (e.g. realloc(malloc(1 GB), new_size=10) will
+ // hold on to the 1 GB).
+ if (Platform.executable.contains('MSAN')) return;
+
+ await runWithTempDir((String dir) async {
+ final file = File(path.join(dir, 'hello_world.txt'));
+ await file.writeAsString('hello world');
+ final RandomAccessFile randomAccessFile = await file.open();
+
+ try {
+ final buffers = [];
+ for (int i = 0; i < 10 * 1000; ++i) {
+ // We issue a 10 MB read but get only a small typed data back. We hang on
+ // to those buffers. If the implementation actually malloc()ed 10 MB then
+ // we would hang on to 100 GB and this test would OOM.
+ // If the implementation instead correctly shrinks the buffer before
+ // giving it to Dart as external typed data, we only consume ~ 100 KB.
+ buffers.add(await randomAccessFile.read(10 * 1024 * 1024));
+ await randomAccessFile.setPosition(0);
+
+ // To avoid machines becoming unusable if the test fails, we'll fail
+ // explicitly if we hit 2 GB.
+ if (ProcessInfo.currentRss > 2 * 1024 * 1024 * 1024) {
+ throw 'The dart:io implementation is buggy and uses too much memory';
+ }
+ }
+ for (final buffer in buffers) {
+ Expect.equals('hello world'.length, buffer.length);
+ }
+ } finally {
+ randomAccessFile.close();
+ }
+ });
+}
diff --git a/tests/standalone_2/io/large_file_read_small_file_test.dart b/tests/standalone_2/io/large_file_read_small_file_test.dart
new file mode 100644
index 0000000..a4bedf3
--- /dev/null
+++ b/tests/standalone_2/io/large_file_read_small_file_test.dart
@@ -0,0 +1,54 @@
+// 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.
+
+import 'dart:io';
+
+import 'package:expect/expect.dart';
+import 'package:path/path.dart' as path;
+
+Future runWithTempDir(Future Function(String dir) callback) async {
+ final tempDir = Directory.systemTemp.createTempSync("large_file_read");
+ try {
+ await callback(tempDir.path);
+ } finally {
+ tempDir.delete(recursive: true);
+ }
+}
+
+main() async {
+ // MSAN's malloc implementation will not free memory when shrinking
+ // allocations via realloc (e.g. realloc(malloc(1 GB), new_size=10) will
+ // hold on to the 1 GB).
+ if (Platform.executable.contains('MSAN')) return;
+
+ await runWithTempDir((String dir) async {
+ final file = File(path.join(dir, 'hello_world.txt'));
+ await file.writeAsString('hello world');
+ final RandomAccessFile randomAccessFile = await file.open();
+
+ try {
+ final buffers = [];
+ for (int i = 0; i < 10 * 1000; ++i) {
+ // We issue a 10 MB read but get only a small typed data back. We hang on
+ // to those buffers. If the implementation actually malloc()ed 10 MB then
+ // we would hang on to 100 GB and this test would OOM.
+ // If the implementation instead correctly shrinks the buffer before
+ // giving it to Dart as external typed data, we only consume ~ 100 KB.
+ buffers.add(await randomAccessFile.read(10 * 1024 * 1024));
+ await randomAccessFile.setPosition(0);
+
+ // To avoid machines becoming unusable if the test fails, we'll fail
+ // explicitly if we hit 2 GB.
+ if (ProcessInfo.currentRss > 2 * 1024 * 1024 * 1024) {
+ throw 'The dart:io implementation is buggy and uses too much memory';
+ }
+ }
+ for (final buffer in buffers) {
+ Expect.equals('hello world'.length, buffer.length);
+ }
+ } finally {
+ randomAccessFile.close();
+ }
+ });
+}
diff --git a/tools/VERSION b/tools/VERSION
index b2a510b..0513cb3 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 282
+PRERELEASE 283
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index 9369cce..08b7920 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -48,6 +48,8 @@
'pkg/_fe_analyzer_shared/test/flow_analysis/reachability/'),
packageDirectory(
'pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/'),
+ packageDirectory(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted//'),
packageDirectory('pkg/_fe_analyzer_shared/test/inheritance/'),
];
diff --git a/tools/run_offsets_extractor.sh b/tools/run_offsets_extractor.sh
index d3fd6ec9..c9c011b 100755
--- a/tools/run_offsets_extractor.sh
+++ b/tools/run_offsets_extractor.sh
@@ -23,7 +23,7 @@
rm -rf "${TEMP}" "${TEMP_HEADER}" "${TEMP_JIT}" "${TEMP_AOT}"
# We're regenerating the file, but we want to keep all the comments etc at the
-# top of the file. So just delete everything after the first "#if defined".
+# top of the file. So just delete everything after the first "#if ".
LINE=$(grep "#if " "$FILE" -n | head -n 1 | sed "s/^\([0-9]*\):.*/\1/")
head -n $(expr $LINE - 1) "$FILE" >"$TEMP_HEADER"
@@ -43,6 +43,8 @@
run release x64 ReleaseX64
run release ia32 ReleaseIA32
run release simarm64 ReleaseSIMARM64
+run release x64_comp_ptr ReleaseX64_COMP_PTR
+run release simarm64_comp_ptr ReleaseSIMARM64_COMP_PTR
echo "" >>"$TEMP_JIT"
echo "" >>"$TEMP_AOT"
echo "#else // !defined(PRODUCT)" >>"$TEMP_JIT"
@@ -51,6 +53,8 @@
run product x64 ProductX64
run product ia32 ProductIA32
run product simarm64 ProductSIMARM64
+run product x64_comp_ptr ProductX64_COMP_PTR
+run product simarm64_comp_ptr ProductSIMARM64_COMP_PTR
echo "" >>"$TEMP_JIT"
echo "" >>"$TEMP_AOT"
echo "#endif // !defined(PRODUCT)" >>"$TEMP_JIT"