Skip to content

Commit

Permalink
Version 3.7.0-111.0.dev
Browse files Browse the repository at this point in the history
Merge 3a895e2 into dev
  • Loading branch information
Dart CI committed Nov 6, 2024
2 parents 080b1ee + 3a895e2 commit ac93f82
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 53 deletions.
21 changes: 18 additions & 3 deletions pkg/dart2native/lib/dart2native_pe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ class CoffHeaders {

int get size => optionalHeader.headersSize;

void addSnapshotSectionHeader(int length) {
// Add a section header for the new "snapshot" section with the given length.
//
// Returns offset at which the section is expected to be located in the
// file.
int addSnapshotSectionHeader(int length) {
final oldHeadersSize = optionalHeader.headersSize;
final address =
align(sectionTable.addressEnd, optionalHeader.sectionAlignment);
Expand Down Expand Up @@ -265,6 +269,8 @@ class CoffHeaders {
optionalHeader.imageSize = align(
newHeader.virtualAddress + newHeader.virtualSize,
optionalHeader.sectionAlignment);

return offset;
}

Future<void> write(RandomAccessFile output) async {
Expand Down Expand Up @@ -318,11 +324,20 @@ class PortableExecutable {
await stream.writeFrom(source, 0, sourceFileHeaderOffset);
// Write headers with additional snapshot section.
final snapshotBytes = await snapshot.readAsBytes();
headers.addSnapshotSectionHeader(snapshotBytes.length);
final oldOffsetEnd = headers.sectionTable.offsetEnd;
final expectedSnapshotOffset =
headers.addSnapshotSectionHeader(snapshotBytes.length);
await headers.write(stream);
// Write original section contents with alignment padding.
await stream.writeFrom(source, sourceSectionContentsOffset);
await stream.writeFrom(source, sourceSectionContentsOffset, oldOffsetEnd);
await _fileAlignSectionEnd(stream);
// Verify that snapshot section will start at the expected offset
// and throw an error otherwise.
final currentOffset = await stream.position();
if (expectedSnapshotOffset != currentOffset) {
throw StateError('Unexpected snapshot section offset: '
'expected $expectedSnapshotOffset, got $currentOffset');
}
// Write snapshot with alignment padding.
await stream.writeFrom(snapshotBytes);
await _fileAlignSectionEnd(stream);
Expand Down
5 changes: 1 addition & 4 deletions pkg/dart2wasm/lib/class_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,7 @@ class ClassInfoCollector {
// directly below the public classes they implement.
// All other classes sit below their superclass.
ClassInfo superInfo = cls == translator.coreTypes.boolClass ||
cls == translator.coreTypes.numClass ||
cls == translator.boxedIntClass ||
cls == translator.boxedDoubleClass ||
cls == translator.boxedBoolClass
cls == translator.coreTypes.numClass
? topInfo
: (!translator.options.jsCompatibility &&
cls == translator.wasmStringBaseClass) ||
Expand Down
5 changes: 0 additions & 5 deletions pkg/dart2wasm/lib/target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ class WasmTarget extends Target {
Class? _closure;
Class? _boxedInt;
Class? _boxedDouble;
Class? _boxedBool;
Map<String, Class>? _nativeClasses;

@override
Expand Down Expand Up @@ -547,10 +546,6 @@ class WasmTarget extends Target {
_boxedDouble ??=
coreTypes.index.getClass("dart:_boxed_double", "BoxedDouble");

@override
Class concreteBoolLiteralClass(CoreTypes coreTypes, bool value) =>
_boxedBool ??= coreTypes.index.getClass("dart:_boxed_bool", "BoxedBool");

@override
DartLibrarySupport get dartLibrarySupport => CustomizedDartLibrarySupport(
unsupported: {if (!enableExperimentalFfi) 'ffi'});
Expand Down
2 changes: 1 addition & 1 deletion pkg/dart2wasm/lib/translator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class Translator with KernelNodes {
late final Map<Class, Class> valueClasses = {
boxedIntClass: boxedIntClass,
boxedDoubleClass: boxedDoubleClass,
boxedBoolClass: boxedBoolClass,
boxedBoolClass: coreTypes.boolClass,
if (!options.jsCompatibility) ...{
oneByteStringClass: stringBaseClass,
twoByteStringClass: stringBaseClass
Expand Down
1 change: 0 additions & 1 deletion pkg/kernel/lib/target/targets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ abstract class Target {
Class? concreteIntLiteralClass(CoreTypes coreTypes, int value) => null;
Class? concreteDoubleLiteralClass(CoreTypes coreTypes, double value) => null;
Class? concreteStringLiteralClass(CoreTypes coreTypes, String value) => null;
Class? concreteBoolLiteralClass(CoreTypes coreTypes, bool value) => null;

Class? concreteAsyncResultClass(CoreTypes coreTypes) => null;
Class? concreteSyncStarResultClass(CoreTypes coreTypes) => null;
Expand Down
19 changes: 4 additions & 15 deletions pkg/vm/lib/transformations/type_flow/summary_collector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,8 @@ class SummaryCollector extends RecursiveResultVisitor<TypeExpr?> {

Class get _superclass => _staticTypeContext!.thisType!.classNode.superclass!;

Type _boolLiteralType(bool value) => value ? _boolTrue : _boolFalse;

Type _intLiteralType(int value, Constant? constant) {
final Class? concreteClass =
target.concreteIntLiteralClass(_environment.coreTypes, value);
Expand Down Expand Up @@ -1464,19 +1466,6 @@ class SummaryCollector extends RecursiveResultVisitor<TypeExpr?> {
return _stringType;
}

Type _boolLiteralType(bool value, Constant? constant) {
final Class? concreteClass =
target.concreteBoolLiteralClass(_environment.coreTypes, value);
if (concreteClass != null) {
constant ??= BoolConstant(value);
return _entryPointsListener
.addAllocatedClass(concreteClass)
.cls
.constantConcreteType(constant);
}
return value ? _boolTrue : _boolFalse;
}

TypeExpr _closureType(LocalFunction node) {
final Class? concreteClass =
target.concreteClosureClass(_environment.coreTypes);
Expand Down Expand Up @@ -1693,7 +1682,7 @@ class SummaryCollector extends RecursiveResultVisitor<TypeExpr?> {

@override
TypeExpr visitBoolLiteral(BoolLiteral node) {
return _boolLiteralType(node.value, null);
return _boolLiteralType(node.value);
}

@override
Expand Down Expand Up @@ -2856,7 +2845,7 @@ class ConstantAllocationCollector implements ConstantVisitor<Type> {

@override
Type visitBoolConstant(BoolConstant constant) {
return summaryCollector._boolLiteralType(constant.value, constant);
return summaryCollector._boolLiteralType(constant.value);
}

@override
Expand Down
19 changes: 4 additions & 15 deletions sdk/lib/_internal/wasm/lib/boxed_bool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@
// BSD-style license that can be found in the LICENSE file.

@pragma("wasm:entry-point")
final class BoxedBool implements bool {
final class BoxedBool extends bool {
// A boxed bool contains an unboxed bool.
@pragma("wasm:entry-point")
final bool value;
bool value = false;

@pragma("wasm:entry-point")
BoxedBool._(this.value);

@override
int get hashCode => this ? 1231 : 1237;

@override
String toString() => this ? "true" : "false";
/// Dummy factory to silence error about missing superclass constructor.
external factory BoxedBool();

@override
bool operator ==(Object other) {
Expand All @@ -24,12 +18,7 @@ final class BoxedBool implements bool {
: false;
}

@override
bool operator &(bool other) => this & other; // Intrinsic &

@override
bool operator ^(bool other) => this ^ other; // Intrinsic ^

@override
bool operator |(bool other) => this | other; // Intrinsic |
}
8 changes: 4 additions & 4 deletions sdk/lib/_internal/wasm/lib/boxed_double.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import 'dart:_string';
import 'dart:_wasm';

@pragma("wasm:entry-point")
final class BoxedDouble implements double {
final class BoxedDouble extends double {
// A boxed double contains an unboxed double.
@pragma("wasm:entry-point")
final double value;
double value = 0.0;

@pragma("wasm:entry-point")
BoxedDouble._(this.value);
/// Dummy factory to silence error about missing superclass constructor.
external factory BoxedDouble();

static const int _mantissaBits = 52;
static const int _exponentBits = 11;
Expand Down
8 changes: 4 additions & 4 deletions sdk/lib/_internal/wasm/lib/boxed_int.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import 'dart:_internal';
import 'dart:_wasm';

@pragma("wasm:entry-point")
final class BoxedInt implements int {
final class BoxedInt extends int {
// A boxed int contains an unboxed int.
@pragma("wasm:entry-point")
final int value;
int value = 0;

@pragma("wasm:entry-point")
BoxedInt._(this.value);
/// Dummy factory to silence error about missing superclass constructor.
external factory BoxedInt();

external num operator +(num other);
external num operator -(num other);
Expand Down
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 7
PATCH 0
PRERELEASE 110
PRERELEASE 111
PRERELEASE_PATCH 0

0 comments on commit ac93f82

Please sign in to comment.