- Rename resource identifiers in the VM to usage recordings.
- Use package:record_use for serialization.
- Rename and use the experimental flag for this feature.
- Recognize tear-offs and top-level methods as well.
Next steps:
- Add constant instance recording.
- Expose API in package:native_assets_cli's link callback.
TEST=pkg/vm/test/transformations/record_use_test.dart
Change-Id: I8af3625165f78925ae943711245af93a239d1012
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
Aligns exit codes of
* `dart compile wasm` and
* `pkg/dart2wasm/tool/compile_benchmark`
Also make them use exit codes recognized by the test runner to
distinguish CFE crashes, CFE compile-time-errors and other failures.
Also update status file entries to from D8 specific entries
to JS commandline shell entries
=> Step towards aligning D8 & JSC test results
Change-Id: I1acb8803f5db7c732ad546d5989b1c555583e7c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383660
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This new flag uses a new algorithm to generate the module's type section. The new algorithm is able to produce smaller type sections reducing the overall size of the wasm binary.
For flute.complex at -O4 using this flag produced a wasm file 2.5% smaller.
Change-Id: Iaa7905174c496d637dc3d8d4533df6fd6f056597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382462
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
`dart2wasm` supports the `--multi-root` argument and respective URIs as
inputs.
`build_runner` uses the multi root argument when compiling with dart2js
as it allows a file system layout like this, placing `lib/` contents of
packages into folders next to non-lib assets of the root package being
compiled:
```
input/
args/
async/
.../
other_packages/
web/
index.html
main.dart
```
While it looks like `dart2wasm` is supposed to support the same
arguments as well, the way it parses URI flags and a pre-check in
`dartdev` unfortunately prevent this.
This fixes `dartdev` to not check for inputs when a multi-root argument
is given, as the paths are not physical paths from the operating system
in that case.
It also fixes the `UriOption` in `dart2wasm` to be consistent with how
input arguments are resolved, allowing multi-root scheme URIs to be
used as arguments for e.g. `--packages`.
Change-Id: If751a5ee58938d5c7c62e27a69957456d8eea860
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377662
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
When `flutter build web --wasm` run passed
`--extra-compiler-option=--no-source-maps` it caused the compiler not to
generate source maps, but `dart compile wasm` thought it does and tried
and use the file, which causses an issue.
We can remove this workaround once this CL rolls up to flutter and we
change `--extra-compiler-option=--no-source-maps` to `--no-source-maps`.
Bug: https://github.com/flutter/engine/pull/54487
Change-Id: I82c56ab7d1bc09e53919a6b72b0b1771215d8d25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380000
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
To be able to know when we are generating a source map, make `dart
compile wasm` aware of the `--no-source-maps` flag.
The "name" segments of source mappings are also made `null` with this
patch. Browsers don't use that segment and binaryen doesn't support it.
Change-Id: I7b52c8fb7cef92ed60547e97ad137e0cd3967f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378421
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Note that the `add_asset_link` example project has it's build hook
`exit(nonZero)` because the project only works with link hooks
enabled.
Therefore, the test expectations for `dart run` is that it fails, and
for `dart build` that it succeeds.
Bug: https://github.com/dart-lang/native/issues/1252
Change-Id: I8566d1289a079078586a2e6149f5b77e641618f9
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375100
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Also fixes the list of asset types supported.
Change-Id: If18704e8718a96ea07bad1758a84f3b8e625d059
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
This changes the (non-machine/json) output of "dart analyze" when there are errors in pubspec.yaml/analysis_options.
Before:
```
Analyzing myapp...
error • analysis_options.yaml:3:1 • Expected ':'. Parse errors in analysis_options.yaml may result in other incorrect diagnostics. • parse_error
error • lib\main.dart:1:16 • A value of type 'Null' can't be returned from the function 'foo' because it has a return type of 'int'. • return_of_invalid_type
2 issues found.
```
After:
```
Analyzing myapp...
Errors were found in pubspec.yaml or analysis_options.yaml which may result in other incorrect errors.
error • analysis_options.yaml:3:1 • Expected ':'. Parse errors in analysis_options.yaml may result in other incorrect diagnostics. • parse_error
Errors in other files that might be caused by those above.
error • lib\main.dart:1:16 • A value of type 'Null' can't be returned from the function 'foo' because it has a return type of 'int'. • return_of_invalid_type
2 issues found.
```
Fixes https://github.com/dart-lang/sdk/issues/55987
Change-Id: I25ae7b200463f2cd3f2046ea9f5f8ddc5c62cc60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372080
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Removes risk of DDS connection information being split across two stream
events, causing JSON decoding to fail.
Also updates DDS to close stderr, even in the error case.
TEST=Existing service and dartdev tests
Change-Id: I5cceab899aac1fa63bd7578dd658b34096722bd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371000
Reviewed-by: Derek Xu <derekx@google.com>
google3 makes heavy use of symlinks, with no guarantee that the relative
location of files with respect to each other will be maintained after
the symlinks are resolved. This causes issues when trying to locate the
DartDev snapshot using the VM executables resolved path as a base.
This change updates the DartDev snapshot detection logic to first try to
find the snapshot using the resolved executable path before falling back
to using the unresolved path used to launch the VM (e.g., the path
specified by argv[0]).
TEST=pkg/dartdev/test/
Change-Id: I19a41c440ac82cbc671dafb3bda23a31fb4cdc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370000
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
`flutter build web --wasm`
* uses the `--(no-)strip-wasm` flag for stripping
* by default it strips the wasm file in `--release` mode
=> We align `dart compile wasm` to use the same flag and have the same
default.
After this CL rolled into flutter, we can make flutter pass the new flag
down and remove the old `--name-section` flag.
Change-Id: I6dc6be86a3a90f14617bc795843b0e54f54fa761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369062
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
If analysis failed due to an exception, "dart analyze" may still report "no issues found" because it didn't get any server errors.
It didn't get server errors for a number of reasons:
1. Analysis errors were silent (see https://github.com/dart-lang/sdk/issues/39284)
2. `server` in ErrorNotifier was always `null` because the code that set it did so too early
3. `ErrorNotifier` was never added to the instrumentation service, so never got called anyway
Additionally, "dart analyze" printed "No errors found!" even if server errors occurred (as long as the server didn't crash).
This change fixes up the server reference in ErrorNotifier, adds it to the instrumentation service and uses a new flag ("--disable-silent-analysis-exceptions") to allow opting-in to getting analysis errors to the client. It also updates "dart analyze" to not print "No errors found!" (and to not use a 0 exit code) when server errors occur.
Because this change "fixes" ErrorNotifier, it's possible that with this change clients will now get additional error notifications (non-silent exceptions that were being dropped previously) which could result in users seeing more errors - but presumably errors that should have been reported before anyway.
Fixes https://github.com/dart-lang/sdk/issues/49931
Change-Id: I4948117c78b8f382550b7641076de443250bba6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358902
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
I would like to add an option to our BUILD
files to precompile gen_kernel and
compile_platform to speedup iteration cycles
when working on core library changes.
To make this robust I would like to use
depfile to track dependencies and know
when compile_platform should be
recompiled.
TEST=pkg/dartdev/test/commands/compile_test.dart
R=kustermann@google.com
Change-Id: Id674f7353342c8275a8a0c4a70e3f5eaeb7f05d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367023
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
The CFE's [CompilerOptions] object currently has 3 properties
* `CompilerOptions.sdkDir`: The sdk directory
=> Will use `<sdkDir>/lib/libraries.json` to compile corelibs
* `CompilerOptions.librariesSpecPath`: The libraries.json file
=> Will compile corelibs using this libraries.json
* `CompilerOptions.sdkSummary`: The platform.dill file
=> No need to compile corelibs as platform file is given.
=> Passing any of these is sufficient for the CFE to run.
This CL therefore mandates that either one passes the platform file or
the libraries.json file to dart2wasm. There's no need to also accept the
sdk dir.
As flutter still passes `--dart-sdk` (as well as platform file) - we
simply ignore that flag for the moment, until flutter's usage was
removed.
Change-Id: I4c3b1a7bf87f98e51ceb2e6adfaec4f4a6ce2202
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366821
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Adding a linking script support, see go/resource-shaking. The goal is to run a `link.dart` script after kernel compilation complimentary to `build.dart` running before.
Change-Id: Iadc8648ae5fa2e823b6541c5bc08617bb860a017
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338380
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>