Commit Graph

13925 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
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
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 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
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
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
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
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
Ryan Macnak 2e76f7f0b3 [vm, gc] When there are outstanding typed data pointers, delay external GC.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48488
Change-Id: I73ccd4a974b921885450271202f432cdc1439aea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234822
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-03 00:58:49 +00:00
Alexander Markov ba05be0e62 Revert "[vm/aot] Issue warning when compiling huge functions"
This reverts commit 76167c002d.

Reason for revert: sometimes users are confused by the new
warnings, see https://github.com/dart-lang/sdk/issues/48495

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48495
Issue: https://github.com/dart-lang/sdk/issues/48284

Original change's description:
> [vm/aot] Issue warning when compiling huge functions
>
> Certain optimizations are disabled when compiling huge functions.
> Also, compiling large functions may cause out of memory in compiler.
>
> This change adds a warning in order to make it easier for users to
> find out about huge functions in their programs and diagnose OOM
> during compilation.
>
> TEST=ci
> Issue: https://github.com/flutter/flutter/issues/94461
>
> Change-Id: Ibc7fb69df21fa96b8159d24c1b71ef8d690b23df
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230160
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

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

Issue: https://github.com/flutter/flutter/issues/94461
Change-Id: I1aa04ead64440d42eb4bfa21a1d65e59c150c00a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234903
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-03-02 20:42:39 +00:00
Ryan Macnak 9470dbfd14 [vm] Avoid heap allocations during isolate shutdown.
The isolate might be shutting down due to OOM, so we want to avoid recursively triggering OOM.

TEST=ci, ciderd
Change-Id: I1ff383dada1035fc6da659bb37c39440e674f79d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234805
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-02 18:57:29 +00:00
Alexander Markov 35eef00915 [vm/compiler] Assert matched representations in IL
This change adds assertions that representations match
between inputs and outputs in the IL instructions
(after the last SelectRepresentations pass).

TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/48472

Change-Id: I1515a0981aa9b6ca4578c996d7f11e0f110b98b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234440
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-28 15:23:28 +00:00
Aske Simon Christensen fbfea6e022 [gardening] Fix memory leak in isolate test, flagged by asan
TEST=ci, asan
Change-Id: I8ed9d50f10eeb483deefb89ec84d6c71591833ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234602
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-02-28 15:05:59 +00:00
Alexander Aprelev eb6e485b34 [vm/isolate] Make resolvePackageUri optional in Isolate.spawn.
Fixes https://github.com/flutter/flutter/issues/14815
TEST=IsolateSpawn_FileUri,IsolateSpawn_PackageUri

Change-Id: I95075b8e5f4bc022eca37eefaf350e777a83dc6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234342
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-02-25 19:37:53 +00:00
Alexander Markov 736cec66d9 [vm/compiler] Avoid unmatched representations after the last SelectRepresentations pass
Before this fix, Canonicalize pass could change representation
of inputs of EqualityCompare after the last SelectRepresentations
pass. This results in unmatched representations and invalid code
generated.

The fix is to disallow canonicalization of EqualityCompare
from null-aware to non-null-aware after the last SelectRepresentations.

TEST=vm/dart/regress_flutter98967_test
Fixes https://github.com/flutter/flutter/issues/98967

Change-Id: I05359737fe322fbb2a0fe6025e3716ba5d04ebbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234324
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-25 18:36:02 +00:00
Ryan Macnak 507de0e2f5 [vm, gc] Avoid pathological allocation limit when new-space is larger than old-space.
If new-space is larger the old-space, the old calculation could set the soft allocation threshold lower than size of old-space after the GC. This would cause the first old-space allocation to immediately trigger concurrent marking.

Note that since the headroom is now calculated as an addition to growth policy's output instead of as a subtraction, this effectively changes the meaning of --old_gen_growth_space_ratio from an upper bound to a target.

TEST=ci
Change-Id: Id053bfd4b0d8a8d3b43e118f265f199a45570c54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233161
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-25 18:27:52 +00:00
Ben Konyi ee5837aa7a Revert "[ Service ] Update VM service message to not reference Observatory"
This reverts commit f9147d933e.

TEST=N/A

Change-Id: Idef34b70f1066ddf79d02588dfba7caeec443e7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234325
Reviewed-by: Dan Field <dnfield@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-02-24 18:32:14 +00:00
Alexander Thomas 0c0cd6341d Revert "Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"""
This reverts commit 5d7d8a377d.

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

Original change's description:
> Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
>
> This is a reland of 8d1eedca64
>
> Disable builds for Fuchsia
>
> TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
> Original change's description:
> > Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
> >
> > This is a reland of 19e5749308
> >
> > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> >
> > Original change's description:
> > > [vm] Add analyze_snapshot tool for AOT snapshot inspection
> > >
> > > Current skeleton to allow for instrumentation snapshots that can be
> > > built alongside Dart compilation artifacts and easily referenced for
> > > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
> > >
> > > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> > >
> > > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> > > Reviewed-by: Slava Egorov <vegorov@google.com>
> > > Commit-Queue: Slava Egorov <vegorov@google.com>
> >
> > Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Commit-Queue: Slava Egorov <vegorov@google.com>
>
> Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Chris Evans <cmevans@google.com>

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

Change-Id: Ie5b0b6d2f8f792a3bed9134d7d10fb4d34d9a58d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234284
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-02-24 16:56:23 +00:00
Ryan Macnak e54d75203e [vm] Fix crash when using --disassemble with AOT snapshots.
Broken by 13d27d669d.

TEST=disassemble_aot_test
Change-Id: I015c7b9d8cdf8d30a70595604799c790ef758bb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233528
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-23 20:49:03 +00:00
Ryan Macnak eb17dad604 [vm] Give mutable and immutable arrays a common superclass.
Allows CHA to notice `length` and `[]` have a single target the receiver is a mutable or immutable array.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48361
Change-Id: I9e3ecabab1d32a4baa6e635cd660184ed9bb8fb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232425
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-23 18:34:03 +00:00
Alexander Markov 211da364be [vm] Experimental ability to spawn isolate from kernel blob in memory
TEST=runtime/tests/vm/dart/spawn_uri_from_kernel_blob_test.dart

Change-Id: Ieb327f0350d5d8ea1d344c64aa3dd217125da5fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232682
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-23 16:55:52 +00:00
Chris Evans 5d7d8a377d Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
This is a reland of 8d1eedca64

Disable builds for Fuchsia

TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
Original change's description:
> Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
>
> This is a reland of 19e5749308
>
> TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
>
> Original change's description:
> > [vm] Add analyze_snapshot tool for AOT snapshot inspection
> >
> > Current skeleton to allow for instrumentation snapshots that can be
> > built alongside Dart compilation artifacts and easily referenced for
> > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
> >
> > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> >
> > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Commit-Queue: Slava Egorov <vegorov@google.com>
>
> Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2022-02-23 12:04:32 +00:00