This is work in progress. Several language features are still
unimplemented or only partially implemented.
Instructions for running the compiler and its output can be found in
pkg/dart2wasm/dart2wasm.md. These procedures are preliminary and
expected to change.
The best version of d8 to use for this version of dart2wasm is 10.0.40,
as explained here: https://dart-review.googlesource.com/c/sdk/+/232097
This commit also adds a dart2wasm-hostasserts-linux-x64-d8 testing
configuration to run the compiler over the test suite.
The history of the prototype that this is based on can be seen here:
https://github.com/askeksa-google/sdk/tree/wasm_prototype
Issue: https://github.com/dart-lang/sdk/issues/32894
Change-Id: I910b6ff239ef9c5f66863e4ca97b39b8202cce85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175728
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-win-release-x64-try,vm-kernel-precomp-linux-release-simarm64-try
Change-Id: Iccd080591cc3dda60b5bd2ab9d8f2261445df610
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232880
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This adds support for the generating a synthesized augmentation
library for each library in which phase 1 macros were applied.
Current implementation piggybacks on the patch library support. The
intension is that both patches and augmentations are handled through
the same general mechanism. For now, the wording refers to augmentation
libraries as patch libraries where the implementation is shared.
Testing is extended to verify that the generated classes are
included in the resulting AST.
Change-Id: Ie0d4cfdc84b55ca87e0014794f14b38e442f08eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233101
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Currently, all the language tests that exercise implicit call tearoff
do so using expressions that are either instance creation expressions
(e.g. `new C()`, where `C` is a class containing a `.call` method) or
simple identifiers.
This test exercises all of the syntactic constructs which are capable
of undergoing implicit call tearoff.
This will help ensure that some upcoming analyzer changes don't break
implicit call tearoff support.
Change-Id: I3e6471a3ba22fb3e3be38f2721db549da631668a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232920
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
These appear to be no longer necessary.
Change-Id: I8ec8a13394b6e56697de3ccee3a5326b149a137a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
I'm not 100% sure we have a spec for precisely when we do implicit
call tearoffs and when we don't, but the CFE and analyzer agree on
this behavior, and I'm about to reorganize some of the analyzer code
that handles it, so I'd like to be sure the behavior is tested.
Change-Id: I1afee375181fde7b3a304aa8b71b23a45a337be0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232784
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
- Support TransferableTypedData in the bootstrap code and IsolatedExecutor.
- Also removed the fake executor and conditional import. Mode will likely be chosen based on factors other than just the availability of `dart:isolate`.
- Run the tests in both serialization modes.
Change-Id: I5c731d192c0d3a8cdc5f7fb900dc07a32f4f4d51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
This is a reland of 19e5749308
TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
Original change's description:
> [vm] Add analyze_snapshot tool for AOT snapshot inspection
>
> Current skeleton to allow for instrumentation snapshots that can be
> built alongside Dart compilation artifacts and easily referenced for
> specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
>
> TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
>
> Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>
Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This is a current sweet spot for dart2wasm, since this version is new
enough to support all optional compilation strategies, including
--string-data-segments (as long as it is combined with --nominal-types
and --no-runtime-types) while still supporting the (currently default)
equi-recursive types (which are unsupported from 10.0.41 onward).
This allows us to land dart2wasm in its current form and then change
its type system later, when upcoming WasmGC type system changes in V8
have stabilized.
Change-Id: I05af4265815c2d591ae2630c7bb21c5b043796dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232097
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Previously, when the migration tool encountered a built_value
`@nullable` annotation, it removed it, because when the built_value
code generator is consuming a library with null safety enabled, it
relies on the presence of a `?` to determine nullability, rather than
an annotation. However, there was no logic to actually ensure that
the `?` would actually get introduced, because I thought the code
generated by built_value would always create the conditions necessary
to convince the migration tool to introduce the `?` using its normal
graph traversal algorithm.
It turns out this is not the case: when `@nullable` appears in an
interface class that is used by other built_value classes, but is not
itself a built_value class, the migration tool sometimes doesn't have
enough information to figure out that it needs to add the `?`.
So in this CL, I'm doing what I probably should have done in the first
time: adding the necessary logic to the migration tool to ensure that
the `@nullable` annotation gets translated into a `?` regardless of
whether it is required to by generated code.
Bug: https://buganizer.corp.google.com/issues/217863427
Change-Id: I9efe5241634389981a4c56e764bac91b3350c4fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233003
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL cleans up some indirection now that we only support
KernelFrontendStrategy.
Change-Id: Iaee8d41e061cc88957cae00d61111cbd8c076d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232963
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Remove dead phis including back-edges and cycles.
Add a postcondition validation for optimization phases.
Add post-phase validation test for dead-phi removal and dead-code elimination.
Bug: https://github.com/dart-lang/sdk/issues/48397
Change-Id: I178cda52dd165e825b9e2d9ae642c22162cee2e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232782
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This indirection is no longer needed.
Change-Id: Ic917ec758dc8a8a648fea9f74ddf75f47b6b9d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232485
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
The bad codegen reported in #48383 was due to an unused phi confusing
the expression-tree construction algorithm. It was trying to generate
data = cond ? callWithSideEffects() : null;
but `data` is unused, so somehow we generated only
cond;
We should not have unused phis at this point so I put a safety check
in the above code to not try to build an unused conditional, and
changed the dead-code eliminator to eliminate dead phis.
Now we get
if (cond)
callWithSideEffects();
I compared the output for some large apps and there were about a dozen
changes. All looked like improvements, e.g. not assigning to an unused
variable. There was some code missing that is now present, but luckily
for the large apps, it was all code that did not have real-world side
effects.
Fixed: 48383
Change-Id: Id7b32cfa0cbfb47a4d9eff174ad9ae52da99f6a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232781
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
The --enable-assertions flag is not avaiable in PRODUCT mode, so we skip
this negative subtest.
TEST=Fixes dartkp-product on a newly added test for vm/dart{,_2}/spawn_uri_aot_test
Change-Id: Ie7be219b6eb2a2ac53ea5048a844fafeb488ba54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232941
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This test was modified (in [0]) to use `dart:mirrors` which doesn't
work in AOT mode. So we'll skip it (which fixes some unapproved dartkp
failures).
[0] https://dart-review.googlesource.com/c/sdk/+/230600
TEST=ci
Change-Id: I02f6efded23ae2fa16ee72b792632f252202adf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232900
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Right now the implementation of `Isolate.spawnUri(<uri>, ...)` in
the standalone embedder is to ignore `<uri>` and make the spawnned
isolate from the same AOT snapshot as the main isolate.
This is very confusing and very incorrect.
Instead `Isolate.spawnUri()` should work if-and-only-if the given
`<uri>` points to a valid and compatible AOT snapshot. If not, it should
throw an appropriate exception.
Fixes https://github.com/dart-lang/sdk/issues/48375
Fixes https://github.com/dart-lang/sdk/issues/48326
TEST=vm/dart{,_2}/spawn_uri_aot_test
Change-Id: I279ace08ac1b9a9eed3ae03ebe5d9e2336c1e5c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232603
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.
For additional background information see go/dart-sdk-owners.
TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
This CL add support for identifier resolution to use the
MacroExecutor.buildAugmentationLibrary for generating the code.
The CL updates the ResolvedIdentifier to have a nullable [uri] in
order to support built in identifiers, such as `void`.
Change-Id: I9436ea77c06cf5618f1977f4c9ac0490ff059587
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232623
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The class is no longer used in Dart 2.0 where instantiating an abstract
class became a compile-time error.
The class is now also exported from `dart:mirrors`. Since `dart:mirrors`
throws this error when trying to call a constructor mirror from an
abstract class, it needs to keep having an error to throw.
For backwards compatibility, we'll keep using the same class,
but restrict it to `dart:mirrors` and remove it from `dart:core`
when possible.
Q.v. #30771
Bug: https://darbug.com/30771
Change-Id: I2eef6ff8b1509b00b0567cc1951ae9972c87c3fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232605
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
There are two kinds: which we just built, and from readers.
With this change we will cover also just built libraries.
Change-Id: I67fa8ec5eeb00e539b4bd648d35b547dea8b4a7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232686
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
With the optimizations suggested this does now equal or outperform the JSON serializer in all scenarios, the latest numbers from the benchmark are as follows:
Isolate.spawn + SerializationMode.jsonClient: 0:00:00.041666
Isolate.spawnUri + SerializationMode.jsonClient: 0:00:00.069551
Separate process + SerializationMode.jsonClient: 0:00:00.177171
Isolate.spawn + SerializationMode.byteDataClient: 0:00:00.040990
Isolate.spawnUri + SerializationMode.byteDataClient: 0:00:00.059319
Separate process + SerializationMode.byteDataClient: 0:00:00.080008
Change-Id: If5431513c7487d8b7af350381e794cbd61c1be42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232027
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
The test is flakily failing with low propabililty due to a race on
executing a copy of `process_test` and having this file opened for
writing mode (so it seems).
This issue is not related to isolates and we'll therefore remove it from
the "iso-stress" builder.
TEST=Removes flakiness from "iso-stress" builder.
Closes https://github.com/dart-lang/sdk/issues/48193
Change-Id: I1f817aed9b014b8cdd7a646f35003d40d4712d0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232624
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This strategy is no longer necessary with the single frontend, and
inlining all the logic makes the code much easier to follow.
Change-Id: I73995aa6249b52a932dbfb2d459c2d6633a620d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232029
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This is a reland of e77ea8a17b. I've
undone the change to the name of the platformScript setter, restoring
the previous behavior of accepting anything and casting.
TEST=Existing tests.
Change-Id: I7e36935ef3784035769527dc5624191f38faaa40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232487
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
This test was modified (in [0]) to use `dart:mirrors` which doesn't
work in AOT mode. Only tests that work in AOT are considered for
the iso-stress builder.
[0] https://dart-review.googlesource.com/c/sdk/+/230600
TEST=Fixes "iso-stress" builder failure to compile.
Change-Id: I354784a33550d816332611747c4d41b53d44b2a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232621
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>