Version 2.12.0-74.0.dev
Merge commit 'dab1efeb5d471f354dedd15b136420a5bef999af' into 'dev'
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index c1bb9b3..60c4e1c 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -285,6 +285,10 @@
}
void setCfeOnly(String argument) {
+ if (writeStrategy == WriteStrategy.toClosedWorld) {
+ fail("Cannot use ${Flags.cfeOnly} "
+ "and write serialized closed world simultaneously.");
+ }
if (writeStrategy == WriteStrategy.toData) {
fail("Cannot use ${Flags.cfeOnly} "
"and write serialized data simultaneously.");
@@ -644,7 +648,10 @@
case WriteStrategy.toKernel:
out ??= Uri.base.resolve('out.dill');
options.add(Flags.cfeOnly);
- if (readStrategy == ReadStrategy.fromData) {
+ if (readStrategy == ReadStrategy.fromClosedWorld) {
+ fail("Cannot use ${Flags.cfeOnly} "
+ "and read serialized closed world simultaneously.");
+ } else if (readStrategy == ReadStrategy.fromData) {
fail("Cannot use ${Flags.cfeOnly} "
"and read serialized data simultaneously.");
} else if (readStrategy == ReadStrategy.fromCodegen) {
diff --git a/pkg/compiler/test/end_to_end/command_line_test.dart b/pkg/compiler/test/end_to_end/command_line_test.dart
index 57d4161..5f0b7e9 100644
--- a/pkg/compiler/test/end_to_end/command_line_test.dart
+++ b/pkg/compiler/test/end_to_end/command_line_test.dart
@@ -27,10 +27,16 @@
await test([Flags.cfeOnly], exitCode: 1);
await test([Flags.cfeOnly, 'foo.dart'], out: 'out.dill');
await test([Flags.cfeOnly, 'foo.dart', '--out=out.dill'], out: 'out.dill');
+ await test([Flags.cfeOnly, 'foo.dart', Flags.readClosedWorld], exitCode: 1);
+ await test(['foo.dart', Flags.readClosedWorld, Flags.cfeOnly], exitCode: 1);
await test([Flags.cfeOnly, 'foo.dart', Flags.readData], exitCode: 1);
await test(['foo.dart', Flags.readData, Flags.cfeOnly], exitCode: 1);
await test([Flags.cfeOnly, 'foo.dart', Flags.readCodegen], exitCode: 1);
await test(['foo.dart', Flags.readCodegen, Flags.cfeOnly], exitCode: 1);
+ await test([Flags.cfeOnly, 'foo.dart', Flags.writeClosedWorld],
+ exitCode: 1);
+ await test(['foo.dart', Flags.writeClosedWorld, Flags.cfeOnly],
+ exitCode: 1);
await test([Flags.cfeOnly, 'foo.dart', Flags.writeData], exitCode: 1);
await test(['foo.dart', Flags.writeData, Flags.cfeOnly], exitCode: 1);
await test([Flags.cfeOnly, 'foo.dart', Flags.writeCodegen], exitCode: 1);
@@ -40,11 +46,51 @@
out: 'out.dill', writeData: 'out.dill.data');
await test(['${Flags.writeData}=foo.data', 'foo.dart', '--out=foo.dill'],
out: 'foo.dill', writeData: 'foo.data');
+ await test([Flags.readClosedWorld, Flags.writeClosedWorld, 'foo.dart'],
+ exitCode: 1);
+ await test([Flags.writeClosedWorld, Flags.readClosedWorld, 'foo.dart'],
+ exitCode: 1);
await test([Flags.readData, Flags.writeData, 'foo.dart'], exitCode: 1);
await test([Flags.writeData, Flags.readData, 'foo.dart'], exitCode: 1);
+ await test([Flags.readCodegen, Flags.writeClosedWorld, 'foo.dart'],
+ exitCode: 1);
await test([Flags.readCodegen, Flags.writeData, 'foo.dart'], exitCode: 1);
+ await test([Flags.writeClosedWorld, Flags.readData, 'foo.dart'],
+ exitCode: 1);
+ await test([Flags.writeClosedWorld, Flags.readCodegen, 'foo.dart'],
+ exitCode: 1);
await test([Flags.writeData, Flags.readCodegen, 'foo.dart'], exitCode: 1);
+ await test([
+ Flags.writeClosedWorld,
+ 'foo.dart',
+ ], out: 'out.dill', writeClosedWorld: 'out.dill.world');
+ await test(
+ ['${Flags.writeClosedWorld}=foo.world', 'foo.dart', '--out=foo.dill'],
+ out: 'foo.dill', writeClosedWorld: 'foo.world');
+
+ await test([Flags.readClosedWorld, 'foo.dill'],
+ out: 'out.js', readClosedWorld: 'foo.dill.world');
+ await test([Flags.readClosedWorld, 'foo.dill', '--out=foo.js'],
+ out: 'foo.js', readClosedWorld: 'foo.dill.world');
+ await test(['${Flags.readClosedWorld}=out.world', 'foo.world'],
+ out: 'out.js', readClosedWorld: 'out.world');
+ await test(
+ ['${Flags.readClosedWorld}=out.world', 'foo.world', '--out=foo.js'],
+ out: 'foo.js', readClosedWorld: 'out.world');
+ await test(
+ [Flags.readClosedWorld, Flags.writeData, 'foo.dill'],
+ out: 'out.dill',
+ readClosedWorld: 'foo.dill.world',
+ writeData: 'out.dill.data',
+ );
+ await test([
+ '${Flags.readClosedWorld}=foo.world',
+ '${Flags.writeData}=foo.data',
+ 'foo.dart',
+ '--out=foo.dill'
+ ], out: 'foo.dill', readClosedWorld: 'foo.world', writeData: 'foo.data');
+
await test([Flags.readData, 'foo.dill'],
out: 'out.js', readData: 'foo.dill.data');
await test([Flags.readData, 'foo.dill', '--out=foo.js'],
@@ -199,6 +245,8 @@
Future test(List<String> arguments,
{int exitCode,
String out,
+ String readClosedWorld,
+ String writeClosedWorld,
String readData,
String writeData,
String readCodegen,
@@ -231,6 +279,10 @@
if (actualExitCode == null) {
Expect.isNotNull(options, "Missing options object");
Expect.equals(toUri(out), options.outputUri, "Unexpected output uri.");
+ Expect.equals(toUri(readClosedWorld), options.readClosedWorldUri,
+ "Unexpected readClosedWorld uri");
+ Expect.equals(toUri(writeClosedWorld), options.writeClosedWorldUri,
+ "Unexpected writeClosedWorld uri");
Expect.equals(
toUri(readData), options.readDataUri, "Unexpected readData uri");
Expect.equals(
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index e5e3d20..7b9ce66 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -9829,7 +9829,7 @@
int readByte();
List<int> readBytes(int length);
- int readUInt();
+ int readUInt30();
int readUint32();
/// Read List<Byte> from the source.
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 22f1718..5d9958f 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -144,7 +144,7 @@
int readByte() => _bytes[_byteOffset++];
- int readUInt() {
+ int readUInt30() {
int byte = readByte();
if (byte & 0x80 == 0) {
// 0xxxxxxx
@@ -192,11 +192,11 @@
}
Uint8List readByteList() {
- return readBytes(readUInt());
+ return readBytes(readUInt30());
}
String readString() {
- return readStringEntry(readUInt());
+ return readStringEntry(readUInt30());
}
String readStringEntry(int numBytes) {
@@ -268,10 +268,10 @@
void readStringTable(List<String> table) {
// Read the table of end offsets.
- int length = readUInt();
+ int length = readUInt30();
List<int> endOffsets = new List<int>(length);
for (int i = 0; i < length; ++i) {
- endOffsets[i] = readUInt();
+ endOffsets[i] = readUInt30();
}
// Read the WTF-8 encoded strings.
table.length = length;
@@ -283,7 +283,7 @@
}
void readConstantTable() {
- final int length = readUInt();
+ final int length = readUInt30();
final int startOffset = byteOffset;
for (int i = 0; i < length; i++) {
_constantTable[byteOffset - startOffset] = readConstantTableEntry();
@@ -309,7 +309,7 @@
case ConstantTag.MapConstant:
final DartType keyType = readDartType();
final DartType valueType = readDartType();
- final int length = readUInt();
+ final int length = readUInt30();
final List<ConstantMapEntry> entries =
new List<ConstantMapEntry>.filled(length, null, growable: true);
for (int i = 0; i < length; i++) {
@@ -320,7 +320,7 @@
return new MapConstant(keyType, valueType, entries);
case ConstantTag.ListConstant:
final DartType typeArgument = readDartType();
- final int length = readUInt();
+ final int length = readUInt30();
final List<Constant> entries =
new List<Constant>.filled(length, null, growable: true);
for (int i = 0; i < length; i++) {
@@ -329,7 +329,7 @@
return new ListConstant(typeArgument, entries);
case ConstantTag.SetConstant:
final DartType typeArgument = readDartType();
- final int length = readUInt();
+ final int length = readUInt30();
final List<Constant> entries =
new List<Constant>.filled(length, null, growable: true);
for (int i = 0; i < length; i++) {
@@ -338,13 +338,13 @@
return new SetConstant(typeArgument, entries);
case ConstantTag.InstanceConstant:
final Reference classReference = readClassReference();
- final int typeArgumentCount = readUInt();
+ final int typeArgumentCount = readUInt30();
final List<DartType> typeArguments =
new List<DartType>.filled(typeArgumentCount, null, growable: true);
for (int i = 0; i < typeArgumentCount; i++) {
typeArguments[i] = readDartType();
}
- final int fieldValueCount = readUInt();
+ final int fieldValueCount = readUInt30();
final Map<Reference, Constant> fieldValues = <Reference, Constant>{};
for (int i = 0; i < fieldValueCount; i++) {
final Reference fieldRef =
@@ -356,7 +356,7 @@
case ConstantTag.PartialInstantiationConstant:
final TearOffConstant tearOffConstant =
readConstantReference() as TearOffConstant;
- final int length = readUInt();
+ final int length = readUInt30();
final List<DartType> types = new List<DartType>(length);
for (int i = 0; i < length; i++) {
types[i] = readDartType();
@@ -377,22 +377,22 @@
}
Constant readConstantReference() {
- final int offset = readUInt();
+ final int offset = readUInt30();
Constant constant = _constantTable[offset];
assert(constant != null);
return constant;
}
Uri readUriReference() {
- return _sourceUriTable[readUInt()];
+ return _sourceUriTable[readUInt30()];
}
String readStringReference() {
- return _stringTable[readUInt()];
+ return _stringTable[readUInt30()];
}
List<String> readStringReferenceList() {
- int length = readUInt();
+ int length = readUInt30();
List<String> result = new List<String>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
result[i] = readStringReference();
@@ -417,7 +417,7 @@
}
List<Expression> readAnnotationList(TreeNode parent) {
- int length = readUInt();
+ int length = readUInt30();
if (length == 0) return const <Expression>[];
List<Expression> list =
new List<Expression>.filled(length, null, growable: true);
@@ -429,7 +429,7 @@
void _fillTreeNodeList(
List<TreeNode> list, TreeNode buildObject(int index), TreeNode parent) {
- int length = readUInt();
+ int length = readUInt30();
list.length = length;
for (int i = 0; i < length; ++i) {
TreeNode object = buildObject(i);
@@ -438,7 +438,7 @@
}
void _fillNonTreeNodeList(List<Node> list, Node buildObject()) {
- int length = readUInt();
+ int length = readUInt30();
list.length = length;
for (int i = 0; i < length; ++i) {
Node object = buildObject();
@@ -461,10 +461,10 @@
}
void readLinkTable(CanonicalName linkRoot) {
- int length = readUInt();
+ int length = readUInt30();
_linkTable = new List<CanonicalName>(length);
for (int i = 0; i < length; ++i) {
- int biasedParentIndex = readUInt();
+ int biasedParentIndex = readUInt30();
String name = readStringReference();
CanonicalName parent =
biasedParentIndex == 0 ? linkRoot : _linkTable[biasedParentIndex - 1];
@@ -808,7 +808,7 @@
/// Read a list of strings. If the list is empty, [null] is returned.
List<String> readListOfStrings() {
- int length = readUInt();
+ int length = readUInt30();
if (length == 0) return null;
List<String> strings =
new List<String>.filled(length, null, growable: true);
@@ -830,11 +830,11 @@
Uri uri = uriString.isEmpty ? null : Uri.parse(uriString);
_sourceUriTable[i] = uri;
Uint8List sourceCode = readByteList();
- int lineCount = readUInt();
+ int lineCount = readUInt30();
List<int> lineStarts = new List<int>(lineCount);
int previousLineStart = 0;
for (int j = 0; j < lineCount; ++j) {
- int lineStart = readUInt() + previousLineStart;
+ int lineStart = readUInt30() + previousLineStart;
lineStarts[j] = lineStart;
previousLineStart = lineStart;
}
@@ -869,7 +869,7 @@
}
CanonicalName readCanonicalNameReference() {
- int index = readUInt();
+ int index = readUInt30();
if (index == 0) return null;
return _linkTable[index - 1];
}
@@ -887,7 +887,7 @@
}
LibraryDependency readLibraryDependencyReference() {
- int index = readUInt();
+ int index = readUInt30();
return _currentLibrary.dependencies[index];
}
@@ -963,8 +963,8 @@
int flags = readByte();
- int languageVersionMajor = readUInt();
- int languageVersionMinor = readUInt();
+ int languageVersionMajor = readUInt30();
+ int languageVersionMinor = readUInt30();
CanonicalName canonicalName = readCanonicalNameReference();
Reference reference = canonicalName.getReference();
@@ -1034,7 +1034,7 @@
}
void _readLibraryDependencies(Library library) {
- int length = readUInt();
+ int length = readUInt30();
library.dependencies.length = length;
for (int i = 0; i < length; ++i) {
library.dependencies[i] = readLibraryDependency(library);
@@ -1055,7 +1055,7 @@
}
void _readAdditionalExports(Library library) {
- int numExportedReference = readUInt();
+ int numExportedReference = readUInt30();
if (numExportedReference != 0) {
library.additionalExports.clear();
for (int i = 0; i < numExportedReference; i++) {
@@ -1073,7 +1073,7 @@
}
List<Combinator> readCombinatorList() {
- int length = readUInt();
+ int length = readUInt30();
List<Combinator> result =
new List<Combinator>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -1083,7 +1083,7 @@
}
void _readLibraryParts(Library library) {
- int length = readUInt();
+ int length = readUInt30();
library.parts.length = length;
for (int i = 0; i < length; ++i) {
library.parts[i] = readLibraryPart(library);
@@ -1225,7 +1225,7 @@
node.fileUri = fileUri;
node.onType = onType;
- int length = readUInt();
+ int length = readUInt30();
node.members.length = length;
for (int i = 0; i < length; i++) {
Name name = readName();
@@ -1303,7 +1303,7 @@
Uri fileUri = readUriReference();
int fileOffset = readOffset();
int fileEndOffset = readOffset();
- int flags = readUInt();
+ int flags = readUInt30();
Name name = readName();
List<Expression> annotations = readAnnotationList(node);
assert(() {
@@ -1389,7 +1389,7 @@
} else {
assert(node.kind == kind);
}
- int flags = readUInt();
+ int flags = readUInt30();
Name name = readName();
List<Expression> annotations = readAnnotationList(node);
assert(() {
@@ -1462,8 +1462,8 @@
List<DartType> typeArguments = readDartTypeList();
int typeParameterStackHeight = typeParameterStack.length;
List<TypeParameter> typeParameters = readAndPushTypeParameterList();
- readUInt(); // Total parameter count.
- int requiredParameterCount = readUInt();
+ readUInt30(); // Total parameter count.
+ int requiredParameterCount = readUInt30();
int variableStackHeight = variableStack.length;
List<VariableDeclaration> positional = readAndPushVariableDeclarationList();
List<VariableDeclaration> named = readAndPushVariableDeclarationList();
@@ -1534,8 +1534,8 @@
AsyncMarker dartAsyncMarker = AsyncMarker.values[readByte()];
int typeParameterStackHeight = typeParameterStack.length;
List<TypeParameter> typeParameters = readAndPushTypeParameterList();
- readUInt(); // total parameter count.
- int requiredParameterCount = readUInt();
+ readUInt30(); // total parameter count.
+ int requiredParameterCount = readUInt30();
int variableStackHeight = variableStack.length;
List<VariableDeclaration> positional = readAndPushVariableDeclarationList();
List<VariableDeclaration> named = readAndPushVariableDeclarationList();
@@ -1617,7 +1617,7 @@
}
VariableDeclaration readVariableReference() {
- int index = readUInt();
+ int index = readUInt30();
if (index >= variableStack.length) {
throw fail('unexpected variable index: $index');
}
@@ -1636,7 +1636,7 @@
}
List<Expression> readExpressionList() {
- int length = readUInt();
+ int length = readUInt30();
List<Expression> result =
new List<Expression>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -1665,23 +1665,23 @@
..fileOffset = offset;
case Tag.VariableGet:
int offset = readOffset();
- readUInt(); // offset of the variable declaration in the binary.
+ readUInt30(); // offset of the variable declaration in the binary.
return new VariableGet(readVariableReference(), readDartTypeOption())
..fileOffset = offset;
case Tag.SpecializedVariableGet:
int index = tagByte & Tag.SpecializedPayloadMask;
int offset = readOffset();
- readUInt(); // offset of the variable declaration in the binary.
+ readUInt30(); // offset of the variable declaration in the binary.
return new VariableGet(variableStack[index])..fileOffset = offset;
case Tag.VariableSet:
int offset = readOffset();
- readUInt(); // offset of the variable declaration in the binary.
+ readUInt30(); // offset of the variable declaration in the binary.
return new VariableSet(readVariableReference(), readExpression())
..fileOffset = offset;
case Tag.SpecializedVariableSet:
int index = tagByte & Tag.SpecializedPayloadMask;
int offset = readOffset();
- readUInt(); // offset of the variable declaration in the binary.
+ readUInt30(); // offset of the variable declaration in the binary.
return new VariableSet(variableStack[index], readExpression())
..fileOffset = offset;
case Tag.PropertyGet:
@@ -1790,7 +1790,7 @@
int offset = readOffset();
Reference classReference = readClassReference();
List<DartType> typeArguments = readDartTypeList();
- int fieldValueCount = readUInt();
+ int fieldValueCount = readUInt30();
Map<Reference, Expression> fieldValues = <Reference, Expression>{};
for (int i = 0; i < fieldValueCount; i++) {
final Reference fieldRef =
@@ -1798,7 +1798,7 @@
final Expression value = readExpression();
fieldValues[fieldRef] = value;
}
- int assertCount = readUInt();
+ int assertCount = readUInt30();
List<AssertStatement> asserts = new List<AssertStatement>(assertCount);
for (int i = 0; i < assertCount; i++) {
asserts[i] = readStatement();
@@ -1830,9 +1830,9 @@
int biasedValue = tagByte & Tag.SpecializedPayloadMask;
return new IntLiteral(biasedValue - Tag.SpecializedIntLiteralBias);
case Tag.PositiveIntLiteral:
- return new IntLiteral(readUInt());
+ return new IntLiteral(readUInt30());
case Tag.NegativeIntLiteral:
- return new IntLiteral(-readUInt());
+ return new IntLiteral(-readUInt30());
case Tag.BigIntLiteral:
return new IntLiteral(int.parse(readStringReference()));
case Tag.DoubleLiteral:
@@ -1926,7 +1926,7 @@
}
List<MapEntry> readMapEntryList() {
- int length = readUInt();
+ int length = readUInt30();
List<MapEntry> result =
new List<MapEntry>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -1940,7 +1940,7 @@
}
List<Statement> readStatementList() {
- int length = readUInt();
+ int length = readUInt30();
List<Statement> result =
new List<Statement>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -1986,7 +1986,7 @@
return label;
case Tag.BreakStatement:
int offset = readOffset();
- int index = readUInt();
+ int index = readUInt30();
return new BreakStatement(labelStack[labelStackBase + index])
..fileOffset = offset;
case Tag.WhileStatement:
@@ -2024,7 +2024,7 @@
case Tag.SwitchStatement:
int offset = readOffset();
Expression expression = readExpression();
- int count = readUInt();
+ int count = readUInt30();
List<SwitchCase> cases =
new List<SwitchCase>.filled(count, null, growable: true);
for (int i = 0; i < count; ++i) {
@@ -2038,7 +2038,7 @@
return new SwitchStatement(expression, cases)..fileOffset = offset;
case Tag.ContinueSwitchStatement:
int offset = readOffset();
- int index = readUInt();
+ int index = readUInt30();
return new ContinueSwitchStatement(
switchCaseStack[switchCaseStackBase + index])
..fileOffset = offset;
@@ -2079,7 +2079,7 @@
}
void readSwitchCaseInto(SwitchCase caseNode) {
- int length = readUInt();
+ int length = readUInt30();
caseNode.expressions.length = length;
caseNode.expressionOffsets.length = length;
for (int i = 0; i < length; ++i) {
@@ -2091,7 +2091,7 @@
}
List<Catch> readCatchList() {
- int length = readUInt();
+ int length = readUInt30();
List<Catch> result = new List<Catch>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
result[i] = readCatch();
@@ -2144,7 +2144,7 @@
}
List<Supertype> readSupertypeList() {
- int length = readUInt();
+ int length = readUInt30();
List<Supertype> result =
new List<Supertype>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -2154,7 +2154,7 @@
}
List<DartType> readDartTypeList() {
- int length = readUInt();
+ int length = readUInt30();
List<DartType> result =
new List<DartType>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -2164,7 +2164,7 @@
}
List<NamedType> readNamedTypeList() {
- int length = readUInt();
+ int length = readUInt30();
List<NamedType> result =
new List<NamedType>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -2239,8 +2239,8 @@
int typeParameterStackHeight = typeParameterStack.length;
int nullabilityIndex = readByte();
List<TypeParameter> typeParameters = readAndPushTypeParameterList();
- int requiredParameterCount = readUInt();
- int totalParameterCount = readUInt();
+ int requiredParameterCount = readUInt30();
+ int totalParameterCount = readUInt30();
List<DartType> positional = readDartTypeList();
List<NamedType> named = readNamedTypeList();
DartType typedefType = readDartTypeOption();
@@ -2261,7 +2261,7 @@
positional, returnType, Nullability.values[nullabilityIndex]);
case Tag.TypeParameterType:
int declaredNullabilityIndex = readByte();
- int index = readUInt();
+ int index = readUInt30();
DartType bound = readDartTypeOption();
return new TypeParameterType(typeParameterStack[index],
Nullability.values[declaredNullabilityIndex], bound);
@@ -2272,7 +2272,7 @@
List<TypeParameter> readAndPushTypeParameterList(
[List<TypeParameter> list, TreeNode parent]) {
- int length = readUInt();
+ int length = readUInt30();
if (length == 0) return list ?? <TypeParameter>[];
if (list == null) {
list = new List<TypeParameter>.filled(length, null, growable: true);
@@ -2307,7 +2307,7 @@
}
Arguments readArguments() {
- int numArguments = readUInt();
+ int numArguments = readUInt30();
List<DartType> typeArguments = readDartTypeList();
List<Expression> positional = readExpressionList();
List<NamedExpression> named = readNamedExpressionList();
@@ -2316,7 +2316,7 @@
}
List<NamedExpression> readNamedExpressionList() {
- int length = readUInt();
+ int length = readUInt30();
List<NamedExpression> result =
new List<NamedExpression>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -2330,7 +2330,7 @@
}
List<VariableDeclaration> readAndPushVariableDeclarationList() {
- int length = readUInt();
+ int length = readUInt30();
List<VariableDeclaration> result =
new List<VariableDeclaration>.filled(length, null, growable: true);
for (int i = 0; i < length; ++i) {
@@ -2376,7 +2376,7 @@
int readOffset() {
// Offset is saved as unsigned,
// but actually ranges from -1 and up (thus the -1)
- return readUInt() - 1;
+ return readUInt30() - 1;
}
}
diff --git a/pkg/test_runner/lib/src/fuchsia.dart b/pkg/test_runner/lib/src/fuchsia.dart
index 182fe4b..a3880c5 100644
--- a/pkg/test_runner/lib/src/fuchsia.dart
+++ b/pkg/test_runner/lib/src/fuchsia.dart
@@ -147,6 +147,9 @@
Future<void> _publishPackage(String buildDir, String mode) async {
var packageFile = '$buildDir/gen/dart_test_$mode/dart_test_$mode.far';
+ if (!File(packageFile).existsSync()) {
+ throw 'File $packageFile does not exist. Please build fuchsia_test_package.';
+ }
DebugLogger.info('Publishing package: $packageFile');
var result = await Process.run(fpubTool, [packageFile]);
if (result.exitCode != 0) {
diff --git a/pkg/test_runner/lib/src/runtime_configuration.dart b/pkg/test_runner/lib/src/runtime_configuration.dart
index 1aa0891..342810a 100644
--- a/pkg/test_runner/lib/src/runtime_configuration.dart
+++ b/pkg/test_runner/lib/src/runtime_configuration.dart
@@ -412,6 +412,7 @@
if (isCrashExpected) {
runtimeArgs.insert(0, '--suppress-core-dump');
}
+ runtimeArgs.insert(runtimeArgs.length - 1, '--disable-dart-dev');
return [
VMCommand(FuchsiaEmulator.fsshTool, runtimeArgs, environmentOverrides)
];
diff --git a/pkg/vm/lib/metadata/loading_units.dart b/pkg/vm/lib/metadata/loading_units.dart
index 410e0d5..3136fee 100644
--- a/pkg/vm/lib/metadata/loading_units.dart
+++ b/pkg/vm/lib/metadata/loading_units.dart
@@ -68,13 +68,13 @@
@override
LoadingUnitsMetadata readFromBinary(Node node, BinarySource source) {
- int length = source.readUInt();
+ int length = source.readUInt30();
var units = <LoadingUnit>[];
for (int i = 0; i < length; i++) {
- int id = source.readUInt();
- int parentId = source.readUInt();
+ int id = source.readUInt30();
+ int parentId = source.readUInt30();
var libraryUris = <String>[];
- int length = source.readUInt();
+ int length = source.readUInt30();
for (int i = 0; i < length; i++) {
libraryUris.add(source.readStringReference());
}
diff --git a/pkg/vm/lib/metadata/procedure_attributes.dart b/pkg/vm/lib/metadata/procedure_attributes.dart
index d6840f2..da78cab 100644
--- a/pkg/vm/lib/metadata/procedure_attributes.dart
+++ b/pkg/vm/lib/metadata/procedure_attributes.dart
@@ -110,8 +110,8 @@
final bool hasNonThisUses = (flags & kNonThisUsesBit) != 0;
final bool hasTearOffUses = (flags & kTearOffUsesBit) != 0;
- final int methodOrSetterSelectorId = source.readUInt();
- final int getterSelectorId = source.readUInt();
+ final int methodOrSetterSelectorId = source.readUInt30();
+ final int getterSelectorId = source.readUInt30();
return new ProcedureAttributesMetadata(
methodOrSetterCalledDynamically: methodOrSetterCalledDynamically,
diff --git a/pkg/vm/lib/metadata/table_selector.dart b/pkg/vm/lib/metadata/table_selector.dart
index e692529..6784fcc 100644
--- a/pkg/vm/lib/metadata/table_selector.dart
+++ b/pkg/vm/lib/metadata/table_selector.dart
@@ -29,7 +29,7 @@
flags = 0;
TableSelectorInfo.readFromBinary(BinarySource source)
- : callCount = source.readUInt(),
+ : callCount = source.readUInt30(),
flags = source.readByte();
void writeToBinary(BinarySink sink) {
@@ -79,7 +79,7 @@
@override
TableSelectorMetadata readFromBinary(Node node, BinarySource source) {
- final int length = source.readUInt();
+ final int length = source.readUInt30();
final List<TableSelectorInfo> selectors = List<TableSelectorInfo>.generate(
length, (_) => TableSelectorInfo.readFromBinary(source));
return TableSelectorMetadata.fromSelectors(selectors);
diff --git a/pkg/vm/lib/metadata/unboxing_info.dart b/pkg/vm/lib/metadata/unboxing_info.dart
index 289819b..7069c05 100644
--- a/pkg/vm/lib/metadata/unboxing_info.dart
+++ b/pkg/vm/lib/metadata/unboxing_info.dart
@@ -23,7 +23,7 @@
UnboxingInfoMetadata.readFromBinary(BinarySource source)
: unboxedArgsInfo = List<int>.generate(
- source.readUInt(), (_) => source.readByte(),
+ source.readUInt30(), (_) => source.readByte(),
growable: true),
returnInfo = source.readByte();
diff --git a/runtime/bin/dart_io_api_impl.cc b/runtime/bin/dart_io_api_impl.cc
index 18be4c8..a890132 100644
--- a/runtime/bin/dart_io_api_impl.cc
+++ b/runtime/bin/dart_io_api_impl.cc
@@ -10,7 +10,9 @@
#include "bin/io_natives.h"
#include "bin/platform.h"
#include "bin/process.h"
-#include "bin/secure_socket_filter.h"
+#if !defined(DART_IO_SECURE_SOCKET_DISABLED)
+ #include "bin/secure_socket_filter.h"
+#endif
#include "bin/thread.h"
#include "bin/utils.h"
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 3caa919..1454154 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -1008,26 +1008,16 @@
s->Push(field->ptr()->initializer_function_);
if (kind != Snapshot::kFullAOT) {
- s->Push(field->ptr()->saved_initial_value_);
s->Push(field->ptr()->guarded_list_length_);
}
if (kind == Snapshot::kFullJIT) {
s->Push(field->ptr()->dependent_code_);
}
- // Write out either static value, initial value or field offset.
+ // Write out either the initial static value or field offset.
if (Field::StaticBit::decode(field->ptr()->kind_bits_)) {
- if (
- // For precompiled static fields, the value was already reset and
- // initializer_ now contains a Function.
- kind == Snapshot::kFullAOT ||
- // Do not reset const fields.
- Field::ConstBit::decode(field->ptr()->kind_bits_)) {
- s->Push(s->field_table()->At(
- Smi::Value(field->ptr()->host_offset_or_field_id_)));
- } else {
- // Otherwise, for static fields we write out the initial static value.
- s->Push(field->ptr()->saved_initial_value_);
- }
+ const intptr_t field_id =
+ Smi::Value(field->ptr()->host_offset_or_field_id_);
+ s->Push(s->initial_field_table()->At(field_id));
} else {
s->Push(Smi::New(Field::TargetOffsetOf(field)));
}
@@ -1056,7 +1046,6 @@
// Write out the initializer function and initial value if not in AOT.
WriteField(field, initializer_function_);
if (kind != Snapshot::kFullAOT) {
- WriteField(field, saved_initial_value_);
WriteField(field, guarded_list_length_);
}
if (kind == Snapshot::kFullJIT) {
@@ -1073,22 +1062,12 @@
}
s->Write<uint16_t>(field->ptr()->kind_bits_);
- // Write out the initial static value or field offset.
+ // Write out either the initial static value or field offset.
if (Field::StaticBit::decode(field->ptr()->kind_bits_)) {
- if (
- // For precompiled static fields, the value was already reset and
- // initializer_ now contains a Function.
- kind == Snapshot::kFullAOT ||
- // Do not reset const fields.
- Field::ConstBit::decode(field->ptr()->kind_bits_)) {
- WriteFieldValue("static value",
- s->field_table()->At(Smi::Value(
- field->ptr()->host_offset_or_field_id_)));
- } else {
- // Otherwise, for static fields we write out the initial static value.
- WriteFieldValue("static value", field->ptr()->saved_initial_value_);
- }
- s->WriteUnsigned(Smi::Value(field->ptr()->host_offset_or_field_id_));
+ const intptr_t field_id =
+ Smi::Value(field->ptr()->host_offset_or_field_id_);
+ WriteFieldValue("static value", s->initial_field_table()->At(field_id));
+ s->WriteUnsigned(field_id);
} else {
WriteFieldValue("offset", Smi::New(Field::TargetOffsetOf(field)));
}
@@ -1123,10 +1102,6 @@
Deserializer::InitializeHeader(field, kFieldCid, Field::InstanceSize());
ReadFromTo(field);
if (kind != Snapshot::kFullAOT) {
-#if !defined(DART_PRECOMPILED_RUNTIME)
- field->ptr()->saved_initial_value_ =
- static_cast<InstancePtr>(d->ReadRef());
-#endif
field->ptr()->guarded_list_length_ = static_cast<SmiPtr>(d->ReadRef());
}
if (kind == Snapshot::kFullJIT) {
@@ -1146,9 +1121,9 @@
ObjectPtr value_or_offset = d->ReadRef();
if (Field::StaticBit::decode(field->ptr()->kind_bits_)) {
- intptr_t field_id = d->ReadUnsigned();
- d->field_table()->SetAt(field_id,
- static_cast<InstancePtr>(value_or_offset));
+ const intptr_t field_id = d->ReadUnsigned();
+ d->initial_field_table()->SetAt(
+ field_id, static_cast<InstancePtr>(value_or_offset));
field->ptr()->host_offset_or_field_id_ = Smi::New(field_id);
} else {
field->ptr()->host_offset_or_field_id_ = Smi::RawCast(value_or_offset);
@@ -5239,7 +5214,7 @@
num_written_objects_(0),
next_ref_index_(kFirstReference),
previous_text_offset_(0),
- field_table_(thread->isolate()->field_table()),
+ initial_field_table_(thread->isolate_group()->initial_field_table()),
vm_(vm),
profile_writer_(profile_writer)
#if defined(SNAPSHOT_BACKTRACE)
@@ -5864,7 +5839,7 @@
WriteUnsigned(num_objects);
WriteUnsigned(canonical_clusters.length());
WriteUnsigned(clusters.length());
- WriteUnsigned(field_table_->NumFieldIds());
+ WriteUnsigned(initial_field_table_->NumFieldIds());
for (SerializationCluster* cluster : canonical_clusters) {
cluster->WriteAndMeasureAlloc(this);
@@ -6145,7 +6120,7 @@
previous_text_offset_(0),
canonical_clusters_(nullptr),
clusters_(nullptr),
- field_table_(thread->isolate()->field_table()),
+ initial_field_table_(thread->isolate_group()->initial_field_table()),
is_non_root_unit_(is_non_root_unit) {
if (Snapshot::IncludesCode(kind)) {
ASSERT(instructions_buffer != nullptr);
@@ -6593,15 +6568,15 @@
num_objects_ = ReadUnsigned();
num_canonical_clusters_ = ReadUnsigned();
num_clusters_ = ReadUnsigned();
- const intptr_t field_table_len = ReadUnsigned();
+ const intptr_t initial_field_table_len = ReadUnsigned();
canonical_clusters_ = new DeserializationCluster*[num_canonical_clusters_];
clusters_ = new DeserializationCluster*[num_clusters_];
refs_ = Array::New(num_objects_ + kFirstReference, Heap::kOld);
- if (field_table_len > 0) {
- field_table_->AllocateIndex(field_table_len - 1);
+ if (initial_field_table_len > 0) {
+ initial_field_table_->AllocateIndex(initial_field_table_len - 1);
}
- ASSERT_EQUAL(field_table_->NumFieldIds(), field_table_len);
+ ASSERT_EQUAL(initial_field_table_->NumFieldIds(), initial_field_table_len);
{
NoSafepointScope no_safepoint;
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index 2632693..031ab05 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -221,7 +221,7 @@
ZoneGrowableArray<Object*>* Serialize(SerializationRoots* roots);
void PrintSnapshotSizes();
- FieldTable* field_table() { return field_table_; }
+ FieldTable* initial_field_table() const { return initial_field_table_; }
NonStreamingWriteStream* stream() { return stream_; }
intptr_t bytes_written() { return stream_->bytes_written(); }
@@ -433,7 +433,7 @@
intptr_t num_written_objects_;
intptr_t next_ref_index_;
intptr_t previous_text_offset_;
- FieldTable* field_table_;
+ FieldTable* initial_field_table_;
intptr_t dispatch_table_size_ = 0;
@@ -641,7 +641,7 @@
Heap* heap() const { return heap_; }
Zone* zone() const { return zone_; }
Snapshot::Kind kind() const { return kind_; }
- FieldTable* field_table() const { return field_table_; }
+ FieldTable* initial_field_table() const { return initial_field_table_; }
private:
Heap* heap_;
@@ -658,7 +658,7 @@
intptr_t previous_text_offset_;
DeserializationCluster** canonical_clusters_;
DeserializationCluster** clusters_;
- FieldTable* field_table_;
+ FieldTable* initial_field_table_;
const bool is_non_root_unit_;
};
diff --git a/runtime/vm/compiler/backend/type_propagator_test.cc b/runtime/vm/compiler/backend/type_propagator_test.cc
index 03bfa0d..2920aca 100644
--- a/runtime/vm/compiler/backend/type_propagator_test.cc
+++ b/runtime/vm/compiler/backend/type_propagator_test.cc
@@ -187,7 +187,7 @@
/*is_reflectable=*/true,
/*is_late=*/false, object_class, Object::dynamic_type(),
TokenPosition::kNoSource, TokenPosition::kNoSource));
- thread->isolate()->RegisterStaticField(field, Instance::Handle());
+ thread->isolate_group()->RegisterStaticField(field, Instance::Handle());
FlowGraphBuilderHelper H;
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 2f93972..73473a2 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -124,13 +124,13 @@
Field_initializer_function_offset = 16;
static constexpr dart::compiler::target::word
Field_host_offset_or_field_id_offset = 20;
-static constexpr dart::compiler::target::word Field_guarded_cid_offset = 48;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 44;
static constexpr dart::compiler::target::word
- Field_guarded_list_length_in_object_offset_offset = 56;
+ Field_guarded_list_length_in_object_offset_offset = 52;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 28;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 50;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 58;
+ 24;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 46;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 54;
static constexpr dart::compiler::target::word Function_code_offset = 44;
static constexpr dart::compiler::target::word Function_data_offset = 36;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -463,7 +463,7 @@
12;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
24;
-static constexpr dart::compiler::target::word Field_InstanceSize = 64;
+static constexpr dart::compiler::target::word Field_InstanceSize = 60;
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 = 96;
@@ -642,13 +642,13 @@
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 = 88;
+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 = 96;
+ Field_guarded_list_length_in_object_offset_offset = 88;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 56;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 90;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 98;
+ 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 = 88;
static constexpr dart::compiler::target::word Function_data_offset = 72;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -986,7 +986,7 @@
24;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
48;
-static constexpr dart::compiler::target::word Field_InstanceSize = 104;
+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 = 144;
@@ -1164,13 +1164,13 @@
Field_initializer_function_offset = 16;
static constexpr dart::compiler::target::word
Field_host_offset_or_field_id_offset = 20;
-static constexpr dart::compiler::target::word Field_guarded_cid_offset = 48;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 44;
static constexpr dart::compiler::target::word
- Field_guarded_list_length_in_object_offset_offset = 56;
+ Field_guarded_list_length_in_object_offset_offset = 52;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 28;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 50;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 58;
+ 24;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 46;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 54;
static constexpr dart::compiler::target::word Function_code_offset = 44;
static constexpr dart::compiler::target::word Function_data_offset = 36;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -1500,7 +1500,7 @@
12;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
24;
-static constexpr dart::compiler::target::word Field_InstanceSize = 64;
+static constexpr dart::compiler::target::word Field_InstanceSize = 60;
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 = 96;
@@ -1679,13 +1679,13 @@
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 = 88;
+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 = 96;
+ Field_guarded_list_length_in_object_offset_offset = 88;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 56;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 90;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 98;
+ 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 = 88;
static constexpr dart::compiler::target::word Function_data_offset = 72;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -2024,7 +2024,7 @@
24;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
48;
-static constexpr dart::compiler::target::word Field_InstanceSize = 104;
+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 = 144;
@@ -2202,13 +2202,13 @@
Field_initializer_function_offset = 16;
static constexpr dart::compiler::target::word
Field_host_offset_or_field_id_offset = 20;
-static constexpr dart::compiler::target::word Field_guarded_cid_offset = 48;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 44;
static constexpr dart::compiler::target::word
- Field_guarded_list_length_in_object_offset_offset = 56;
+ Field_guarded_list_length_in_object_offset_offset = 52;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 28;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 50;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 58;
+ 24;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 46;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 54;
static constexpr dart::compiler::target::word Function_code_offset = 44;
static constexpr dart::compiler::target::word Function_data_offset = 36;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -2537,7 +2537,7 @@
12;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
24;
-static constexpr dart::compiler::target::word Field_InstanceSize = 64;
+static constexpr dart::compiler::target::word Field_InstanceSize = 60;
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 = 96;
@@ -2714,13 +2714,13 @@
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 = 88;
+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 = 96;
+ Field_guarded_list_length_in_object_offset_offset = 88;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 56;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 90;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 98;
+ 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 = 88;
static constexpr dart::compiler::target::word Function_data_offset = 72;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -3054,7 +3054,7 @@
24;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
48;
-static constexpr dart::compiler::target::word Field_InstanceSize = 104;
+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 = 144;
@@ -3230,13 +3230,13 @@
Field_initializer_function_offset = 16;
static constexpr dart::compiler::target::word
Field_host_offset_or_field_id_offset = 20;
-static constexpr dart::compiler::target::word Field_guarded_cid_offset = 48;
+static constexpr dart::compiler::target::word Field_guarded_cid_offset = 44;
static constexpr dart::compiler::target::word
- Field_guarded_list_length_in_object_offset_offset = 56;
+ Field_guarded_list_length_in_object_offset_offset = 52;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 28;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 50;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 58;
+ 24;
+static constexpr dart::compiler::target::word Field_is_nullable_offset = 46;
+static constexpr dart::compiler::target::word Field_kind_bits_offset = 54;
static constexpr dart::compiler::target::word Function_code_offset = 44;
static constexpr dart::compiler::target::word Function_data_offset = 36;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -3562,7 +3562,7 @@
12;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
24;
-static constexpr dart::compiler::target::word Field_InstanceSize = 64;
+static constexpr dart::compiler::target::word Field_InstanceSize = 60;
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 = 96;
@@ -3739,13 +3739,13 @@
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 = 88;
+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 = 96;
+ Field_guarded_list_length_in_object_offset_offset = 88;
static constexpr dart::compiler::target::word Field_guarded_list_length_offset =
- 56;
-static constexpr dart::compiler::target::word Field_is_nullable_offset = 90;
-static constexpr dart::compiler::target::word Field_kind_bits_offset = 98;
+ 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 = 88;
static constexpr dart::compiler::target::word Function_data_offset = 72;
static constexpr dart::compiler::target::word Function_entry_point_offset[] = {
@@ -4080,7 +4080,7 @@
24;
static constexpr dart::compiler::target::word FfiTrampolineData_InstanceSize =
48;
-static constexpr dart::compiler::target::word Field_InstanceSize = 104;
+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 = 144;
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 1d9be24..b42149e 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -693,8 +693,8 @@
}
I->isolate_object_store()->Init();
I->isolate_object_store()->PreallocateObjects();
- I->set_field_table(
- T, source_isolate_group->saved_initial_field_table()->Clone());
+ I->set_field_table(T, source_isolate_group->initial_field_table()->Clone(
+ /*is_isolate_field_table=*/true));
return true;
}
@@ -739,8 +739,8 @@
return error.raw();
}
- I->group()->set_saved_initial_field_table(
- std::shared_ptr<FieldTable>(I->field_table()->Clone()));
+ I->set_field_table(T, I->group()->initial_field_table()->Clone(
+ /*is_isolate_field_table=*/true));
#if defined(SUPPORT_TIMELINE)
if (tbes.enabled()) {
diff --git a/runtime/vm/field_table.cc b/runtime/vm/field_table.cc
index 495d7a0..8185067 100644
--- a/runtime/vm/field_table.cc
+++ b/runtime/vm/field_table.cc
@@ -73,7 +73,7 @@
Grow(new_capacity);
}
- ASSERT(table_[index] == nullptr);
+ ASSERT(table_[index] == InstancePtr());
if (index >= top_) {
top_ = index + 1;
}
@@ -98,14 +98,16 @@
// via store to table_.
std::atomic_thread_fence(std::memory_order_release);
table_ = new_table;
- Thread::Current()->field_table_values_ = table_;
+ if (is_isolate_field_table_) {
+ Thread::Current()->field_table_values_ = table_;
+ }
}
-FieldTable* FieldTable::Clone() {
- FieldTable* clone = new FieldTable();
+FieldTable* FieldTable::Clone(bool is_isolate_field_table) {
+ FieldTable* clone = new FieldTable(is_isolate_field_table);
auto new_table = static_cast<InstancePtr*>(
malloc(capacity_ * sizeof(InstancePtr))); // NOLINT
- memmove(new_table, table_, top_ * sizeof(InstancePtr));
+ memmove(new_table, table_, capacity_ * sizeof(InstancePtr));
ASSERT(clone->table_ == nullptr);
clone->table_ = new_table;
clone->capacity_ = capacity_;
diff --git a/runtime/vm/field_table.h b/runtime/vm/field_table.h
index b4c8f23..dde4200 100644
--- a/runtime/vm/field_table.h
+++ b/runtime/vm/field_table.h
@@ -20,12 +20,13 @@
class FieldTable {
public:
- FieldTable()
+ explicit FieldTable(bool is_isolate_field_table)
: top_(0),
capacity_(0),
free_head_(-1),
table_(nullptr),
- old_tables_(new MallocGrowableArray<InstancePtr*>()) {}
+ old_tables_(new MallocGrowableArray<InstancePtr*>()),
+ is_isolate_field_table_(is_isolate_field_table) {}
~FieldTable();
@@ -55,7 +56,7 @@
}
void SetAt(intptr_t index, InstancePtr raw_instance);
- FieldTable* Clone();
+ FieldTable* Clone(bool is_isolate_field_table);
void VisitObjectPointers(ObjectPointerVisitor* visitor);
@@ -82,6 +83,11 @@
// so it will get freed when its are no longer in use.
MallocGrowableArray<InstancePtr*>* old_tables_;
+ // Whether this table is used as a isolate-specific table of it's global field
+ // values and therefore needs to keep the cached field table in the `Thread`
+ // object up-to-date.
+ bool is_isolate_field_table_;
+
DISALLOW_COPY_AND_ASSIGN(FieldTable);
};
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 17b8bb4..2fe5ead 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -353,6 +353,7 @@
store_buffer_(new StoreBuffer()),
heap_(nullptr),
saved_unlinked_calls_(Array::null()),
+ initial_field_table_(new FieldTable(/*is_isolate_field_table=*/false)),
symbols_lock_(new SafepointRwLock()),
type_canonicalization_mutex_(
NOT_IN_PRODUCT("IsolateGroup::type_canonicalization_mutex_")),
@@ -888,11 +889,18 @@
}
#endif // DEBUG
-void Isolate::RegisterStaticField(const Field& field,
- const Instance& initial_value) {
+void IsolateGroup::RegisterStaticField(const Field& field,
+ const Instance& initial_value) {
ASSERT(field.is_static());
- field_table()->Register(field);
- field.SetStaticValue(initial_value, /*save_initial_value=*/true);
+ initial_field_table()->Register(field);
+ initial_field_table()->SetAt(field.field_id(), initial_value.raw());
+
+ // TODO(dartbug.com/36097): When we start sharing the object stores (and
+ // therefore libraries, classes, fields) we'll have to register the initial
+ // static field value in all isolates.
+ auto current = Isolate::Current();
+ current->field_table()->AllocateIndex(field.field_id());
+ current->field_table()->SetAt(field.field_id(), initial_value.raw());
}
void Isolate::RehashConstants() {
@@ -1607,7 +1615,7 @@
default_tag_(UserTag::null()),
ic_miss_code_(Code::null()),
shared_class_table_(isolate_group->shared_class_table()),
- field_table_(new FieldTable()),
+ field_table_(new FieldTable(/*is_isolate_field_table=*/true)),
isolate_group_(isolate_group),
isolate_object_store_(
new IsolateObjectStore(isolate_group->object_store())),
@@ -2787,9 +2795,7 @@
object_store()->VisitObjectPointers(visitor);
}
visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&saved_unlinked_calls_));
- if (saved_initial_field_table() != nullptr) {
- saved_initial_field_table()->VisitObjectPointers(visitor);
- }
+ initial_field_table()->VisitObjectPointers(visitor);
VisitStackPointers(visitor, validate_frames);
}
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 7f446e3..4a56206 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -614,18 +614,18 @@
ArrayPtr saved_unlinked_calls() const { return saved_unlinked_calls_; }
void set_saved_unlinked_calls(const Array& saved_unlinked_calls);
- FieldTable* saved_initial_field_table() const {
- return saved_initial_field_table_.get();
+ FieldTable* initial_field_table() const { return initial_field_table_.get(); }
+ std::shared_ptr<FieldTable> initial_field_table_shareable() {
+ return initial_field_table_;
}
- std::shared_ptr<FieldTable> saved_initial_field_table_shareable() {
- return saved_initial_field_table_;
- }
- void set_saved_initial_field_table(std::shared_ptr<FieldTable> field_table) {
- saved_initial_field_table_ = field_table;
+ void set_initial_field_table(std::shared_ptr<FieldTable> field_table) {
+ initial_field_table_ = field_table;
}
MutatorThreadPool* thread_pool() { return thread_pool_.get(); }
+ void RegisterStaticField(const Field& field, const Instance& initial_value);
+
private:
friend class Dart; // For `object_store_ = ` in Dart::Init
friend class Heap;
@@ -709,7 +709,7 @@
const uint8_t* dispatch_table_snapshot_ = nullptr;
intptr_t dispatch_table_snapshot_size_ = 0;
ArrayPtr saved_unlinked_calls_;
- std::shared_ptr<FieldTable> saved_initial_field_table_;
+ std::shared_ptr<FieldTable> initial_field_table_;
uint32_t isolate_group_flags_ = 0;
std::unique_ptr<SafepointRwLock> symbols_lock_;
@@ -795,8 +795,6 @@
#if defined(DEBUG)
void ValidateClassTable();
#endif
- // Register a newly introduced static field.
- void RegisterStaticField(const Field& field, const Instance& initial_value);
void RehashConstants();
#if defined(DEBUG)
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 6acd881..e37f325 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -29,6 +29,7 @@
#define Z (zone_)
#define I (isolate_)
+#define IG (isolate_->group())
#define T (type_translator_)
#define H (translation_helper_)
@@ -1243,7 +1244,7 @@
static_field_value_ =
GenerateFieldAccessors(toplevel_class, field, &field_helper);
}
- I->RegisterStaticField(field, static_field_value_);
+ IG->RegisterStaticField(field, static_field_value_);
if ((FLAG_enable_mirrors || has_pragma_annotation) &&
annotation_count > 0) {
@@ -1620,7 +1621,7 @@
GenerateFieldAccessors(klass, field, &field_helper);
}
if (field.is_static()) {
- I->RegisterStaticField(field, static_field_value_);
+ IG->RegisterStaticField(field, static_field_value_);
}
if ((FLAG_enable_mirrors || has_pragma_annotation) &&
annotation_count > 0) {
@@ -1642,7 +1643,7 @@
/* is_reflectable = */ false,
/* is_late = */ false, klass, Object::dynamic_type(),
TokenPosition::kNoSource, TokenPosition::kNoSource);
- I->RegisterStaticField(deleted_enum_sentinel, Instance::Handle());
+ IG->RegisterStaticField(deleted_enum_sentinel, Instance::Handle());
fields_.Add(&deleted_enum_sentinel);
}
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 3fe04bb..b3773a3 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -4378,7 +4378,7 @@
}
auto thread = Thread::Current();
- auto isolate = thread->isolate();
+ auto isolate_group = thread->isolate_group();
auto zone = thread->zone();
Field& field = Field::Handle(zone);
Smi& value = Smi::Handle(zone);
@@ -4417,7 +4417,7 @@
/* is_late = */ false, *this, field_type,
TokenPosition::kMinSource, TokenPosition::kMinSource);
value = Smi::New(cid_fields[i].cid);
- isolate->RegisterStaticField(field, value);
+ isolate_group->RegisterStaticField(field, value);
AddField(field);
}
@@ -10457,6 +10457,7 @@
ASSERT(is_instance());
ASSERT(instance.GetField(*this) == Object::sentinel().raw());
Object& value = Object::Handle();
+
if (has_nontrivial_initializer()) {
const Function& initializer = Function::Handle(EnsureInitializerFunction());
const Array& args = Array::Handle(Array::New(1));
@@ -10473,7 +10474,9 @@
#if defined(DART_PRECOMPILED_RUNTIME)
UNREACHABLE();
#else
- value = saved_initial_value();
+ // Our trivial initializer is `null`. Any non-`null` initializer is
+ // non-trivial (see `KernelLoader::CheckForInitializer()`).
+ value = Object::null();
#endif
}
ASSERT(value.IsNull() || value.IsInstance());
@@ -10513,8 +10516,9 @@
}
}
ASSERT(value.IsNull() || value.IsInstance());
- SetStaticValue(value.IsNull() ? Instance::null_instance()
- : Instance::Cast(value));
+ SetStaticValue(
+ value.IsNull() ? Instance::null_instance() : Instance::Cast(value),
+ is_const());
return Error::null();
} else if (StaticValue() == Object::transition_sentinel().raw()) {
ASSERT(!is_late());
@@ -10738,7 +10742,7 @@
isolate->field_table()->SetAt(id, value.raw());
if (save_initial_value) {
#if !defined(DART_PRECOMPILED_RUNTIME)
- StorePointer(&raw_ptr()->saved_initial_value_, value.raw());
+ isolate->group()->initial_field_table()->SetAt(field_id(), value.raw());
#endif
}
}
@@ -11662,7 +11666,7 @@
field.SetFieldType(Object::dynamic_type());
field.set_is_reflectable(false);
field.set_kernel_offset(kernel_offset);
- thread->isolate()->RegisterStaticField(field, Array::empty_array());
+ thread->isolate_group()->RegisterStaticField(field, Array::empty_array());
GrowableObjectArray& metadata =
GrowableObjectArray::Handle(zone, this->metadata());
@@ -13370,7 +13374,7 @@
intptr_t kernel_offset) {
auto thread = Thread::Current();
auto zone = thread->zone();
- auto isolate = thread->isolate();
+ auto isolate_group = thread->isolate_group();
ASSERT(Field::Handle(zone, metadata_field()).IsNull());
Field& field =
Field::Handle(zone, Field::NewTopLevel(Symbols::TopLevel(),
@@ -13381,7 +13385,7 @@
field.set_is_reflectable(false);
field.SetFieldType(Object::dynamic_type());
field.set_kernel_offset(kernel_offset);
- isolate->RegisterStaticField(field, Array::empty_array());
+ isolate_group->RegisterStaticField(field, Array::empty_array());
set_metadata_field(field);
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index a950136..ddfb7be 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -4039,13 +4039,6 @@
inline intptr_t field_id() const;
inline void set_field_id(intptr_t field_id) const;
-#ifndef DART_PRECOMPILED_RUNTIME
- InstancePtr saved_initial_value() const {
- return raw_ptr()->saved_initial_value_;
- }
- inline void set_saved_initial_value(const Instance& value) const;
-#endif
-
ClassPtr Owner() const;
ClassPtr Origin() const; // Either mixin class, or same as owner().
ScriptPtr Script() const;
@@ -11097,12 +11090,6 @@
StoreSmi(&raw_ptr()->host_offset_or_field_id_, Smi::New(field_id));
}
-#ifndef DART_PRECOMPILED_RUNTIME
-void Field::set_saved_initial_value(const Instance& value) const {
- StorePointer(&raw_ptr()->saved_initial_value_, value.raw());
-}
-#endif
-
void Context::SetAt(intptr_t index, const Object& value) const {
StorePointer(ObjectAddr(index), value.raw());
}
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 9413a44..336008f 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -2956,7 +2956,7 @@
const Field& field = Field::Handle(Field::New(
field_name, true, false, false, true, false, cls, Object::dynamic_type(),
TokenPosition::kMinSource, TokenPosition::kMinSource));
- thread->isolate()->RegisterStaticField(field, Instance::sentinel());
+ thread->isolate_group()->RegisterStaticField(field, Instance::sentinel());
return field.raw();
}
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 8cd6c5a..a5b0686 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -1169,11 +1169,6 @@
// - for instance fields: offset in words to the value in the class instance.
// - for static fields: index into field_table.
SmiPtr host_offset_or_field_id_;
-
- // When generating APPJIT snapshots after running the application it is
- // necessary to save the initial value of static fields so that we can
- // restore the value back to the original initial value.
- NOT_IN_PRECOMPILED(InstancePtr saved_initial_value_); // Saved initial value
SmiPtr guarded_list_length_;
ArrayPtr dependent_code_;
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc
index e4ffd3e..76d9e3e 100644
--- a/runtime/vm/raw_object_fields.cc
+++ b/runtime/vm/raw_object_fields.cc
@@ -202,7 +202,6 @@
F(Code, static_calls_target_table_) \
F(ICData, receivers_static_type_) \
F(Function, unoptimized_code_) \
- F(Field, saved_initial_value_) \
F(Field, type_test_cache_) \
F(WeakSerializationReference, target_)
diff --git a/tools/VERSION b/tools/VERSION
index cb9c202..438d08f 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 73
+PRERELEASE 74
PRERELEASE_PATCH 0
\ No newline at end of file