Commit graph

127 commits

Author SHA1 Message Date
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
Ryan Macnak 04ba20aa98 [vm] Support RISC-V.
Implements a backend targeting RV32GC and RV64GC, based on Linux standardizing around GC. The assembler is written to make it easy to disable usage of C, but because the sizes of some instruction sequences are compile-time constants, an additional build configuration would need to be defined to make use of it.

The assembler and disassembler cover every RV32/64GC instruction. The simulator covers all instructions except accessing CSRs and the floating point state accessible through such, include accrued exceptions and dynamic rounding mode.

Quirks:
  - RISC-V is a compare-and-branch architecture, but some existing "architecture-independent" parts of the Dart compiler assume a condition code architecture. To avoid rewriting these parts, we use a peephole in the assembler to map to compare-and-branch. See Assembler::BranchIf. Luckily nothing depended on taking multiple branches on the same condition code set.
  - There are no hardware overflow checks, so we must use Hacker's Delight style software checks. Often these are very cheap: if the sign of one operand is known, a single branch is needed.
  - The ranges of RISC-V branches and jumps are such that we use 3 levels of generation for forward branches, instead of the 2 levels of near and far branches used on ARM[64]. Nearly all code is handled by the first two levels with 20-bits of range, with enormous regex matchers triggering the third level that uses aupic+jalr to get 32-bits of range.
  - For PC-relative calls in AOT, we always generate auipc+jalr pairs with 32-bits of range, so we never generate trampolines.
  - Only a subset of registers are available in some compressed instructions, so we assign the most popular uses to these registers. In particular, THR, TMP[2], CODE and PP. This has the effect of assigning CODE and PP to volatile registers in the C calling convention, whereas they are assigned preserved registers on the other architectures. As on ARM64, PP is untagged; this is so short indices can be accessed with a compressed instruction.
  - There are no push or pop instructions, so combining pushes and pops is preferred so we can update SP once.
  - The C calling convention has a strongly aligned stack, but unlike on ARM64 we don't need to use an alternate stack pointer. The author ensured language was added to the RISC-V psABI making the OS responsible for realigning the stack pointer for signal handlers, allowing Dart to leave the stack pointer misaligned from the C calling convention's point of view until a foreign call.
  - We don't bother with the link register tracking done on ARM[64]. Instead we make use of an alternate link register to avoid inline spilling in the write barrier.

Unimplemented:
 - non-trivial FFI cases
 - Compressed pointers - No intention to implement.
 - Unboxed SIMD - We might make use of the V extension registers when the V extension is ratified.
 - BigInt intrinsics

TEST=existing tests for IL level, new tests for assembler/disassembler/simulator
Bug: https://github.com/dart-lang/sdk/issues/38587
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: I991d1df4be5bf55efec5371b767b332d37dfa3e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217289
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-20 00:57:57 +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
asiva 965333d95c [VM] error: ‘mallinfo mallinfo()’ is deprecated
Apparently libc 2.33 deprecates the mallinfo API in favor of the
new mallinfo2 API. The API stays nearly the same, only the types
in the struct containing the malloc information has changed.
Fields in the new API are size_t instead of int.

These changes would allow use of mallinfo2 as a build time
configuration on systems that have mallinfo2 available.

TEST=cq

BUG=

Change-Id: Ib074dea3fb1f7c971c2987d8117319bf073ce732
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218161
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-12-08 00:25:10 +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
Ryan Macnak 1d70168786 [build] Fix arm and arm64 gcc builds.
TEST=./tools/build.py --no-goma --no-clang --arch=arm,arm64 runtime
Bug: https://github.com/dart-lang/sdk/issues/47330
Change-Id: I32cea56e3ad64200a7057cc6a381bc6d9656ec7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215984
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-10-12 18:49:52 +00:00
Ryan Macnak 41e45e7a1c [build] Detect the host architecture of an ARM64 Mac as ARM64 even through Rosetta.
Lets AppJIT training happen directly, instead of the absurdity of arm64 (hardware) running x64 (Rosetta) running arm64 (VM's simulator).

Change-Id: Idbf82530d946099db80c550070257c4c6ead31e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214763
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-09-28 17:44:32 +00:00
Ryan Macnak 7def42c489 Reland "[infra] Update to a clang with libc++.a for Mac ARM64."
Adjust Android build.

Bug: https://github.com/dart-lang/sdk/issues/42773
Bug: https://github.com/flutter/flutter/issues/75348
Change-Id: Iae98c03e8e155793648825b3155572412303434b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200903
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-05-24 21:31:20 +00:00
Ryan Macnak 198450f53c [build] Note that x64c does not use a simulator.
Fixes gn.py to agree with dfe.cc that x64c uses app-jit snapshots instead of kernel files for kernel service (and snapshots included in the SDK).

TEST=vm/cc suite
Bug: https://github.com/dart-lang/sdk/issues/45696
Change-Id: Ib15cbf46e9d26a179539aa62675b0cb0342d29e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195541
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-04-19 20:18:28 +00:00
Alexander Thomas b5c63ce757 [infra] Migrate scripts to python3
* Migrate to python3; drop python support.
* Update Windows toolchain support.
* Remove some unused methods.
* Python 2.7 is still needed on Windows.
* Update gsutil to a version that supports python3.

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

TEST=Manually tested common user journeys.

Change-Id: I663a22b237a548bb82dc2e601e399e3bc3649211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192182
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-04-15 10:10:20 +00:00
Liam Appelbe b6188939ec [vm] Align compressed pointer allocations on Fuchsia.
TEST=Local testing using Fuchsia emulator
Change-Id: I6946f07b8abab534986d7c23284e6e250c13b822
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188080
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-03-03 21:51:24 +00:00
Clement Skau 4d99c94d11 [tools] gn.py: Ensures args parsed.
Since parse_args() returns None in case parsing failed we should
check for this and bail.
Previously we'd still try to run RunGnOnConfiguredConfigurations
on None and crash with an unrelated issue.
This would overshadow the otherwise nice error message.

Change-Id: If9e267c8eedaaacb388fd8f8475ec0e861060ed5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187900
Auto-Submit: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-26 12:46:57 +00:00
Ryan Macnak be7bea72dc [infra] Add new compressed architectures to the test matrix.
This merely makes the architectures known to test.py; it does not create new bots.

TEST=ci
Change-Id: Icd50eb3b09c7eeadec796d5154226bba5cacf227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182665
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-02-04 17:44:37 +00:00
Liam Appelbe f7eaaf2ce1 [vm] Build configs for compressed pointers
Change-Id: Ied0f17b2c314ce7e0b5e70989684b95b8e506ffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181442
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-01-28 23:15:15 +00:00
eggfly 341213becd Add --export-compile-commands option to generate compile_commands.json
compile_commands.json compilation database file can be easily recognized by IDEs such as VSCode, CLion or SciTools Understand.

Closes https://github.com/dart-lang/sdk/pull/44690
https://github.com/dart-lang/sdk/pull/44690

GitOrigin-RevId: 72a0848cd1db2fa787a057ba07be0e7e2ade596a
Change-Id: Ib5212063bec58fc1575c7bfd5fb5f2a01db9db52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179780
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2021-01-25 10:37:02 +00:00
Sigmund Cherem 9866c06867 [infra] Build kernel snapshots for dart2js and dartdevc in ARM.
Our build infrastructure uses simarm to build for the ARM architecture.
Because of that, building the full sdk with dart2js and dartdevc was
too expensive.  In the past there wasn't as much need for the web
compilers in ARM, so we defaulted to exclude the web compilers from
the ARM SDK builds.

We are seeing more use and interest in using these tools in ARM, for
example, from users of modern Apple MacBooks and Raspberry Pi.

This change adds again the web compilers to ARM, but uses kernel
snapshots instead.  We believe doing so will be more affordable in
our build infrastructure.

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

Change-Id: I81094f2c51941b0af1dedaf238601c91b0b9dbeb
Bug: https://github.com/dart-lang/sdk/issues/43776
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178960
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-01-20 17:06:25 +00:00
Daco Harkes 4ccb45c172 [vm] Fuchsia arm64 build
Also runs the build on the existing Fuchsia bot and start building the
test .far on the bot.

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

TEST=tools/build.py --os=fuchsia -a arm64 create_sdk

Change-Id: I8ba92defb9318773552af7e178dea12460790004
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175482
Reviewed-by: Liam Appelbe <liama@google.com>
2020-12-10 12:15:17 +00:00
William Hesse ef07751c43 [infra] Fix build.py and gn.py to exit on SIGINT
It is very tricky to make scripts using the python multiprocessing
package terminate cleanly on SIGINT (ctrl-c).
Use subprocesses run in parallel instead for the simple uses
in these scripts.

This is necessary when running build.py from within another script,
so that it terminates cleanly when the process group receives
a broadcast SIGINT.

Change-Id: Ifc858225a49f369c4bd9cee62639ac6fc8ff737e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171120
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-11-13 12:35:09 +00:00
Alexander Markov d014a0f59b Remove bytecode mode of Dart SDK build
This change cleans up build.py --bytecode and gn.py --bytecode options.

Change-Id: Ie251e7049ce3f8f9da28d35eda139b60ee23af98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167842
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-21 22:43:14 +00:00
Alexander Thomas ae7ff6c13a [build] Set mac_use_goma_rbe to true for goma builds on mac
Without this, local builds on macOS fail to use the Goma on RBE backend.

See also: https://dart-review.googlesource.com/c/sdk/+/139782

Change-Id: Ic1caba904bcb486c638aef9462bca3fda65d8a6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152147
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2020-10-08 09:44:23 +00:00
William Hesse ea96424c02 Reland "[build] Use Goma from depot_tools instead of $HOME/goma"
This is a reland of 7fc61e77e2

Original change's description:
> [build] Use Goma from depot_tools instead of $HOME/goma
> 
> Goma will only be distributed with depot_tools in the future.
> 
> Change-Id: Ia7a7faf76f2562bde97d4f88cfe5db02ba76b561
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152652
> Reviewed-by: Alexander Thomas <athom@google.com>
> Commit-Queue: Alexander Thomas <athom@google.com>

Change-Id: I6793b6003a40816a8b336273118f6ad983295800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157380
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2020-08-20 08:24:48 +00:00
Martin Kustermann be9b69553d [infra] Prepare to make tools/build.py always re-runs GN.
Also adds a '-nvh' short-hand for '--no-verify-sdk-hash'

Change-Id: If893953e592128a8fa0b2f2e5720748d4b9b76aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153770
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-07-14 14:10:11 +00:00
Clement Skau 0ce83987d6 Reland "[SDK] Adds an SDK hash to kernels and the VM."
Note: This is a reland of https://dart-review.googlesource.com/c/sdk/+/150343

Adds a new SDK hash to kernels and the VM which is optionally checked
to verify kernels are built for the same SDK as the VM.
This helps catch incompatibilities that are currently causing
subtle bugs and (not so subtle) crashes.

The SDK hash is encoded in kernels as a new field in components.
The hash is derived from the 10 byte git short hash.

This new check can be disabled via:
  tools/gn.py ... --no-verify-sdk-hash

This CL bumps the min. (and max.) supported kernel format version,
making the VM backwards incompatible from this point back.

This also bumps the min. and current ABI version.

Bug: https://github.com/dart-lang/sdk/issues/41802
Change-Id: I2f85945045a603eb9dcfd1f2c0d0d024bd84a956
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152802
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-07 06:08:20 +00:00
William Hesse eb1bc0c6be Revert "[build] Use Goma from depot_tools instead of $HOME/goma"
This reverts commit 7fc61e77e2.

Reason for revert: An internal build is now trying to use goma
  when it shouldn't, and failing. There is no easy way to override
  this setting in build.py, and there should be.

Original change's description:
> [build] Use Goma from depot_tools instead of $HOME/goma
> 
> Goma will only be distributed with depot_tools in the future.
> 
> Change-Id: Ia7a7faf76f2562bde97d4f88cfe5db02ba76b561
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152652
> Reviewed-by: Alexander Thomas <athom@google.com>
> Commit-Queue: Alexander Thomas <athom@google.com>

TBR=karlklose@google.com,athom@google.com,whesse@google.com

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

Change-Id: I754e4a9d93090e014a995e86c46422989cf536d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152800
Reviewed-by: William Hesse <whesse@google.com>
2020-06-29 08:02:57 +00:00
William Hesse 7fc61e77e2 [build] Use Goma from depot_tools instead of $HOME/goma
Goma will only be distributed with depot_tools in the future.

Change-Id: Ia7a7faf76f2562bde97d4f88cfe5db02ba76b561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152652
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2020-06-26 21:34:58 +00:00
asiva bb8d145616 Revert "[SDK] Adds an SDK hash to kernels and the VM."
This reverts commit edde575dcd.

Reason for revert: Breaks the Dart to Flutter roll and golem

Original change's description:
> [SDK] Adds an SDK hash to kernels and the VM.
>
> Adds a new SDK hash to kernels and the VM which is optionally checked
> to verify kernels are built for the same SDK as the VM.
> This helps catch incompatibilities that are currently causing
> subtle bugs and (not so subtle) crashes.
>
> The SDK hash is encoded in kernels as a new field in components.
> The hash is derived from the 10 byte git short hash.
>
> This new check can be disabled via:
>   tools/gn.py ... --no-verify-sdk-hash
>
> This CL bumps the min. (and max.) supported kernel format version,
> making the VM backwards incompatible from this point back.
>
> Bug: https://github.com/dart-lang/sdk/issues/41802
> Change-Id: I3cbb2d481239ee64dafdaa0e4aac36c80281931b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150343
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,jensj@google.com,cskau@google.com

Change-Id: I34cc7d378e2babdaaca4d932d19c19d0f35422fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/41802
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152703
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-06-26 18:54:17 +00:00
Clement Skau edde575dcd [SDK] Adds an SDK hash to kernels and the VM.
Adds a new SDK hash to kernels and the VM which is optionally checked
to verify kernels are built for the same SDK as the VM.
This helps catch incompatibilities that are currently causing
subtle bugs and (not so subtle) crashes.

The SDK hash is encoded in kernels as a new field in components.
The hash is derived from the 10 byte git short hash.

This new check can be disabled via:
  tools/gn.py ... --no-verify-sdk-hash

This CL bumps the min. (and max.) supported kernel format version,
making the VM backwards incompatible from this point back.

Bug: https://github.com/dart-lang/sdk/issues/41802
Change-Id: I3cbb2d481239ee64dafdaa0e4aac36c80281931b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150343
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-26 13:35:42 +00:00
Alexander Aprelev d33e51df3c [build] Support --clang when building dart sdk on Windows.
It relies on flutter copy of clang distribution, same one that is used to build flutter/engine.

It addressed several deprecated warnings from clang compiler for functions like strdup, unlink, etc.

It allows few warnings still since they are triggered in third_party sources.

Change-Id: Ieb13792c011438d46dbbc0fa030e1b5e4ea14315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142704
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-06-25 03:36:41 +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
Martin Kustermann 168539d61d Reland "[vm] Build dart2native dependencies with the normal "create_sdk" target"
The flutter engine DEPS got new icu/boringssl so this CL can safely
land and roll into engine. A small change is made in Patchset 1..3.

This removes special logic for creating the `dart-sdk` we distribute
which used to build release and product mode and copied some binaries
from the latter into the former, before the SDK was actuallly ready to
test and distribute.

This changes the GN build rules to build the necessary
gen_snapshot/dart_precompiled_runtime product binaries during the normal
release build.

Normally during --mode=product builds the global build config in
//build/config/BUILDCONFIG.gn will set `-fvisibility=false`.

=> Doing so results in much smaller binaries - because only explicitly
   exported symbols are visible, the rest can be tree shaken by the linker.

Since we are building --mode=release, the `-fvisibility=false` will not
be set. In order to set the flag for the 2 special product-mode binaries
we need to add -fvisibility=hidden manually, in:

  * dart_product_config: Which is used for compiling VM sources.
  * 3rd party double-conversion library
  * 3rd party boringssl library
  * 3rd party icu library

The upstream CLs are:

  * BoringSSL: https://dart-review.googlesource.com/c/boringssl_gen/+/150482
  * ICU: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2236407

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

Change-Id: I8d9b37acbb5eb94e44d97652f838948a946fd372
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151505
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2020-06-17 16:12:26 +00:00
Alexander Thomas 1046888b1b [build] Also default to use a sysroot when the HOST_OS is linux
Previously, gn.py would not enable the sysroot when building for android
on Linux. However, the build also uses the host toolchain to create
tools and these need to be built with the sysroot. Otherwise, the new
goma backend refuses to run the build actions.

b/144018396

Change-Id: Ifda03ac82ce7d4cc8289198924a8316ab6751f45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151389
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2020-06-17 06:53:40 +00:00
Leaf Petersen d44457f79d [Core Libraries] Eliminate the fork in the core libraries.
Move the nnbd core libraries from sdk_nnbd to sdk, and updates
references in build files and elsewhere accordingly.

Change-Id: I09760fe1e006657aacdfe80f3b22fdf6f7e30a9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151121
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-06-16 23:37:36 +00:00
Martin Kustermann 21222b64c4 Revert "[vm] Build dart2native dependencies with the normal "create_sdk" target"
This reverts commit a88a328b7f.

Reason for revert: Auto roller hasn't rolled previous changes from
Dart yet. Those changes updated DEPS for icu/boringssl. We have to
wait with this CL until the DEPS changes have been done in the engine.

Original change's description:
> [vm] Build dart2native dependencies with the normal "create_sdk" target
> 
> This removes special logic for creating the `dart-sdk` we distribute
> which used to build release and product mode and copied some binaries
> from the latter into the former, before the SDK was actuallly ready to
> test and distribute.
> 
> This changes the GN build rules to build the necessary
> gen_snapshot/dart_precompiled_runtime product binaries during the normal
> release build.
> 
> Normally during --mode=product builds the global build config in
> //build/config/BUILDCONFIG.gn will set `-fvisibility=false`.
> 
> => Doing so results in much smaller binaries - because only explicitly
>    exported symbols are visible, the rest can be tree shaken by the linker.
> 
> Since we are building --mode=release, the `-fvisibility=false` will not
> be set. In order to set the flag for the 2 special product-mode binaries
> we need to add -fvisibility=hidden manually, in:
> 
>   * dart_product_config: Which is used for compiling VM sources.
>   * 3rd party double-conversion library
>   * 3rd party boringssl library
>   * 3rd party icu library
> 
> The upstream CLs are:
> 
>   * BoringSSL: https://dart-review.googlesource.com/c/boringssl_gen/+/150482
>   * ICU: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2236407
> 
> Issue https://github.com/dart-lang/sdk/issues/42230
> 
> Change-Id: I3e47664d9fadb9ed1ad033bb17d46e769442f741
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150524
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>

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

Change-Id: Ied0f2f5b58dceb2b59bc2ac6e11e5fd717c8885e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151382
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-06-16 10:41:27 +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
Martin Kustermann a88a328b7f [vm] Build dart2native dependencies with the normal "create_sdk" target
This removes special logic for creating the `dart-sdk` we distribute
which used to build release and product mode and copied some binaries
from the latter into the former, before the SDK was actuallly ready to
test and distribute.

This changes the GN build rules to build the necessary
gen_snapshot/dart_precompiled_runtime product binaries during the normal
release build.

Normally during --mode=product builds the global build config in
//build/config/BUILDCONFIG.gn will set `-fvisibility=false`.

=> Doing so results in much smaller binaries - because only explicitly
   exported symbols are visible, the rest can be tree shaken by the linker.

Since we are building --mode=release, the `-fvisibility=false` will not
be set. In order to set the flag for the 2 special product-mode binaries
we need to add -fvisibility=hidden manually, in:

  * dart_product_config: Which is used for compiling VM sources.
  * 3rd party double-conversion library
  * 3rd party boringssl library
  * 3rd party icu library

The upstream CLs are:

  * BoringSSL: https://dart-review.googlesource.com/c/boringssl_gen/+/150482
  * ICU: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2236407

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

Change-Id: I3e47664d9fadb9ed1ad033bb17d46e769442f741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150524
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2020-06-15 15:17:35 +00:00
Martin Kustermann d7e2f9ba3b [infra] Remove wheezy left overs from SDK
Also removes some dart editor related code which is unused nowadays.

Related https://dart-review.googlesource.com/c/sdk/+/150104

Change-Id: I97f91a35e82af09ac715a4eb93a945f335a71d5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150106
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-06-04 18:32:29 +00:00
asiva 03ce33f80c [BUILD] - Initial CL to unfork the NNBD Dart SDK
- Flips the flag from --nnbd to --no-nnbd so that by default it builds
  the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
  directory which has the 'Legacy' suffix added to it
  (e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
  in during execution so that CFE runs in that mode. This is different
  from the 'null_safety' flag

Change-Id: I729630a7bd36ea7ae38134f9285b44e93c283c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138902
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-05-07 21:12:47 +00:00
Ryan Macnak 2707880f1b [vm] Fix various UBSan failures.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I74e0eee623d88005fb2893d03e284a87daa09260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146696
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-07 19:40:18 +00:00
Siva Annamalai 726d3c7725 Revert "[BUILD] - Initial CL to unfork the NNBD Dart SDK"
This reverts commit cab69e7706.

Reason for revert: It was a temporary submit

Original change's description:
> [BUILD] - Initial CL to unfork the NNBD Dart SDK
> NOTE: This is a trial submit and will be reverted immediately.
> 
> - Flips the flag from --nnbd to --no-nnbd so that by default it builds
>   the NNBD version
> - using the --no-nnbd flag results in the SDK being built in a
>   directory which has the 'Legacy' suffix added to it
>   (e.g: out/DebugX64Legacy)
> - the '--enable-experiment=non-nullable' flag still needs to be passed
>   in during execution so that CFE runs in that mode. This is different
>   from the 'null_safety' flag
> 
> Change-Id: I7d25d9710818af5919c0bb83abe51153172f5886
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144880
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=asiva@google.com

Change-Id: Ib0f99fc1a42c9c7a8b21f8542f4a35dba9105d5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144900
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-04-27 05:00:10 +00:00
asiva cab69e7706 [BUILD] - Initial CL to unfork the NNBD Dart SDK
NOTE: This is a trial submit and will be reverted immediately.

- Flips the flag from --nnbd to --no-nnbd so that by default it builds
  the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
  directory which has the 'Legacy' suffix added to it
  (e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
  in during execution so that CFE runs in that mode. This is different
  from the 'null_safety' flag

Change-Id: I7d25d9710818af5919c0bb83abe51153172f5886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144880
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-04-27 04:59:26 +00:00
Siva Annamalai 63a92a3b00 Revert "This is a trial submit of the unfork CL, it will be reverted immediately."
This reverts commit 393468dc89.

Reason for revert: This was a trial submit and so reverting it.

Original change's description:
> This is a trial submit of the unfork CL, it will be reverted immediately.
> This commit is being done so we can roll it into Flutter and run some device lab testing to see the effect this CL will have on Flutter.
> 
> [BUILD] - Initial CL to unfork the NNBD Dart SDK
> 
> - Flips the flag from --nnbd to --no-nnbd so that by default it builds
>   the NNBD version
> - using the --no-nnbd flag results in the SDK being built in a
>   directory which has the 'Legacy' suffix added to it
>   (e.g: out/DebugX64Legacy)
> - the '--enable-experiment=non-nullable' flag still needs to be passed
>   in during execution so that CFE runs in that mode. This is different
>   from the 'null_safety' flag
> 
> Change-Id: I83c813aee2a5b61ad876d8a7b0988705bb24c839
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144082
> Reviewed-by: Siva Annamalai <asiva@google.com>

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

Change-Id: I7b50fae71764eceb17893338d1981e40ea2de520
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144083
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-04-20 03:50:49 +00:00
asiva 393468dc89 This is a trial submit of the unfork CL, it will be reverted immediately.
This commit is being done so we can roll it into Flutter and run some device lab testing to see the effect this CL will have on Flutter.

[BUILD] - Initial CL to unfork the NNBD Dart SDK

- Flips the flag from --nnbd to --no-nnbd so that by default it builds
  the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
  directory which has the 'Legacy' suffix added to it
  (e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
  in during execution so that CFE runs in that mode. This is different
  from the 'null_safety' flag

Change-Id: I83c813aee2a5b61ad876d8a7b0988705bb24c839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144082
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-04-20 03:46:06 +00:00
Ryan Macnak 3678a3bd42 [build] Use separate out directories for each sanitizer.
Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: Ie0aeaff758234220c2f0267b462d14f4c076bdf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127821
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-11 18:12:47 +00:00
Samir Jindel 6a8aae0095 [vm] Enable Dart VM to run in QEMU user-mode emulation for ARM.
Normally we consult /proc to determine the host architecture. However, this
reports the actual host architecture, not the QEMU-simulated one.

Also, GDB cannot debug position-independent executables in QEMU, so we disable
PIE when compiling for execution in QEMU.

Pass '--use-qemu' to 'gn.py' to build for QEMU.

Change-Id: Ib125127ceb0582b66754cfc0da22e09d224ee1e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125267
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-18 16:58:53 +00:00
Martin Kustermann ab5cf0f854 [vm] Ensure create_sdk GN build has working dart2native iff AOT is supported
This CL

   * adds a GN flag "include_dart2native" off by-default (switched on explicitly for our GN build)
   * ensures every GN build of the "create_sdk" target has a working dart2native (except ia32)
   * removes not-working dart2native script from ia32 dart-sdk (no AOT support in ia32)
   * removes the "dartaotruntime" GN target, since it is the same as "dart_precompiled_runtime"

This should ensure every downstream consumer of the "create_sdk" GN target will
have a working version of dart2native.

For the particular "dart-sdk" we create on dart-sdk-{linux,windows,mac}
we will override the default AOT compiler&runtime with the product mode,
which produces smaller AOT snapshots and has smaller AOT runtime (making
the native executables significantly smaller)

Change-Id: Ib5042589297cdb055c41dc56abdff86a4612ef5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123724
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2019-11-04 12:01:56 +00:00
Samir Jindel c885bdde1d [vm] DBC is obsolete. Remove dead code.
Change-Id: Ica33af158cca53c8e951e4b2582de83660e8a60d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121851
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-27 18:18:29 +00:00
Martin Kustermann e82fedc345 [vm] Remove deprecated (and untested) ARMv5 support from the VM
Since we have no CQ/CI test coverage of ARMv5 and none of our customers
uses it, a breaking change request was made (see issue further down).

The breaking change has been approved and a corresponding email has been
sent out:

https://groups.google.com/a/dartlang.org/forum/?nomobile=true#!topic/announce/vRQja7di3FQ

This CL removes any armv5 related code from our codebase.

Closes https://github.com/dart-lang/sdk/issues/36666

Change-Id: I9abf32f1980ca19a9cf882b43c9966b2127f89e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122540
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-23 14:44:33 +00:00