1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-01 07:14:29 +00:00
Commit Graph

171 Commits

Author SHA1 Message Date
Vyacheslav Egorov
a4dd314c9e [tools] Allow precompiling gen_kernel and compile_platform
When iterating on core library changes or changes in the AOT compiler
many seconds are wasted waiting on gen_kernel/compile_platform to
parse Dart code. This happens because we are running these tools
from sources on prebuilt Dart SDK.

This CL allows SDK developer to opt-in into AOT compiling these
tools by adding `precompile_tools=true` to their DART_GN_ARGS.

AOT compilation is performed using prebuilt SDK - so these
executables do not need to be recompiled if core libraries or
VM changes reducing iteration cycles.

pkg/vm/tool/precompiler2 is tweaked to detect when DART_GN_ARGS
contains `precompile_tools=true` and use precompiled
gen_kernel.exe instead of running it from source.

Using precompiled compile_platform takes vm_platform_strong.dill
build from 20 seconds to 3 seconds.

Using precompiled gen_kernel takes small benchmark build from
~10 seconds to 2 seconds.

This relands 5cda2a871c with fixes
for Flutter build.

TEST=manually tested

Change-Id: I552861c80c152890655e41baaf6ea3fb3b03a57e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367961
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-05-24 09:40:39 +00:00
Slava Egorov
a17d709a1d Revert "[tools] Allow precompiling gen_kernel and compile_platform"
This reverts commit 5cda2a871c.

Reason for revert: broke Flutter build. 

Original change's description:
> [tools] Allow precompiling gen_kernel and compile_platform
>
> When iterating on core library changes or changes in the AOT compiler
> many seconds are wasted waiting on gen_kernel/compile_platform to
> parse Dart code. This happens because we are running these tools
> from sources on prebuilt Dart SDK.
>
> This CL allows SDK developer to opt-in into AOT compiling these
> tools by adding `precompile_tools=true` to their DART_GN_ARGS.
>
> AOT compilation is performed using prebuilt SDK - so these
> executables do not need to be recompiled if core libraries or
> VM changes reducing iteration cycles.
>
> pkg/vm/tool/precompiler2 is tweaked to detect when DART_GN_ARGS
> contains `precompile_tools=true` and use precompiled
> gen_kernel.exe instead of running it from source.
>
> Using precompiled compile_platform takes vm_platform_strong.dill
> build from 20 seconds to 3 seconds.
>
> Using precompiled gen_kernel takes small benchmark build from
> ~10 seconds to 2 seconds.
>
> TEST=manually tested
>
> Change-Id: Ieec6ad4e1081023d140eb744f0a3cd0c754414ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367940
> Commit-Queue: Slava Egorov <vegorov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: Id3e4eb44d33516f31c165d9a1e55911e8d356e7f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367960
Commit-Queue: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-23 13:52:58 +00:00
Vyacheslav Egorov
5cda2a871c [tools] Allow precompiling gen_kernel and compile_platform
When iterating on core library changes or changes in the AOT compiler
many seconds are wasted waiting on gen_kernel/compile_platform to
parse Dart code. This happens because we are running these tools
from sources on prebuilt Dart SDK.

This CL allows SDK developer to opt-in into AOT compiling these
tools by adding `precompile_tools=true` to their DART_GN_ARGS.

AOT compilation is performed using prebuilt SDK - so these
executables do not need to be recompiled if core libraries or
VM changes reducing iteration cycles.

pkg/vm/tool/precompiler2 is tweaked to detect when DART_GN_ARGS
contains `precompile_tools=true` and use precompiled
gen_kernel.exe instead of running it from source.

Using precompiled compile_platform takes vm_platform_strong.dill
build from 20 seconds to 3 seconds.

Using precompiled gen_kernel takes small benchmark build from
~10 seconds to 2 seconds.

TEST=manually tested

Change-Id: Ieec6ad4e1081023d140eb744f0a3cd0c754414ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367940
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-05-23 12:35:21 +00:00
Alexander Aprelev
b614a7e8be [vm/build] Ensure relevant artifacts are built for precompiled target
Include gen_snapshot and platform dill targets to runtime_precompiled to ensure this target can be used separately without runtime target when working on AOT tests.
Avoiding runtime target saves time building unneccessary snapshots.

Change-Id: Ib6583772f47af1eecaf9a9849b3966461982502f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365870
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-05-10 15:23:56 +00:00
Ryan Macnak
d42a4b7219 [test] Run FFI tests on Fuchsia ARM64.
- Compile tests to kernel and use that instead of source for the Fuchsia test package.
 - Skip multitests instead of the running them and approving the failures.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: Idd9bef0f6026c6d882712eb1083e88433bb53b13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333121
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-04-30 17:37:45 +00:00
Martin Kustermann
d3d83e639c [vm] Do not bundle dart.lib in the Dart SDK
Users of our standalone embedders we distribute in the Dart SDK should
be using `dart_api_dl.h` (and initialize it from
the `dart:ffi`s `NativeApi.initializeApiDLData`)

If there's any API functions missing, we can add them.

Though we should not Dart C API symbols that are only relevant for
embedders. It requires a custom embedder implementation (which is
outside the scope of what we distribute in Dart SDK)

Issue https://github.com/dart-lang/sdk/issues/40579

TEST=ci

Change-Id: I6f3842668c59a5dd6fefc6857581995501b9b0e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352820
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-02-15 14:09:37 +00:00
Daco Harkes
bc96411921 [vm] Fix fuchsia build
Update path to package:ffi after
https://dart-review.googlesource.com/c/sdk/+/346761.

Change-Id: If91c2b2476ba7f1c8771a9e4771f089b36847dc5
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348402
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2024-01-26 18:24:18 +00:00
Jens Johansen
3e46b913de Fix build after pkg/testing/test/hello_test.dart was deleted
https://dart-review.googlesource.com/c/sdk/+/346760 deleted the file
pkg/testing/test/hello_test.dart which was for whatever reason specified
in the BUILD.gn file for fuchsia builds, meaning those no longer builds.
This CL removes the reference to it, hopefully allowing it to build.

Change-Id: I51a8ae47dec61dc0bde9e0560a2cdc05cf916942
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347260
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-01-19 10:08:58 +00:00
Derek Xu
cd5d399e2b Reland "[ DDS ] Fix DDS AOT snapshot build rules"
This is a reland of commit 0a393f1b69

The problem was that the checks for whether or not dartaotruntime
existed were always returning false on Windows because the ".exe" suffix
wasn't being taken into account. Patchset 2 addresses this.

Original change's description:
> [ DDS ] Fix DDS AOT snapshot build rules
>
> dds_aot.dart.snapshot was not being generated for runtime build targets,
> and dds.dart.snapshot was being built regardless of whether or not we
> were building for an IA32 target.
>
> This change also adds a check for IA32 in 'dart run' so the "Could not
> find dds_aot.dart.snapshot. Have you built the full Dart SDK?" message
> isn't printed when we fall back to using dds.dart.snapshot.
>
> This change also reverts 2cc08595a6, which
> failed to fix the issue it was attempting to fix.
>
> TEST=pkg/vm_service tests
>
> Change-Id: Ic990082c25b0d022093ad66600332dfb2878709f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341760
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TEST=pkg-win-release-try, pkg-win-release-arm64-try, and pkg/vm_service
tests

Change-Id: Ieab41edcb6bffca3be6bf628e357871f28949323
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342640
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-12-19 21:17:15 +00:00
Derek Xu
ba0835f5e2 Revert "[ DDS ] Fix DDS AOT snapshot build rules"
This reverts commit 0a393f1b69.

Reason for revert: breaks dartdev on Windows

Original change's description:
> [ DDS ] Fix DDS AOT snapshot build rules
>
> dds_aot.dart.snapshot was not being generated for runtime build targets,
> and dds.dart.snapshot was being built regardless of whether or not we
> were building for an IA32 target.
>
> This change also adds a check for IA32 in 'dart run' so the "Could not
> find dds_aot.dart.snapshot. Have you built the full Dart SDK?" message
> isn't printed when we fall back to using dds.dart.snapshot.
>
> This change also reverts 2cc08595a6, which
> failed to fix the issue it was attempting to fix.
>
> TEST=pkg/vm_service tests
>
> Change-Id: Ic990082c25b0d022093ad66600332dfb2878709f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341760
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

Change-Id: I479a026184fc1fe27926d1ab0d7d3221dec3130e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342440
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-12-18 17:13:59 +00:00
Ben Konyi
0a393f1b69 [ DDS ] Fix DDS AOT snapshot build rules
dds_aot.dart.snapshot was not being generated for runtime build targets,
and dds.dart.snapshot was being built regardless of whether or not we
were building for an IA32 target.

This change also adds a check for IA32 in 'dart run' so the "Could not
find dds_aot.dart.snapshot. Have you built the full Dart SDK?" message
isn't printed when we fall back to using dds.dart.snapshot.

This change also reverts 2cc08595a6, which
failed to fix the issue it was attempting to fix.

TEST=pkg/vm_service tests

Change-Id: Ic990082c25b0d022093ad66600332dfb2878709f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341760
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-12-15 19:05:59 +00:00
Zijie He
690b2ef0ca [Fuchsia] Move fuchsia-gn-sdk to fuchsia/gn-sdk
https://crrev.com/c/5015621 allows the relative path in the gn-sdk.

Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: I77f80b73cee9fb28529d22ec6ff4880859f2188a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335180
Commit-Queue: Zijie He <zijiehe@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-11-13 21:24:08 +00:00
Ryan Macnak
63aaca8c9a [build] Switch to Fuchsia core SDK.
build/fuchsia/gn-sdk is a copy of the current GN SDK with paths adjusted.
The rest of build/fuchsia comes from Flutter.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: I192cca955d05991bde3931d053df9835c5a2195d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334142
Reviewed-by: Zijie He <zijiehe@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-11-10 19:23:11 +00:00
Ömer Sinan Ağacan
75c975fe6d [dart2wasm] Remove stringref target
stringref target won't be used any time soon (probably ever). To help
with build times and avoid keeping it updated remove it for now.

Change-Id: I0df33b7ab2e19bae5090e8ea32ea6a3dc3751652
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334881
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-11-10 09:49:37 +00:00
Ryan Macnak
573fad4ff0 [test] Cleanup building Fuchsia packages/components.
Build one package with three elf_test_runner components: one for each of the binaries that the test harness invokes on the target. (Though currently only tests that use "dart" are setup.)

Create includable CML shards for the capabilites required by the AOT and JIT VMs.

Fold test_runner's fuchsia_cfv2.dart back into fuchsia.dart.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: I7bd8d43d184cbcb11903c7aed77ce31fb30cb894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332451
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zijie He <zijiehe@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-31 17:11:51 +00:00
Ryan Macnak
4fa5cadb36 [test] Switch Fuchsia testing to CFv2.
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: Id6519937cfa8430249d576c99aeb6bdb9f97dbb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332481
Reviewed-by: Zijie He <zijiehe@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-30 20:03:40 +00:00
asiva
9b521df35f [VM/Tests] Remove dart_2 and standalone_2 test directories
- Remove test directories standalone_2 and dart_2
- Remove all references to standalone_2 and dart_2 in test scripts

TEST=ci

Change-Id: I574868e274558efbbe12fe8b6408bbe77a888583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330982
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-10-18 18:59:51 +00:00
Liam Appelbe
baaf5e1116 [ffi] Reland the iNativeCallable.listener example test.
The documentation changes already relanded. This is just relanding the
example.

Patchset 1 is a pure reland. Other patchsets are fixes.

Original CL:
https://dart-review.googlesource.com/c/sdk/+/326580

Change-Id: I04d24d63f08a351db7a6e43f331904274e28e2d5
Bug: https://github.com/dart-lang/sdk/issues/53435
TEST=samples/ffi/http/test/http_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328681
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-09-28 22:41:42 +00:00
Liam Appelbe
18d0afdce1 Revert "[ffi] NativeCallable.listener example."
This reverts commit 5354df624a.

Reason for revert: Broke debian-x64-main bot
https://logs.chromium.org/logs/dart-internal/buildbucket/cr-buildbucket/8769282695204884177/+/u/build/stdout

Original change's description:
> [ffi] NativeCallable.listener example.
>
> Add an example to the NativeCallable.listener documentation.
>
> Bug: https://github.com/dart-lang/sdk/issues/53435
> Change-Id: I4b664b14ca1dbc474913a9e191e38ca6f290350f
> Fixes: https://github.com/dart-lang/sdk/issues/53435
> CoreLibraryReviewExempt: The FFI package is VM-only
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326580
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

Bug: https://github.com/dart-lang/sdk/issues/53435
Change-Id: Id959500df51d0eaa9bd452d3d9d0a8b21191de1c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327420
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Liam Appelbe <liama@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-09-22 05:15:18 +00:00
Liam Appelbe
5354df624a [ffi] NativeCallable.listener example.
Add an example to the NativeCallable.listener documentation.

Bug: https://github.com/dart-lang/sdk/issues/53435
Change-Id: I4b664b14ca1dbc474913a9e191e38ca6f290350f
Fixes: https://github.com/dart-lang/sdk/issues/53435
CoreLibraryReviewExempt: The FFI package is VM-only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326580
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-09-22 04:02:20 +00:00
Nicholas Shahan
34e1b89286 [ddc] Delete unused build targets
The last uses were removed in
b04c2a3783

Change-Id: I3eae2145ba5d5fdab8e9e13c20b466f5a0c9eb14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326248
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-09-18 17:56:35 +00:00
Zijie He
5282f6e33f [Fuchsia] Create CFv2 support
This change created a CFv2 build target and provided two
implementations of the FuchsiaEmulator, so that I can continually work
on both CFv2 build and test script integration independently.

The v2 target can be built with
```
tools/build.py --os fuchsia --mode release fuchsia_ffi_test_package_cfv2
```
And v2 FuchsiaEmulator implementation can be triggered with
FUCHSIA_CFV2 environment variable.

Bug: #38752
Change-Id: I31936a2ca967fbfeb2bc5628e2f005aef6762687
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322583
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zijie He <zijiehe@google.com>
2023-09-12 01:40:52 +00:00
Nicholas Shahan
3a65ac91f1 [ddc] Cleanup old "dartdevc" build targets
Use the new "ddc" targets everywhere and delete
the old targets.

Change-Id: I89d3351006a2c3eb0d1b9d526b868cbb676dce6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315561
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-08-29 21:33:48 +00:00
Derek Xu
7f82667867 [SDK] Remove conditional logic guarding generation of dds and dartdev snapshots on ARM
The `sdk:copy_full_sdk_snapshots` target is dependent on
`utils/dartdev:dartdev` and `utils/dds:dds`, so these targets have been
getting built anyways when building the SDK.

TEST=Confirmed that
`./tools/build.py -mdebug -aarm_x64 --os=android create_sdk` does not
crash.

Fixes: https://github.com/dart-lang/sdk/issues/41776
Change-Id: I356218e542313f393ff2ea812d761ab8868955d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322520
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-08-25 16:02:28 +00:00
Nicholas Shahan
f4e949609c [ddc] Add new build targets for DDC assets
- Introduces a new output subdirectory `gen/utils/ddc` where the
  new build targets output files. This is intended to make the
  migration to the new assets easier since landing this change
  shouldn't immediately break any dependencies.
- Enables building the canary and stable assets at the same time.
- Changes more names in our workflow from "dartdevc" to "ddc".
- Updates the ddc-canary-linux-chrome and
  ddc-canary-linux-chrome-unsound configurations to use the
  new assets.

The new outputs appear in directories that are more consistently
named, (no more sound vs kernel confusion). They are named in
preparation for the eventual deletion of the unsound targets
without any lingering cruft to be cleaned up in the sound
directories.

The new structure is:

```
gen/utils/ddc/
           |- canary
           |  |- pkg
           |  |- sdk
           |- canary_unsound
           |  |- pkg
           |  |- sdk
           |- stable
           |  |- pkg
           |  |- sdk
           |- stable-unsound
              |- pkg
              |- sdk
```

The 'pkg' and 'sdk' directories all contain outputs with the same
files names, each compiled in the respective build modes
(sound/unsound and stable/canary).

Change-Id: I66822ebf03bba487b6d359a8e0aa818b9e7b6bef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313081
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-07-25 00:19:52 +00:00
Joshua Litt
9e37c2b480 [dart2wasm] Add JS compatibility mode.
The purpose of the wasm_js_compatibility target is to facilitate experiments with a JS compatibility mode for Dart2Wasm. Initially, we're just going to focus on typed data, but this will give us a place to experiment with moving List and String to JS as well.

In addition, someday down the road we hope to experiment with two additional compatibility changes:
1) Exclusively using double for all Dart numbers
2) Allowing undefined to flow as null.

The two major benefits of this approach are:
1) Much faster JS interop
2) To make it easier to bring up Dart2JS applications on Dart2Wasm

The only downside will be access overhead on the Wasm side, but the JS builtins proposal could potentially bring us close to parity with Wasm builtins someday.

Tested: Wasm specific trivial refactor.
Change-Id: I2c09426b6999507c1de6e584e9bc7072a088bda9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313240
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-07-18 19:34:38 +00:00
Aske Simon Christensen
5838562040 [dart2wasm] Add option and target for stringref.
This adds basic infrastructure for a stringref implementation in
dart2wasm:

- A `--[no-]stringref` option to the compiler
- An option in the `WasmTarget`, controlling the name of the target
- Separate sets of patch files for the two targets
- Separate platform dill files for the two targets

For now, the patch file contents are the same, and the compiler flag
is not used by the backend (only by the `dart2wasm` script to select
the appropriate platform dill file). Both of these will change as the
implementation progresses.

Tested: ci + manual check that the option selects the correct dill
Change-Id: I2c9bb95ba06fd3de3f7007703ef545e3f0c728ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310621
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-06-21 14:25:38 +00:00
Ryan Macnak
384394b4a3 Roll Fuchsia SDK to 7b3b23b2c0da59b3aceab6c49fbe7d9ed34d7382.
Avoid sharing manifests between components, which confuses `fuchsia_component`.

Change-Id: I2a035e6257284a9e8ff5da18f7c2e212e0a9091f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282120
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-09 22:43:36 +00:00
Martin Kustermann
b15da0b0e9 [gardening] Build analyze_snapshot/gen_snapshot in both host & target toolchain
This should make vm/dart_2/analyze_snapshot_binary_test pass on
dartkp-linux-release-arm64 & dartk-linux-release-arm64

by ensuring arm64 `gen_snapshot` & `analyze_snapshot` binaries
are available on the device when running tests on arm64 HW.

Change-Id: Icd814ff6df22a33b651733e4c3dc99873cf56a58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279970
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-01-27 12:44:30 +00:00
Josh Soref
f7a2ea5e06 Spelling
Closes https://github.com/dart-lang/sdk/pull/50922

GitOrigin-RevId: 58fd7cfd5ef470a65a52ea28e0407244d853c917
Change-Id: I2e5a5ed991cb05270170a18b8f0169daa9eabdb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278537
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-24 18:00:25 +00:00
Chris Evans
0b8ab17feb Fix analyze_snapshot tests and build configuration
Updated strictness on build configuration for analyze_snapshot
Will run only under Linux/Android 64 bit arm, arm64c, simarm64,
simarm64c and x64 architectures.

analyze_snapshot just has a single target that links into product precompiled programatically

Testing suite updated to comply with null-safety requirements and
fix for simulated platform failing to use gen_snapshot with assembly.
TEST=ci
Change-Id: I3d58400db2e26a441a40fe7197b22510a52732b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279391
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2023-01-24 14:07:26 +00:00
Martin Kustermann
0fdeaee8f6 [dart2wasm] Add building binaryen as part of our GN build
We use binaryen from googlesource mirror with commits that have already
been rolled into g3.

Since binaryen doesn't come with GN files (it uses cmake), we add
our own in third_party/binaryen/BUILD.gn.

TEST=ci

Change-Id: Iee5c37c9d391ee41dc57250d7a33177cbe9ed2aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270640
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-11-18 10:58:54 +00:00
Joshua Litt
1ed2a07022 [dart2wasm] Build product snapshot when building for the SDK.
The `dartaotruntime` is built in `product` mode even when we do a release build. This CL wires up a product flag so we always build the Dart2Wasm product snapshot when creating the SDK.

Change-Id: Ic8c6a6da180a47a19ba818d7c449f712c9e60123
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264887
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2022-10-26 17:04:17 +00:00
Ryan Macnak
8d604955ed [build] Fix product SDK build.
Change-Id: I61399278186634e95dfc8b6802be7612f9d94911
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263182
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-10 19:14:58 +00:00
Joshua Litt
fd39eab463 [dart2wasm] Build snapshot as part of the SDK.
Change-Id: Iea75c14b6709f2347fe82af2ef226a1ed068d8a6
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261502
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-10-05 11:55:22 +00:00
Ömer Sinan Ağacan
affc3392a0 [dart2wasm] Implement Wasm FfiNative support
This CL introduces a new kernel-to-kernel pass in Wasm backend to
compile `FfiNative`-annotated external functions to external functions
with `wasm:import` pragmas.

The new pass `WasmFfiNativeTransformer` extends `FfiNativeTransformer`.
Some `FfiNativeTransformer` methods made public to allow reuse in the
pass.

The conversion works like this: when we see a member like:

    @FfiNative<Int8 Function(Int8, Int8)>("ffi.addInt8")
    external int addInt8(int a, int b);

We generate a Wasm import using Wasm ABI types according to emscripten
calling conventions:

    @pragma('wasm:import', 'ffi.addInt8')
    external static WasmI32 addInt8_$import(WasmI32 a, WasmI32 b);

and convert the original member (`addInt8()`) to a wrapper function that
calls the Wasm import, converting the arguments and return values to
Dart types:

    static int addInt8(int a, int b) {
      return WasmI32.toIntSigned(
        addInt8_$import(
            WasmI32::int8FromInt(a),
            WasmI32::int8FromInt(b),
        ));
    }

Build, test, and CI changes:

- Test runner now uses `// SharedObjects=...` lines in dart2wasm tests
  to pass extra Wasm modules to d8 command used to run the tests.

  Support for `// SharedObjects=...` lines were already used in
  native/AOT FFI tests, not added in this CL. We just start to use those
  lines in dart2wasm tests.

- dart2wasm gn file updated with a target "test_wasm_modules" that
  builds FFI test Wasm modules to Wasm using emcc (emscripten C
  compiler).

- CI dart2wasm_hostasserts configuration updated to copy the Wasm files
  generated by the "test_wasm_modules" target to the shards.

TEST=tests/web/wasm/ffi_native_test

Change-Id: I6527fe4e2ca2b582e16d84fee244e9cbe6dee307
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252822
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-09-23 09:41:22 +00:00
Devon Carew
ca205612d6 [deps] remove the dep on package:charcode
Change-Id: I0880f16db5bf62e6e7c91352c2f8e57f66ad7022
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247500
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-06-08 19:49:22 +00:00
Aske Simon Christensen
6c7604291c [dart2wasm] Build platform dill and compile dart2wasm to AOT snapshots
This adds a --platform= option to dart2wasm to read the SDK libraries
from that dill file instead of compiling them from source every time.
If the option is not given, the SDK libraries are compiled, like before.

Also adds a "dart2wasm" build target, which will build the dart2wasm
platform dill and compile dart2wasm to two AOT snapshots (with and
without asserts). The dart2wasm scripts in sdk/bin are updated to run
via these snapshots and use this platform dill.

This speeds up test runs for the dart2wasm-hostasserts-linux-x64-d8
configuration by approximately 45x.

Change-Id: If2c7750a6eb39725310745f887792784d0dfc583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243624
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-05-10 10:06:06 +00:00
Zachary Anderson
2347481619 Make dart_target_arch filters for 32-bit intel consistent
dart_target_arch can be "x86", which is handled here:
https://github.com/dart-lang/sdk/blob/main/runtime/BUILD.gn#L113.
This CL also handles it in the remaining places.

This came up in https://github.com/flutter/engine/pull/30417

TEST=N/A
Change-Id: Ib6dcd0a7236938026a0cbcb3955433960b396667
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237120
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2022-03-15 01:52:21 +00:00
Chris Evans
23b1f38981 Fixes for reland for analyze_snapshot program
1. Disable copying of executable for SDK binary signing
2. Fixes for ASAN memory leak in executable

TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart

This is a reland of 5d7d8a377d

Original change's description:
> Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
>
> This is a reland of 8d1eedca64
>
> Disable builds for Fuchsia
>
> TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
> Original change's description:
> > Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
> >
> > 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>
>
> Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Chris Evans <cmevans@google.com>

Change-Id: I1e6e57dda56f1710cc3a52e35d4067910930a701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234500
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Chris Evans <cmevans@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2022-03-09 14:17:44 +00:00
Alexander Thomas
0c0cd6341d Revert "Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"""
This reverts commit 5d7d8a377d.

Reason for revert: this CL unintentionally included analyze_snapshot in the Dart SDK distribution which is a release blocker.

Original change's description:
> Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
>
> This is a reland of 8d1eedca64
>
> Disable builds for Fuchsia
>
> TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
> Original change's description:
> > Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
> >
> > 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>
>
> Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Chris Evans <cmevans@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ie5b0b6d2f8f792a3bed9134d7d10fb4d34d9a58d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234284
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-02-24 16:56:23 +00:00
Chris Evans
5d7d8a377d Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
This is a reland of 8d1eedca64

Disable builds for Fuchsia

TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
Original change's description:
> Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
>
> 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>

Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2022-02-23 12:04:32 +00:00
Liam Appelbe
3a3738c6fb Revert "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
This reverts commit 8d1eedca64.

Reason for revert: Broke the Fuchsia bot: https://github.com/dart-lang/sdk/issues/47950#issuecomment-1040648129

Original change's description:
> Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
>
> 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>

TBR=vegorov@google.com,cmevans@google.com

Change-Id: I1aa0404fa8af9bd31a5c1efbbe7f60d9da2b5b9d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233160
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2022-02-15 18:45:39 +00:00
Chris Evans
8d1eedca64 Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
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>
2022-02-15 10:50:10 +00:00
Ben Konyi
3657251778 Revert "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
This reverts commit 19e5749308.

Reason for revert: Multiple configurations failing (https://github.com/dart-lang/sdk/issues/47950)

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>

TBR=vegorov@google.com,cmevans@google.com

Change-Id: Iaaeeeba04ac3283d2df3db8155389db2b358b60a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224601
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-12-16 18:32:20 +00:00
Chris Evans
19e5749308 [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>
2021-12-16 15:21:14 +00:00
Ryan Macnak
b4b7b8f116 [build] Add support for building for Fuchsia from Mac.
TEST=./tools/build.py --os=fuchsia --mode=all runtime create_sdk
Change-Id: I6b15d1cc174b84d900d526730e5f58d64d2596cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-10-13 21:14:56 +00:00
Robert Nystrom
b927288ed1 Remove "dartfmt" entrypoint from the SDK.
Change-Id: I32a9f95d7b22d3311767ba22c350f197592abcab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215300
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2021-10-04 18:40:57 +00:00
Vyacheslav Egorov
bda70c8489 [vm] Remove support for dart-ext: imports
Per breaking change #45451 we are removing support for dart-ext:
style native extensions from the Dart VM.

This CL removes the associated VM code, tests and samples. It also ports
a single test which used dart-ext: import to use FFI instead.

TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/45451
Change-Id: Iae984bce32baf29a950b5de1323939006a217b94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212050
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-02 14:14:35 +00:00
William Hesse
8776e15f60 [build] Remove runtime_kernel target from GN build
Remove the runtime_kernel target and all uses of it in scripts or
the test matrix.  This runtime_kernel target is only an alias for
the runtime target, now that kernel is the default.

BUG=https://github.com/dart-lang/sdk/issues/46892

Change-Id: I00c0ecf8adbd7bff3fd3df48023a2976c5172066
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2021-08-13 10:09:41 +00:00