Commit graph

58 commits

Author SHA1 Message Date
Johnni Winther 55b34a467c Reland "[vm] Pass snapshot flag to kernel_service"
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: Id9e72751068d5f208055ab953d2c8392e84c4798
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180187
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-21 21:18:32 +00:00
Aske Simon Christensen 903e92a196 Revert "[vm] Pass snapshot flag to kernel_service"
This reverts commit f8b0d26cc3.

Reason for revert: Multiple test failures in app-jit and simarm(64)

Original change's description:
> [vm] Pass snapshot flag to kernel_service
>
> Enable reporting of null safety compilation mode when running
> `dart compile aot-snapshot`, `dart compile jit-snapshot`,
> and `dart compile kernel`.
>
> Closes #44234
>
> TEST=pkg/dartdev/test/commands/compile_test.dart
>
> Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,johnniwinther@google.com

Change-Id: I83aeaa8620c640d02d5ccfd1fe8112d8209a9ad4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179773
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-18 21:00:03 +00:00
Johnni Winther f8b0d26cc3 [vm] Pass snapshot flag to kernel_service
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-01-18 09:27:59 +00:00
Alexander Markov d77fff7307 [vm/nnbd] Add separate Snapshot::Kind for core snapshots
Core snapshots should be agnostic to the sound null safety mode
(so they can be used both in weak and strong modes), and snapshot
writer verifies that.

Snapshot::kFull was previously used both for core snapshots and
app snapshots on ia32. However, app snapshots are not guaranteed to
be agnostic, which appeared as failures on a few test on ia32.
Also, VM should be able to detect null safety mode from app snapshots,
even if they do not contain code, but null safety mode was not
written into features string of kFull snapshots.

In order to disambiguate core snapshots, a new Snapshot::Kind is
added. Snapshot::kFullCore works exactly as Snapshot::kFull, except
for verification of agnostic null safety and snapshot features string
omitting null safety mode. All snapshots except kFullCore now have
null safety mode included into their features string.

Fixes https://github.com/dart-lang/sdk/issues/43626
Issue https://github.com/dart-lang/sdk/issues/43613

Change-Id: I8cd3b049ef4e428dd5e1ce666d4c7aa3b596d70c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166308
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-08 19:59:15 +00:00
Daco Harkes 730578ed2d [vm] Fix memory leak in gen_kernel
Closes: https://github.com/dart-lang/sdk/issues/43015

Change-Id: I9af83caac9e13fccd630fdc0646b7b96a0da8f75
Cq-Include-Trybots:dart/try:vm-kernel-asan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158006
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-08-11 09:17:49 +00:00
Ben Konyi 49d7eba24e Reland "[ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM."
This reverts commit a24192e786.

Change-Id: Iea1c6cb6b509ce1493bc502d90592d2ba6fca68f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155480
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-27 21:51:03 +00:00
Ben Konyi a24192e786 Revert "[ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM."
This reverts commit d870a71b20.

Reason for revert: ASAN failures

Original change's description:
> [ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM.
> 
> Fixes https://github.com/dart-lang/sdk/issues/42482
> 
> Change-Id: I284a5673e30f59b127e69c712df93552cdfcde41
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154834
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I3639ede6987fbb51fb95584685c472abb789970e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155303
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-21 23:49:47 +00:00
Ben Konyi d870a71b20 [ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM.
Fixes https://github.com/dart-lang/sdk/issues/42482

Change-Id: I284a5673e30f59b127e69c712df93552cdfcde41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154834
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-21 19:29:15 +00:00
Ryan Macnak c5a94db091 [vm] Initial implementation of deferred loading.
(Assignment of libraries to loading units is already done in the kernel generation step.)

After compiling and before serializing, we walk the program and for each Code we assign its Instructions, CodeSourceMap and CompressedStackMap to the loading unit of that Code's defining library. Deduplication may cause Instructions, CodeSourceMaps and CompressedStackMaps to belong to more than one loading unit; in this case the objects are assigned to the root loading unit. Later they can be more precisely assigned to the dominating loading unit.

All objects except some Instructions, CodeSourceMaps and CompressedStackMaps belong to the root loading unit's snapshot. This snapshot is written like an unsplit snapshot, except that when serializing Code, we will write a reference to a stub or null when the Code's Instructions, CodeSourceMap or CompressedStackMap belongs to a non-root loading unit. The snapshots of non-root loading units contain these deferred objects and references to the corresponding Code objects to patch. The types of objects we defer (Instructions, CodeSourceMaps and CompressedStackMaps) usually represent 70+% of the snapshot size.

Bare instructions mode must be disabled when splitting because we cannot have PC-relative calls between loading units. Later we can re-enable this for calls within loading units.

Broken: Compactor probably crashes we can now have an unbounded number of image pages and the compactor assumes a fixed number.

Embedder's guide:

At compile-time, gen_snapshot should be passed --loading_unit_manifest with a path, which will enable splitting and output a mapping from loading unit ids to snapshot output paths.

At runtime, sometime during isolate startup, an embedder should call Dart_SetDeferredLoadHandler, probably near an existing call to Dart_SetLibraryTagHandler. The callback is given a loading unit id, and should eventually call Dart_DeferredLoadComplete[Error].

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ib597eb87c8cd634416d5ee1f00629c5550aebb00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152427
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-17 19:29:47 +00:00
Ryan Macnak 935b69e676 [vm] Increase alignment in the blob container format to 16k.
This accounts for the larger alignment required by mmap on ARM macOS.

Bug: https://github.com/dart-lang/sdk/issues/42534
Change-Id: Ie58732924d5a7287f2736696a6db0ddce7d308c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153382
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-07-06 18:08:31 +00:00
Vyacheslav Egorov b43714854e [vm] Allow Isolate.spawnUri to spawn from app-jit snapshots
R=kustermann@google.com

Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-mac-release-x64-try
Change-Id: I75aedf02f3b4004b191175672f652b0cce6cf47b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151508
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-18 12:59:33 +00:00
Liam Appelbe 764e72800f Reland "Revert "Add an --os=fuchsia option to build.py:""
This reverts commit d39d4d0d55.

Reason for revert: Relanding with fix

Change-Id: I6d6911b6cdc578a3b576b237db94c7f1db9824b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151600
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-06-18 00:24:31 +00:00
George Wright d39d4d0d55 Revert "Add an --os=fuchsia option to build.py:"
This reverts commit 4ce18ab931.

Reason for revert: bad merge, caused build breakages in flutter/engine

Original change's description:
> Add an --os=fuchsia option to build.py:
> 
> tools/build.py --os=fuchsia runtime create_sdk
> 
> This is analogous to --os=android. It cross compiles from Linux x64 to
> Fuchsia.
> 
> A lot of the build rules are just slightly different between the existing
> Fuchsia build rules used by Flutter, and the ones added by GN SDK. For
> example "$fuchsia_sdk_root/pkg:fdio" is now "$fuchsia_sdk_root/pkg/fdio".
> So to support this I had to add a new variable, using_fuchsia_gn_sdk,
> analogous to using_fuchsia_sdk. Flutter will need to set this to false.
> 
> Change-Id: Ief275d65f30a42a801607de93cf2d27a1fe825dd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150689
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

TBR=rmacnak@google.com,asiva@google.com,liama@google.com,kaushikiska@google.com,matthewcarroll@google.com

Change-Id: If01ee34eba906c55f2d56ba650748a86e81e701c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151321
Auto-Submit: George Wright <wrightgeorge@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2020-06-15 23:01:53 +00:00
Liam Appelbe 4ce18ab931 Add an --os=fuchsia option to build.py:
tools/build.py --os=fuchsia runtime create_sdk

This is analogous to --os=android. It cross compiles from Linux x64 to
Fuchsia.

A lot of the build rules are just slightly different between the existing
Fuchsia build rules used by Flutter, and the ones added by GN SDK. For
example "$fuchsia_sdk_root/pkg:fdio" is now "$fuchsia_sdk_root/pkg/fdio".
So to support this I had to add a new variable, using_fuchsia_gn_sdk,
analogous to using_fuchsia_sdk. Flutter will need to set this to false.

Change-Id: Ief275d65f30a42a801607de93cf2d27a1fe825dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150689
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-06-15 20:05:16 +00:00
Samir Jindel 1fbc71da0f Re-land "[vm] AOT blobs snapshots are obsolete. Remove dead code."
Original change is in Patchset 1. I erroneously assumed DART_PRECOMPILER
was only used AOT compilation (it is also used for JIT snapshots).

Change-Id: I77f6c463db7f2b482c9b098f353dc28f0676ea0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135900
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-02-17 11:12:15 +00:00
Siva Annamalai edd64e6d5c Revert "[vm] AOT blobs snapshots are obsolete. Remove dead code."
This reverts commit bcc0900e6a.

Reason for revert: This CL is breaking the Fuchsia Flutter build see https://github.com/flutter/engine/pull/16604/checks?check_run_id=445155807 

Original change's description:
> [vm] AOT blobs snapshots are obsolete. Remove dead code.
> 
> Change-Id: I35cf4befbe66b92197dcd659172f90be3de30f8e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134840
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,sjindel@google.com

Change-Id: I9dd32a71bf43907f59ed766b98bf453bab99ea3c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135881
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-02-14 06:40:31 +00:00
Samir Jindel bcc0900e6a [vm] AOT blobs snapshots are obsolete. Remove dead code.
Change-Id: I35cf4befbe66b92197dcd659172f90be3de30f8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134840
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-02-13 14:16:49 +00:00
Teagan Strickland 4774141425 [vm/compiler] Generate debugging info during single snapshot pass.
Previously when --save-debugging-info=<...> was used when not
compiling to ELF, we generated the requested snapshot format
and the separate debugging information as two separate snapshot
generation passes. However, we want to avoid this, to remove the
assumption that instruction snapshot serialization must be
deterministic.

Fixes https://github.com/dart-lang/sdk/issues/39803.

Also allows --strip to be used with --snapshot-kind=app-aot-assembly,
so that DWARF sections are not output in the generated assembly code.

Fixes https://github.com/dart-lang/sdk/issues/37560.

Change-Id: Ibdf1f5c771bae21870af252b38e64250fde53603
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128735
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-20 10:14:10 +00:00
Samir Jindel a846098c18 [vm] Enable ELF loader to read snapshots from memory without any backing file.
Also build Dart_LoadELF_Fd on Linux as well to get minimal coverage for Fuchsia.

Change-Id: I4be3eeae3e4559e95413fd60a26b9e6d2edabb32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127644
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-10 12:26:05 +00:00
Ryan Macnak 6a65ea9cad [vm] Remove shared snapshot and reused instructions features.
Shared snapshots have been disused by Fuchsia deduping.
Reused instruction has been disused by Flutter code push.

Change-Id: Ia4cb570935c233a9365d521ca04a477c5550ef83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122421
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-22 19:02:26 +00:00
Samir Jindel afac6a3714 Re-land "[vm] Use ELF loader in dart2native."
Fixes symbol resolution on Darwin.

The original commit is in patchset 1.

Change-Id: If71e9a72b8a2f45db2591bfa45ec4018745ee2c4
Cq-Include-Trybots:luci.dart.try:dart-sdk-mac-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119646
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-03 13:40:12 +00:00
Samir Jindel d0b799f39c Revert "[vm] Use ELF loader in dart2native."
This reverts commit 98b286de21.

Reason for revert: Breaks on Mac

Original change's description:
> [vm] Use ELF loader in dart2native.
> 
> Change-Id: I58834e3626cb18830ad9f9b1b95bdfa9d1ebd040
> Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119150
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Clement Skau <cskau@google.com>

TBR=sjindel@google.com,cskau@google.com,dianamichesa@google.com

Change-Id: I61c5c36e4ccd09d91cdb58c7c87f679f02579f03
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119643
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-10-02 14:02:51 +00:00
Samir Jindel 98b286de21 [vm] Use ELF loader in dart2native.
Change-Id: I58834e3626cb18830ad9f9b1b95bdfa9d1ebd040
Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119150
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2019-10-02 13:42:39 +00:00
Samir Jindel 362ef8e67c [vm/aot] Add a custom ELF loader in dart_precompiled_runtime.
Also switch some CQ bots using blobs to ELF. Once all embedders have migrated, we will remove blobs
support entirely.

Change-Id: Ie5e8c1187ad6c1af362b5715daafd3641bc8cc0e
Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-bare-linux-release-simarm-try,vm-kernel-precomp-mac-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-android-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116620
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-24 15:03:19 +00:00
Clement Skau f546362691 [SDK] Adds dart2exe to create standalone executables.
Tested:
  ./tools/build.py --arch x64 --mode release --verbose create_sdk copy_gen_kernel_snapshot copy_dart2aot
  ./tools/build.py --arch x64 --mode product --verbose copy_gen_snapshot copy_dartaotruntime
  cp -r out/ProductX64/dart-sdk/bin/{dartaotruntime,utils/} out/ReleaseX64/dart-sdk/bin/
  out/ReleaseX64/dart-sdk/bin/dart2native ~/src/hello_world.dart
  ~/tmp/hello_world.exe

  dart tools/bots/aot_smoke_tests.dart

  python tools/test.py -n dartkp-linux-release-x64 vm/dart/run_appended_aot_snapshot_test

Change-Id: I149fcd18405cdf0a87b8f4b4072c0f0e8f98c067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117140
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-23 12:00:08 +00:00
Clement Skau 46b58397f8 [Runtime] Adds appended blob runtime mode.
The Dart runtime will be able to load snapshot blobs appended at the end of
itself.
This is a step on the way to a self-contained native executable.

Tested:
  $ dart2aot hello_world.dart hello_world.aot
  $ <Some steps to hand-craft appended binary ..>
  $ dartaotruntime_plus_hello_world.bin
  Hello, world!

  python tools/test.py -n dartk-linux-debug-x64 vm/dart/run_appended_aot_snapshot_test

Change-Id: I79d5500c4e2668da31cf1d27145296d17470e04c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112382
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-11 10:56:57 +00:00
Alexander Markov 575f5c8b90 Revert "[vm] Fix uri/path discrepancy preventing running snapshots via spawnUri"
This reverts commit c4b829ba2c.

Reason for revert: failures on several bots:

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8906839588400817728/+/steps/test_results/0/logs/unapproved_failing_tests__logs_/0

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8906839597885007504/+/steps/test_results/0/logs/unapproved_failing_tests__logs_/0

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8906839588760701184/+/steps/test_results/0/logs/unapproved_failing_tests__logs_/0

Original change's description:
> [vm] Fix uri/path discrepancy preventing running snapshots via spawnUri
> 
> Change-Id: I718d7012d074b73eacfb0d4922fc744b6d2bd77b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110547
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,asiva@google.com,mfairhurst@google.com

Change-Id: Id43441d2259a17dff538c95d455a3839b284cad3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110800
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-26 21:27:23 +00:00
Mike Fairhurst c4b829ba2c [vm] Fix uri/path discrepancy preventing running snapshots via spawnUri
Change-Id: I718d7012d074b73eacfb0d4922fc744b6d2bd77b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110547
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-07-26 20:27:11 +00:00
Samir Jindel 0bfb943500 [vm] Locate ELF/Mach-O scripts with realpath in dart_precompiled_runtime.
Change-Id: I93f38bbd59c565c19677eedf7f434b52ffa9fb71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109401
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-23 18:21:46 +00:00
Ryan Macnak 971f4845d7 [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations.
Change some static_libraries to source_sets to make ODR violations link-time errors.

This is needed to enable (stop suppressing) -fvisibility=hidden in Fuchsia product builds.

Change-Id: I699cec8d4b516beab9cebf9db0a522a7ff99e004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99822
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-04-22 20:15:43 +00:00
Ryan Macnak bea7be00e1 [test] Check for determinism from the kernel compiler.
Fix leak when generating incremental kernel files.

Bug: https://github.com/dart-lang/sdk/issues/35092
Change-Id: Iaa112150501dd17d943a3747db3cacd2ee4464d2
Reviewed-on: https://dart-review.googlesource.com/c/84301
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-11-14 01:30:43 +00:00
asiva 30aa464f77 [VM] Remove 'corelib' and 'dart-io' sources generation into C++ arrays
- Remove all code that generates the corelib and dart:io library sources into C++ arrays and link them into dart_bootstrap
- Remove the executable dart_bootstrap and all uses of it
- Remove bootstrap_nolib.cc and builtin_nocore.cc
- Remove the Dart 1 code in core lib bootstrap path

Change-Id: Ifd33496204285a08b42fe09e39428e7a92b416b6
Reviewed-on: https://dart-review.googlesource.com/c/77241
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-10-02 23:27:05 +00:00
Ryan Macnak 2f25dcda16 [vm] Remove script snapshots.
Change-Id: I5bc692b754c0909de4aa5f05af81b074578b16f4
Reviewed-on: https://dart-review.googlesource.com/76706
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-09-26 22:49:27 +00:00
Ryan Macnak 86430cb46a [vm] Extend AppJIT capability of gen_snapshot.
- Add generation of AppJIT snapshots (from a trace rather than a training run).
 - Add generation of AppJIT snapshots under the constraint of not generating a new instructions segment.
 - Remove generation of script snapshots (no longer used by Flutter).

Change-Id: I2a7cb4b7cd681fae5d33bc896107b3ea903f35d1
Reviewed-on: https://dart-review.googlesource.com/75390
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Stanislav Baranov <sbaranov@google.com>
2018-09-25 23:44:29 +00:00
asiva 0a29264117 [VM] Remove vm_platform from the dart binary
- Remove vm_platform from the dart binary
- kernel isolate always compiles in strong mode

Change-Id: I4e3973fdaee0bda1c43244ea04673f253eaae249
Reviewed-on: https://dart-review.googlesource.com/65788
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-08-24 15:45:04 +00:00
asiva d1bd887d03 [VM/SDK] Switch kernel isolate to run in Dart 2 mode
- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
  with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
  snapshot rule does not get into a cyclic dependency during the
  bootstrap stage

Change-Id: Iccca3233f6cb8d6b307b4cf1ca3262f293f794a6
Reviewed-on: https://dart-review.googlesource.com/70841
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-08-21 20:28:06 +00:00
Vyacheslav Egorov 032037681e Revert "[VM/SDK] Switch kernel isolate to run in Dart 2 mode"
This reverts commit 499761f0da.

Reason for revert: crashes when building SDK, red bots, broken Flutter 3xHEAD bot

Original change's description:
> [VM/SDK] Switch kernel isolate to run in Dart 2 mode
> 
> - Switch the kernel isolate to run in Dart2 mode
> - Refactor build rules so bootstrapping of the front end happens
>   with a prebuilt dart sdk
> - Refactor application snapshot build rules so the kernel application
>   snapshot rule does not get into a cyclic dependency during the
>   bootstrap stage
> 
> Change-Id: I067c5f1165fb93811dcc8e390a8bf381db721e5b
> Reviewed-on: https://dart-review.googlesource.com/70461
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: Ibf6d526fb5132b766f063fcf873cde661ae895d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/70516
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-08-19 19:58:32 +00:00
asiva 499761f0da [VM/SDK] Switch kernel isolate to run in Dart 2 mode
- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
  with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
  snapshot rule does not get into a cyclic dependency during the
  bootstrap stage

Change-Id: I067c5f1165fb93811dcc8e390a8bf381db721e5b
Reviewed-on: https://dart-review.googlesource.com/70461
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-08-18 22:50:09 +00:00
Siva Annamalai 33697f7339 Revert "Reland "[VM/SDK]""
This reverts commit b59583edea.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Reland "[VM/SDK]"
> 
> This is a reland of b4146411d0
> 
> Original change's description:
> > [VM/SDK]
> > 
> > - Switch the kernel isolate to run in Dart2 mode
> > - Refactor build rules so bootstrapping of the front end happens
> >   with a prebuilt dart sdk
> > - Refactor application snapshot build rules so the kernel application
> >   snapshot rule does not get into a cyclic dependency during the
> >   bootstrap stage
> > 
> > Change-Id: Id16b2859e0b299b2d689971d03a247cb94d0aa26
> > Reviewed-on: https://dart-review.googlesource.com/61660
> > Commit-Queue: Siva Annamalai <asiva@google.com>
> > Reviewed-by: Zach Anderson <zra@google.com>
> 
> Change-Id: I2a3fa8ed4f331cf3de89ddff5cf8e478809dae39
> Reviewed-on: https://dart-review.googlesource.com/65841
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=zra@google.com,asiva@google.com

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

Change-Id: I6077236481bec9089ead881c902036b0817114fc
Reviewed-on: https://dart-review.googlesource.com/66240
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-07-23 18:07:29 +00:00
asiva b59583edea Reland "[VM/SDK]"
This is a reland of b4146411d0

Original change's description:
> [VM/SDK]
> 
> - Switch the kernel isolate to run in Dart2 mode
> - Refactor build rules so bootstrapping of the front end happens
>   with a prebuilt dart sdk
> - Refactor application snapshot build rules so the kernel application
>   snapshot rule does not get into a cyclic dependency during the
>   bootstrap stage
> 
> Change-Id: Id16b2859e0b299b2d689971d03a247cb94d0aa26
> Reviewed-on: https://dart-review.googlesource.com/61660
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>

Change-Id: I2a3fa8ed4f331cf3de89ddff5cf8e478809dae39
Reviewed-on: https://dart-review.googlesource.com/65841
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-07-19 22:04:56 +00:00
Siva Annamalai 7f5334480e Revert "[VM/SDK]"
This reverts commit b4146411d0.

Reason for revert: Seems to have build issues on certain bots

Original change's description:
> [VM/SDK]
> 
> - Switch the kernel isolate to run in Dart2 mode
> - Refactor build rules so bootstrapping of the front end happens
>   with a prebuilt dart sdk
> - Refactor application snapshot build rules so the kernel application
>   snapshot rule does not get into a cyclic dependency during the
>   bootstrap stage
> 
> Change-Id: Id16b2859e0b299b2d689971d03a247cb94d0aa26
> Reviewed-on: https://dart-review.googlesource.com/61660
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=zra@google.com,asiva@google.com

Change-Id: I4fc5b81e0a102bde4e8b4f737af3825e9728be3b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/65840
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-07-19 21:20:39 +00:00
asiva b4146411d0 [VM/SDK]
- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
  with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
  snapshot rule does not get into a cyclic dependency during the
  bootstrap stage

Change-Id: Id16b2859e0b299b2d689971d03a247cb94d0aa26
Reviewed-on: https://dart-review.googlesource.com/61660
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-07-19 20:48:18 +00:00
Ryan Macnak eb82559db2 Reapply "[vm] Add tests for determinism of script and AppJIT snapshots."
- Fix assembler->Stop("My address is not deterministic").
 - Skip tests on -cdartk + simulators as DFE is too slow.

Bug: https://github.com/dart-lang/sdk/issues/31427
Bug: https://github.com/dart-lang/sdk/issues/33264
Change-Id: Id79a8b8c8fc4b3842fcd1d3827d6d4551890b794
Reviewed-on: https://dart-review.googlesource.com/57483
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-31 17:18:42 +00:00
Ryan Macnak aa8e2ee178 Revert "[vm] Add tests for determinism of script and AppJIT snapshots."
This reverts commit aac0478fad.

Reason for revert: Some configurations are still not deterministic

Original change's description:
> [vm] Add tests for determinism of script and AppJIT snapshots.
> 
> Fix non-determinism in unused bits of RawFunction::kind_tag_.
> 
> Leave some build-time-disabled debugging aids for tracking down which parts of snapshots are non-deterministic.
> 
> Bug: https://github.com/dart-lang/sdk/issues/31427
> Bug: https://github.com/dart-lang/sdk/issues/33264
> Change-Id: I4e373a8886c0abd7c03b8f3b980e308bee2ef324
> Reviewed-on: https://dart-review.googlesource.com/56720
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,rmacnak@google.com,zra@google.com

Change-Id: I6c658c070f8df57625484449aafdf3f682841341
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31427, https://github.com/dart-lang/sdk/issues/33264
Reviewed-on: https://dart-review.googlesource.com/57200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-30 00:53:08 +00:00
Ryan Macnak aac0478fad [vm] Add tests for determinism of script and AppJIT snapshots.
Fix non-determinism in unused bits of RawFunction::kind_tag_.

Leave some build-time-disabled debugging aids for tracking down which parts of snapshots are non-deterministic.

Bug: https://github.com/dart-lang/sdk/issues/31427
Bug: https://github.com/dart-lang/sdk/issues/33264
Change-Id: I4e373a8886c0abd7c03b8f3b980e308bee2ef324
Reviewed-on: https://dart-review.googlesource.com/56720
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-29 22:59:37 +00:00
asiva 4b1180a39d [VM] When --preview-dart-2 option is specified make the options
'--snapshot_kind=script --snapshot=xyz'
produce a kernel dill file which is the equivalent of a script
snapshot in Dart2 world.

Change-Id: I7ba66eb86d9ecdfe1426b8b22b8d673598c4b71f
Reviewed-on: https://dart-review.googlesource.com/52740
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-02 23:19:47 +00:00
Ryan Macnak 0cc70c4a7c [vm] Support for sharing parts of an app snapshot.
In addition, this removes support for seeding the VM isolate snapshot with Instructions and referencing those Instructions in the isolate snapshot. This was leftover from an earlier experiment to share Instructions between a Core-JIT snapshot and App-JIT snapshots. Removing this reclaims the sign bit on Instruction offsets.

Add missing cases to TypeTestingStubFinder::StubNameFromAddresss.

Change-Id: Ie87216b4e284db1dc3eddb12f38ddbe8a841d312
Reviewed-on: https://dart-review.googlesource.com/50620
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-04-27 17:42:16 +00:00
Ryan Macnak 3989d09c95 [vm] Move writing snapshot magic value from embedder to VM.
Add Dart_IsSnapshot and Dart_IsKernel to the embedding API.

Change-Id: I7d4e1d145557e8f11dbc3c143767ad38b3615a4a
Reviewed-on: https://dart-review.googlesource.com/46360
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-19 17:47:55 +00:00
Ryan Macnak 22ccad1aa6 [vm] Stream writing snapshots as assembly to reduce peak memory usage.
Bug: US-449
Change-Id: Ic1ce6881b54c8c0eb7c93cbbda8057d7268bb3fd
Reviewed-on: https://dart-review.googlesource.com/45580
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-08 19:26:17 +00:00
Ryan Macnak 6664e3c02a [vm, dbc] Implement lazily-linked natives for DBC and enable AppJIT.
Because DBC still uses code patching to implement breakpoints, running a program from DBC AppJIT may trigger a crash attempting to set a breakpoint.

Change-Id: I5d761aacec6629be946d7d2510ec3f1e3f03f4a4
Reviewed-on: https://dart-review.googlesource.com/42584
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-23 02:20:12 +00:00