Commit Graph

19427 Commits

Author SHA1 Message Date
Alexander Aprelev 42dedb589f [vm/types] Ensure type arguments canonicalization doesn't race with readers.
Fixes https://github.com/dart-lang/sdk/issues/47140
TEST=ci, stress bot

Change-Id: I0df3eab99754224344da9a18b8b4b2748e45a8b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237761
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-03-18 18:45:27 +00:00
Clement Skau 0d28233e96 Fixes branched out from dart-cl/221624.
This change fixes a bug in the IA32 FG Moves, where any moves
of Int8 and Uint8 from a register other than the first four general
purpose registers would be bogus.
The moves would generate to move the second byte of the first four
GP registers because the other four registers do not have byte
registers.

This change also fixes an issue where X64 byte register moves would
generate incorrect bytecode for otherwise correct instruction prints.
It would for instance print "movb [rsp],rdi", but emit "movb [rsp],bh".

This change also fixes a bug in NativeFpuRegistersLocation::Equals
that cause different FPU regs. to compare equal despite being different
kinds.
This in turn caused moves between these different regs. to be dropped
because they looked like no-ops.

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

TEST=Existing.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-win-release-ia32-try
Change-Id: I09e69295c8a522d74f8a8fd817188b4de656c619
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237690
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2022-03-18 18:15:37 +00:00
Ben Konyi b036052077 Reland "[ Service ] Update VM service message to not reference Observatory"
This reverts commit ee5837aa7a.

Updated Intellij plugins have been published which support the new
message.

TEST=CQ

Change-Id: I81f6d878f036991a95cc1f58d3102015e77aa609
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237741
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-03-17 23:15:57 +00:00
Ryan Macnak 981d569821 [vm, compiler] Make use of load/store-pair with SIMD registers on ARM64.
TEST=ci
Change-Id: I140ffdce400c7dfa8a51b79e56f585d9edee5389
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237520
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-16 22:51:04 +00:00
Martin Kustermann fc513d9448 [vm] Avoid usage of STL container with const template argument
Issue b/223663984

TEST=ci

Change-Id: I7b915014df78641e4924cde2f07f9b55ee4bac7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237583
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-03-16 15:13:14 +00:00
Aske Simon Christensen 83e4aad58b [vm] Avoid wasted space in the data array for map and set constants.
The element data array in the VM's hash map/set implementation always
has a power-of-two length, growing exponentially as entries/elements are
added.

For constant maps/sets, this is not necessary, and the unused parts of
these data arrays is just wasted space.

This changes the data arrays for constant maps and sets to only contain
the actual entries/elements of the map/set.

Tested: ci
Change-Id: I061eb44b6c74c87157ef920143bf1885582f1b9a
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237140
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-03-16 10:05:43 +00:00
Alexander Aprelev 8a43a891f3 [io/win] Ensure no-console flag is not used if stdio is inherited.
Follow-up to b6c5e52af6 that fixes broken test.

TEST=process_inherit_stdio_test

Change-Id: Ice2188af03f3230d0b8d1161fedce333e43b862b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237482
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-03-16 00:20:03 +00:00
Alexander Aprelev b6c5e52af6 [io/win] Ensure console window is not created when running in windows mode.
Fixes https://github.com/dart-lang/sdk/issues/39945

TEST=ci, manually check flutter windows app doesn't pop-up console.

Change-Id: I05983947de10058e4b0d2f9cbe795bd52f97ad05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237400
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-03-15 21:34:23 +00:00
Ben Konyi 8c484d12fe Reland "[ Service / DDS ] Remove VM service polling logic, add --enable-service-fallback-port support to DDS"
This reverts commit d4f71515c7.

TEST=CQ

Change-Id: I180f9d045870a1ff5f7f3f82b6f4782e18c18cfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237440
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-03-15 18:14:42 +00:00
William Hesse fb1210590b [test] Skip slow vm isolate object copy test on jit simulated architectures
Bug: https://github.com/dart-lang/sdk/issues/46740
Change-Id: I5a6a7d72fea080c04d90a3aa6e5af2e02f7c3644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2022-03-15 16:43:05 +00:00
Ryan Macnak 1f1a2a71b7 [vm] Remove profiler marker for IA32 and X64.
Cf. fb24668989 handling the other architectures.

Also fixes product mode IA32, broken in 9a0be16a9d.

TEST=ci (--profile_vm=false)
Bug: b/220804295
Change-Id: Ic47cf2f4ecdda5ac1ab93e68d21242a4cb97150f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237186
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-15 16:41:25 +00:00
Ryan Macnak 51b22b8197 [vm] Add missing .eh_frame for X64 and RISC-V.
TEST=gdb bt
Bug: b/220804295
Change-Id: Id4dccdf65b4ccbec74ab61a3881726fa4f883ad5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235768
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-15 16:33:23 +00:00
Emmanuel Pellereau d4f71515c7 Revert "[ Service / DDS ] Remove VM service polling logic, add --enable-service-fallback-port support to DDS"
This reverts commit bd8590ba9b.

Reason for revert: breaks google3 (b/224731131)

TEST=Clean revert

Original change's description:
> [ Service / DDS ] Remove VM service polling logic, add --enable-service-fallback-port support to DDS
>
> Polling logic was introduced due to a bug in Fuchsia's network stack
> which could result in the VM service attempting to start the server
> before the network stack was initialized. This issue should be resolved
> now, so this logic is no longer necessary.
>
> TEST=pkg/dartdev/test/commands/run_test.dart
>
> Change-Id: I10f185dfb1be1b0363983f3e0564d65c38c99ea8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235763
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

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

Change-Id: I3016fad25220c4e5479f17294626d79a17bd316a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237360
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2022-03-15 12:01:30 +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
Ben Konyi bd8590ba9b [ Service / DDS ] Remove VM service polling logic, add --enable-service-fallback-port support to DDS
Polling logic was introduced due to a bug in Fuchsia's network stack
which could result in the VM service attempting to start the server
before the network stack was initialized. This issue should be resolved
now, so this logic is no longer necessary.

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

Change-Id: I10f185dfb1be1b0363983f3e0564d65c38c99ea8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235763
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-03-14 21:44:29 +00:00
Ben Konyi a53c0da163 [ Timeline ] Add locking around timeline recorder accesses and cleanup logic
Fixes https://github.com/dart-lang/sdk/issues/48534

TEST=CQ

Change-Id: I053a214519e4254f9b32f685a2bfe6ceef6bb8c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236442
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-03-14 21:10:38 +00:00
Ryan Macnak d8317a4142 [vm] Removing debugging break from os_thread_absl.cc
TEST=none, will be cbuild
Bug: b/220994782
Change-Id: Idf1e041b4dfaab16ef6207beecad377aca659738
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237123
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-14 18:48:28 +00:00
Tess Strickland ec285804ca [vm] Fix nullability checks for FutureOr in Class::IsSubtypeOf.
TEST=vm/dart/regress_48522

Fixed: https://github.com/dart-lang/sdk/issues/48522
Change-Id: I228ff30bd6223a01acd7ab8eea45bf5e35c55cc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237082
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-03-14 17:00:39 +00:00
Tess Strickland be207fbc54 Revert "[vm] Normalize FutureOr<T?> to FutureOr<T?>?."
This reverts commit d0a1404d11.

Reason for revert: Doesn't follow declared type normalization rules in spec.

TEST=Revert

Original change's description:
> [vm] Normalize FutureOr<T?> to FutureOr<T?>?.
>
> Previously, FutureOr<T?>? was normalized to FutureOr<T?>, since the two
> types are equivalent: FutureOr<T?> is the union of T? and Future<T?>,
> and so is nullable since T? allows null. However, this means there are
> nullable AbstractTypes where nullability() returns kNonNullable.
>
> Instead, normalize FutureOr<T?> to FutureOr<T?>?, so that checking the
> nullability of the outer type is sufficient to determine nullability.
>
> TEST=vm/dart/regress_48522
>
> Fixed: https://github.com/dart-lang/sdk/issues/48522
> Change-Id: I710facc84ec79485716ee543c9d272f59f87106c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237061
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

TBR=kustermann@google.com,sstrickl@google.com

Change-Id: I6999963d907b9ca79d348aca85bf8949e06471b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237081
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-03-14 15:24:19 +00:00
Tess Strickland d0a1404d11 [vm] Normalize FutureOr<T?> to FutureOr<T?>?.
Previously, FutureOr<T?>? was normalized to FutureOr<T?>, since the two
types are equivalent: FutureOr<T?> is the union of T? and Future<T?>,
and so is nullable since T? allows null. However, this means there are
nullable AbstractTypes where nullability() returns kNonNullable.

Instead, normalize FutureOr<T?> to FutureOr<T?>?, so that checking the
nullability of the outer type is sufficient to determine nullability.

TEST=vm/dart/regress_48522

Fixed: https://github.com/dart-lang/sdk/issues/48522
Change-Id: I710facc84ec79485716ee543c9d272f59f87106c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237061
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-03-14 14:56:08 +00:00
Daco Harkes a40f7d2a42 [vm] Support -d0 on windows with clang
`python3 tools\build.py -ax64 -d0 --clang runtime`

While MSVC expects `/O0`, clang-cl expects `-d0` instead.

However, clang-cl still wants /O2.

Change-Id: I7fa2f480cc9c110c7cd9c86072b5105106fbe76a
Cq-Include-Trybots: luci.dart.try:dart-sdk-win-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236882
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-03-14 11:23:48 +00:00
Daco Harkes d70e97f8a8 [vm] Add LoadThreadInstr
Introduces a new IL instruction to load the THR register as an untagged
value in IL.

Split off from https://dart-review.googlesource.com/c/sdk/+/229544.

TEST=runtime/vm/compiler/backend/il_test.cc vm/cc/IRTest_LoadThread

Bug: https://github.com/dart-lang/sdk/issues/47777

Change-Id: Ic6bf59b05c89593773dbc91d623cd0078657c8ab
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-debug-x64-try,vm-kernel-linux-debug-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235602
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-03-11 09:45:37 +00:00
Daco Harkes 2a522a9451 [vm] Document + test RawStoreFieldInstr
This CL documents the existence of `RawStoreFieldInstr` and why a
`RawLoadFieldInstr` is not needed.

Also it adds a unit test exercising `RawStoreFieldInstr`. With this type
of unit test we can land IL instructions without using them flow graph
builder yet.

Split off https://dart-review.googlesource.com/c/sdk/+/229544.

TEST=runtime/vm/compiler/backend/il_test.cc vm/cc/IRTest_RawStoreField

Bug: https://github.com/dart-lang/sdk/issues/47777

Change-Id: I20115fd2f72abe705447aa4b16ca6ecb30ad05fa
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234980
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-03-11 09:45:37 +00:00
Vyacheslav Egorov fa32b7e918 [vm/compiler] Tweak R(reg) define
Make R(reg) use unsigned integer for constant 1 to avoid
strange effects for R(R31).

This comes into play when storing R(R31) in larger sized
integers (e.g. int64_t) and using these values as
bit-vectors - you suddenly get bits set which don't
correspond to any real registers.

TEST=ci

Change-Id: I69a09b37889bac13e9c146014ffaaefbe7b0f14f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233881
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-03-11 09:20:36 +00:00
Vyacheslav Egorov 47ec77122a [vm] Improve crash reporting for gen_snapshot
* Use CompilerPass::GenerateCode in AOT to ensure we print
the graph if the code generation crashes.
* Enable Dart_DumpNativeStackTrace in gen_snapshot even in
PRODUCT builds.

Additionally enable disassembler in gen_snapshot even in
PRODUCT builds.

TEST=tested manually

Change-Id: I951d62ca07c7882fa1d8e765d4b5ffd26edd9456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233880
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-03-11 09:20:36 +00:00
Ryan Macnak a48d05c8f9 [vm] Add build-time option to use absl mutexes in place of pthread mutexes.
TEST=ci, cbuild
Bug: b/220994782
Change-Id: Id1a15d0d9fcef192847b25a2549730eb1014a99e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236760
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-10 23:48:05 +00:00
Ryan Macnak d4bc590c27 [vm, compiler] Match the C frame pointer convention on RISC-V.
The RISC-V frame pointer convention is different from that of x86 and ARM. FP is the caller's SP, and the saved FP is at FP[-2] instead of FP[0].

Making Dart frames match the convention of C frames allows stack walkers to continue their traversals through transitions between Dart and C (e.g., for stack dumps or profiling).

TEST=ci
Change-Id: I463348beba70c1a75bfb0d902b3391be524de0fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235960
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-10 22:38:26 +00:00
Alexander Aprelev 9feea727c6 [vm/field_guards] Ensure that field guard updates are done with stopped mutators.
Fixes https://github.com/dart-lang/sdk/issues/48473

TEST=language[_2]/vm/lazy_deopt_with_exception_concurrent_test

Change-Id: Ic54cbb1aa01dd367b42e559ebd70d3156fe54a45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-03-10 17:16:05 +00:00
Tess Strickland 6ef426d7df MacOS-Signable Compiled Dart Scripts
This CL implements a slightly altered compilation process for `dart
compile` on MacOS. Instead of the traditional approach of
concatenating a dart snapshot with the dart runtime, this new
implementation uses a new MachO segment to store the snapshot. Doing
so ensure users can properly sign the resulting binaries.

The dart runtime has also been updated to look for the snapshots in
this new segment.

There are new unit tests ensuring the dart runtime can correctly
identify MachO-formatted executables and an end-to-end test ensuring
`dart compile` produces code that has the new segment and produces
code that can be signed.

TEST=pkg/dartdev/test/commands/compile_test

Change-Id: Ibdce80455e02bc2b6fd345d80be8d75f989a9c28
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-mac-debug-x64-try,vm-kernel-mac-product-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228080
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-03-09 18:02:34 +00:00
Paul Berry 9872e9d4c4 Stop using deprecated "screaming caps" constants from dart:io
Bug: https://github.com/dart-lang/sdk/issues/34218
Change-Id: I4215c0a2212d5c15972d9ffe4075c89d27c9081e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235701
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-09 16:08:44 +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
Tess Strickland 7fc9cca11e [gardening] Marking test that times out on ia32 debug as Skip.
We're getting shard timeouts now and again involving this timeout,
so skip it entirely before we resort to adding new shards.

TEST=Status file change.

Change-Id: I8dff4db13f7f6e742a3ff54b8401b1eea9f46556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236081
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-03-09 09:13:45 +00:00
Ryan Macnak 81143e16c4 [vm, gc] Don't perform blocking compactions in response to Dart_NotifyLowMemory.
These GCs usually did not free very much memory but did consume a lot of CPU. They would on low-powered, low-memory devices often take ~1s, during which time the OS might decide the OOM signal wasn't working and kill us before the compaction can complete and free pages. Instead, only release pooled memory.

Also use more appropriate GCReasons in calls of CollectMost/AllGarbage.

TEST=ci
Bug: b/216333343
Change-Id: Ia56b9ca409410f17d40508c69fb1bc9df0ce4028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235300
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-08 22:42:46 +00:00
Ryan Macnak d34e7b0500 [vm, compiler] RISC-V BigInt intrinsics.
Note that unlike x86 and ARM, RISC-V has no carry flag, so we must synthesize the carry in a GPR using sltu.

TEST=ci, RSA
Change-Id: I24898cb8b7166d5769ae98c535ec29b2206340d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235063
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-08 18:08:44 +00:00
Alexander Markov dc8f487bae [vm] Cleanup unused SourceLabel and NameReference
TEST=ci

Change-Id: Iffe90eca5b84f76ec2a1d22a31939b51f726909b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235862
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-03-08 18:06:14 +00:00
Ryan Macnak fb24668989 [vm] Avoid confusing foreign stack walkers at the Dart entry frame.
On architectures with a link register, don't generate a profiler marker into what a foreign stack walker will interpret as the caller's frame area. If the caller is unwound based on SP instead of FP, this will cause it incorrectly identify its own caller.

TEST=ci (--profile_vm=false)
Bug: b/220804295
Change-Id: I3cc9d579f9c95476e23040c84574d2965b5eb7ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235164
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-07 22:49:23 +00:00
Ryan Macnak dc88311556 [vm, compiler] RISC-V string intrinsics.
TEST=ci
Change-Id: I906a7d273457e68edfea8b857a974a88e8ef85e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234112
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-07 19:39:23 +00:00
Ryan Macnak dba2b1442b [standalone, mac] Set the process title based on the main script.
This makes it easier to identify the responsible program when a Dart process has high CPU or memory usage.

Add missing include of pthread.h, which seems to be indirectly included on proper MacOS but not iOS.

TEST=look at Activity Monitor
Change-Id: I682186cf1b16ae90ce6ee775b5c5bc72cdb2810f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235700
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-07 19:21:53 +00:00
Vyacheslav Egorov ddc6f1b8e4 [vm/riscv] Remove accidental __ to unbreak the build.
TEST=ci

Change-Id: I084cbf30d5bda590f42b9ce54eab6515f6a5a426
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235604
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2022-03-07 13:44:23 +00:00
Vyacheslav Egorov 9a0be16a9d [vm/compiler] Fix unwinding issues
We used to emit an unwinding rule for caller's SP, however
this does not really work as we expected it to work. Instead there is
an unwritten rule that caller's SP is equal to the CFA which overwrites
our unwinding rule (at least in libunwindstack library used by
Android).

This leads to unwinding issues on the boundary between C++ and Dart:
when we unwind through the InvokeDartCode stub frame we arrive to
C++ code with SP equal to callee's CFA, which is set to FP by our
unwinding rules. In this case if C++ code does not use FP based frames
we will fail to unwind C++ frame property - because SP will be
incorrect. This manifest in simpleperf profiles as stacks which
abruptly truncate at DartEntry::InvokeCode.

This CL rewrites unwinding rules to fix this: instead of using
FP as CFA we define CFA to be caller's SP (FP+2*kWordSize). This ensures
that unwinding on the boundary between C++ and Dart works correctly:
as CFA will always be consistently set to caller's SP.

Additionally this CL fixes InvokeDartCode stub to remove a value
that this stub pushes above saved return address in PRODUCT mode.

This value acts as a profiler marker used by builtin profiler
which is only included in non-PRODUCT builds - but the presence of this
value interfers with unwinding (caller's SP will be off by 1 due the
presence of this value).

We could produce custom unwinding information for this stub instead, but
just removing this value in PRODUCT builds should solve the problem
as we usually only profile Flutter release builds with simpleperf.

Fixes b/220804295

TEST=manually profiled a Flutter app and confirmed correct flamegraph.

Change-Id: I2094afaab6e54e89625c0b5a89aebc6b9823d67c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235226
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-03-06 15:29:22 +00:00
Konstantin Shcheglov 7039c5dc0c Replace using deprecated CompilationUnit.types with classes.
Change-Id: Ieb95799a0e0afa8d1d2da01e6050d675a2cb92e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235402
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-04 19:18:45 +00:00
Alexander Aprelev 574bc8e59c Revert "[standalone, mac] Set the process title based on the main script."
This reverts commit bd8ed80309 as it broke
sim dart->engine roller build

TEST=revert

Change-Id: Ibe513e53cfb77aa8297b650d33191cd9e3bea4f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235400
Auto-Submit: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-03-04 18:03:06 +00:00
Alexander Markov 8e5af6217e [vm/compiler] Revise heuristic for huge methods
Previously, compiler looked at the size of Dart source code when
deciding that the method is huge and needs to be compiled
with less optimizations. That size includes comments and nested
closures, so it is very inaccurate and the heuristic had
false positives seen in practice.

This change revises the heuristic to look at number of kernel
AST nodes, which are counted during building of flow graph.

This change also introduces --print_huge_methods option which
shows the warning if method is huge and compiled with less
optimizations.

TEST=manually verified that huge method from
https://github.com/flutter/flutter/issues/94461 is printed
when --print_huge_methods option is specified.

Issue: https://github.com/dart-lang/sdk/issues/48495
Issue: https://github.com/dart-lang/sdk/issues/48284
Change-Id: I81188b0cc3c147423e9cee91f2a6f544d60d319b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235173
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-03-04 16:27:40 +00:00
Alexander Markov fca796ae03 [vm/compiler] Code cleanup around IL
This change cleans up unused/redundant/obsolete/duplicate code
around IL instructions and related classes.

TEST=ci (refactoring)

Change-Id: Ie4dec299ca9ffd57ac68978bbde4e0b34e891734
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235281
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-03-04 15:16:51 +00:00
Vyacheslav Egorov c97736d594 [vm/compiler] Fix DelayAllocations pass
When looking at a phi use of an allocation, we must consider *all*
inputs that refer to this allocation and not just the first one.

Otherwise, we might end up sinking allocation down to a use that does
not dominate all uses of the allocation.

Fixes https://github.com/flutter/flutter/issues/98466

TEST=runtime/tests/vm/dart{,_2}/flutter_regress_98466_il_test.dart

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: Iab87b4c225a29a4967eefad56a7e425629ea4b70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234361
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-03-04 10:00:41 +00:00
Daco Harkes 252ca13017 [vm] Object store lazy init for dart:ffi
In a follow up CL, we lookup members in `dart:ffi` lazily.

Also removes ffi member from store that was never used.

Split off https://dart-review.googlesource.com/c/sdk/+/229544 to make
that CL smaller.

TEST=SDK build

Bug: https://github.com/dart-lang/sdk/issues/47777

Change-Id: I2eed23b57ff92217bfae8fabfc84cf75cb62f313
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234942
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-03-04 09:45:21 +00:00
Daco Harkes da0466f02a [vm] Prevent slots from being Object type
TEST=SDK build, only static asserts added.

Change-Id: I6e498eaa7fcde32b9e82bc1521f2b2ff6f1611e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234940
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-03-04 09:45:21 +00:00
Alexander Aprelev 6a60078d96 [vm/finalize] Ensure weak finalizers are invoked with isolate group still available.
Fixes https://github.com/dart-lang/sdk/issues/48321

Tested: DartAPI_WeakPersistentHandleCleanupFinalizerAtShutdown
Change-Id: If437dff4e524cb74ac8d0b3c80ec6bb56dd24e84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235280
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-03-04 03:28:51 +00:00
Leaf Petersen 35e66b5081 Enable by default the experiment flags for the 2.17 language features
TEST=Existing language tests
Change-Id: I6c2ecd73a1c7add1451d72adff94df6fdcfca9fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234704
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2022-03-04 01:08:01 +00:00
Ryan Macnak 24c6190db7 [vm] Fix --verify_acquired_data.
Checks involving the untraced acquired table must run before GC.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48503
Change-Id: Ie71dcf3468addba64f5789aad0c03d0163380049
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235264
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-03-03 22:42:01 +00:00