Commit graph

19339 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 57fb2a05a2 [vm, compiler] Fix clobbered PP for callers of AOT allocation stubs on RV.
In the JIT, this PP is saved and restored in stub's Dart frame. In AOT, Dart frames do not save PP because it is a global register within Dart code. On other architectures, PP is a preserved register in the C ABI.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48333
Bug: https://github.com/dart-lang/sdk/issues/48354
Change-Id: I1b6702805a6fb556a1695197e40a89c364af3f8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232520
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-14 20:33:30 +00:00
Martin Kustermann 525e7f093f [gardening] Skip part of Isolate.spawnUri() which depends on --enable-assertions in PRODUCT mode
The --enable-assertions flag is not avaiable in PRODUCT mode, so we skip
this negative subtest.

TEST=Fixes dartkp-product on a newly added test for vm/dart{,_2}/spawn_uri_aot_test

Change-Id: Ie7be219b6eb2a2ac53ea5048a844fafeb488ba54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232941
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-14 18:37:54 +00:00
Martin Kustermann 31ac1d26f9 [vm] Make Isolate.spawnUri() work in AOT iff the uri is compatible AOT snapshot
Right now the implementation of `Isolate.spawnUri(<uri>, ...)` in
the standalone embedder is to ignore `<uri>` and make the spawnned
isolate from the same AOT snapshot as the main isolate.

This is very confusing and very incorrect.

Instead `Isolate.spawnUri()` should work if-and-only-if the given
`<uri>` points to a valid and compatible AOT snapshot. If not, it should
throw an appropriate exception.

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

TEST=vm/dart{,_2}/spawn_uri_aot_test

Change-Id: I279ace08ac1b9a9eed3ae03ebe5d9e2336c1e5c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232603
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-14 15:18:33 +00:00
Alexander Thomas 30beab0f43 [infra] Add OWNERS to the Dart SDK
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.

For additional background information see go/dart-sdk-owners.

TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-02-14 14:06:34 +00:00
Martin Kustermann 32876877ae [gardening] Remove standalone{,_2}/io/process_run_test from iso-stress builder
The test is flakily failing with low propabililty due to a race on
executing a copy of `process_test` and having this file opened for
writing mode (so it seems).

This issue is not related to isolates and we'll therefore remove it from
the "iso-stress" builder.

TEST=Removes flakiness from "iso-stress" builder.

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

Change-Id: I1f817aed9b014b8cdd7a646f35003d40d4712d0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232624
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-11 18:29:47 +00:00
Martin Kustermann 37acae7e29 [gardening] Remove standalone/io/http_redirect_test from iso-stress builder
This test was modified (in [0]) to use `dart:mirrors` which doesn't
work in AOT mode. Only tests that work in AOT are considered for
the iso-stress builder.

[0] https://dart-review.googlesource.com/c/sdk/+/230600

TEST=Fixes "iso-stress" builder failure to compile.

Change-Id: I354784a33550d816332611747c4d41b53d44b2a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232621
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-11 15:19:07 +00:00
Brian Quinlan 98634512f2 Surface errors returned by SSL_read.
TEST=repro in bug & unit test
Bug: https://github.com/dart-lang/sdk/issues/48311
Change-Id: Ib13d0e3c2b98be85533a65532119874ca504f196
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226607
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-02-11 02:07:43 +00:00
Ryan Macnak 2829bfdf25 [vm] Avoid repeating parameters from prematurely destructuring Dart_InitializeParams.
TEST=ci
Change-Id: I39288fc4d79c5933d5c8b274c0a66bdd25f6bf29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231529
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-11 00:55:11 +00:00
Daco Harkes 828dcd00e8 [vm] Implement WeakReference in the VM
This CL implements `WeakReference` in the VM.

* This reduces the size of weak references from 2 objects using 8 words
  to 1 object using 4 words.
* This makes loads of weak reference targets a single load instead of
  two.
* This avoids the fix-point in the GC and message object copying for
  weak references. (N.b. Weak references need to be processed _after_
  the fix-point for weak properties.)

The semantics of weak references in messages is that their target gets
set to `null` if the target is not included in the message by a strong
reference.

The tests take particular care to exercise the case where a weak
reference's target is only kept alive because a weak property key is
alive and it refers to the target in its value. This exercises the fact
that weak references need to be processed last.

Does not add support for weak references in the app snapshot. It would
be dead code until we start using weak references in for example the
CFE.

This CL does not try to unify weak references and weak properties in
the GC or messaging (as proposed in go/dart-vm-weakreference), because
their semantics differ enough.

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

TEST=runtime/tests/vm/dart/finalizer/weak_reference_run_gc_test.dart
TEST=runtime/tests/vm/dart/isolates/fast_object_copy_test.dart
TEST=runtime/vm/object_test.cc
TEST=tests/lib/isolate/weak_reference_message_1_test.dart
TEST=tests/lib/isolate/weak_reference_message_2_test.dart

Change-Id: I3810e919a5866f3ae8a95bd9aa23a880a0b0921c
Cq-Include-Trybots: luci.dart.try:app-kernel-linux-debug-x64-try,dart-sdk-mac-arm64-try,vm-canary-linux-debug-try,vm-fuchsia-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-simriscv64-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232087
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-02-10 21:59:41 +00:00
Daco Harkes fac4d23799 [vm] Fix serial scavenge asserts in object copy
The serial scavenger was expecting the typed_data field of views.
Fast object copy leaves a null there temporarily.

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

TEST=runtime/tests/vm/dart/isolates/fast_object_copy_test.dart

Change-Id: I72a2785cd9708e72593d35179536a831193d2a44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232260
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-02-10 21:59:41 +00:00
Ryan Macnak 50b2a4f32e [vm, compiler] Fix allocate mint stub clobbering registers not blocked by BoxInt64Instr.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48333
Change-Id: If8e97e34c0e43a0d4cae2a6b88fba2f15ac07e37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232232
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-10 20:10:01 +00:00
Ryan Macnak 598fb44709 [vm, ffi] More support for RISC-V.
Fixes cases with passing floats, passing aggregates by value, passing scalars requiring alignment.

The remaining failing tests look like some kind of corruption or register reuse when passing very large numbers of arguments.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: Ibac32d4f291255e1c2eb8fd1b196b3e2f006f610
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231282
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-10 02:05:28 +00:00
Ryan Macnak f64fc409c7 [vm, ffi] Extend calling convention unit tests to consider large numbers of floating point arguments.
Interesting things happen after the 8th and 16th arguments in RV.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: I9e068af8a2e6de99541f8e2e9b5c407df42b4197
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232140
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-09 22:07:38 +00:00
Alexander Aprelev 6b830c4428 [vm/isolate/spawn] Ensure spawnFunction sends closure so type args are preserved.
Fixes https://github.com/dart-lang/sdk/issues/48035

TEST=spawn_generic_function_test

Change-Id: I28d0ea9123bd31cb1aa288824c3c7688fc2ca8f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232160
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-02-09 16:49:49 +00:00
Nate Bosch 33e174084a Replace Uri.scheme == with Uri.isScheme
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.

TEST=No behavior changes.

Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-02-08 21:38:57 +00:00
Alexander Markov 0cf751215e [vm] Correct token position for AssertAssignable in implicit field setters
The real token position is required in case debugger stopped on
an exception thrown from AssertAssignable and trying to evaluate
an expression which uses receiver. Without token position all local
variables (including receiver) are considered out of scope
(as frame's token position is out of range).

TEST=runtime/observatory/tests/service/regress_48279_test.dart
Fixes https://github.com/dart-lang/sdk/issues/48279

Change-Id: Idb6a8e12185367ceac2034269b8f046272384006
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231748
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-08 19:28:36 +00:00
Brian Quinlan 085e978ce4 Fix on Windows, renaming a file using the Directory class generates an incorrect exception
TEST=unit
Bug: https://github.com/dart-lang/sdk/issues/47713
Change-Id: I603a452cece478ad5ddd85d47e9cfe02cee3f4d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231801
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-02-07 23:15:56 +00:00
Vyacheslav Egorov 72eb59f32a [vm/compiler] Allow WB elimination for small arrays.
Previously all arrays were excluded from WB elimination pass
to avoid invariant restoration code creating excessive work
for the GC and to avoid dealing with card marking in the
invariant restoration code.

It seems reasonable to enable this for small arrays of up to 8
elements. The cut of point of 8 elements was chosen based on the
cut of point for literal<N> specialisations provided by the
core library for creating small literal arrays.

TEST=vm/cc/IRTest_WriteBarrierElimination_Arrays

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I2b3169865f07c3ff95820c1bc6718943e96bd33b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229903
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-02-07 10:47:12 +00:00
Ben Konyi ad4d10a42c [ package:vm_service ] Migrate Observatory service tests to package:vm_service (Pt 2)
See https://github.com/dart-lang/sdk/issues/45037

TEST=pkg/vm_service/test/*

Change-Id: I0632744fdea0da63a47d64299cbd1f96f45dcb3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186742
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-02-05 00:12:29 +00:00
Martin Kustermann 4eaacc3df9 [vm] Improve async performance by taking advantage of static types of returned values
In general any async function can return X or Future<X>. Though the
future implementation has to do different things depending on which case
we're in. It does so by using a `<obj> is Future<T>` test. This test is very
expensive if many different classes flow into `<obj>`.

Though most functions do not return `Future` objects from async
functions. We can determine that statically by looking if any returned
expression could be a future. If not, we can bypass the `is Future<T>`
test entirely.

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

TEST=pkg/front_end/testcases/general/async_function_returns_future_or.dart

Change-Id: If655bdbdddc214dd7b12be9905b3c788252547d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230662
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-04 22:06:59 +00:00
Siva Annamalai 2e731c540a Revert "[tools] Replace the Chromium binary size tool, which no longer works."
This reverts commit e32d98cd06.

Reason for revert: Dart rolls into the engine are failing because there are references to run_binary_size_analysis in the "Upload artifacts android-arm64-release" step of the build

Original change's description:
> [tools] Replace the Chromium binary size tool, which no longer works.
>
> Change-Id: Id84717e21a129a392d3bc4e9b4cce84dfb4771e1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231066
> Reviewed-by: Ben Konyi <bkonyi@google.com>

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

Change-Id: Ibfbdf1e0a970ad7fae9ec1d39d24722647b38730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231600
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-02-04 02:11:06 +00:00
Ryan Macnak 172dad5375 [vm] Fix double and mint to inherit the PostLoad for instances.
Cf. ab3aab760e.

TEST=ci, aot
Change-Id: Ia1d0b5776d9714bde94f3372824f94dd70a7ae23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231532
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-04 00:10:47 +00:00
Ryan Macnak 33a1117d62 [vm] Add missing opt-out of C instructions to vm/cc/LoadWordUnsigned_0.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38587
Change-Id: I15460a970522044b50f98922fad559d26c5813ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231524
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 21:52:56 +00:00
Ryan Macnak ab3aab760e [vm] Remove special cases for canonicalizing doubles and mints.
dart_precompiled_runtime -7k

TEST=ci
Change-Id: I22c8254b08d9f68be02f7210aa60f7cc728f8b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231324
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 21:13:36 +00:00
Ryan Macnak 4faf01a66c [vm] Cleanup workarounds for removed flag --throw_on_javascript_int_overflow.
TEST=ci
Change-Id: I65936b5cd6e5933eadc37f3cd6bba1f0fa1b81a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231328
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 21:10:46 +00:00
Ryan Macnak b6ab7350be [test] Inform status files about the new simulated architectures.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/37299
Bug: https://github.com/dart-lang/sdk/issues/38587
Change-Id: I6f1a749690b894b14f465d608f37acf62568cdef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231521
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 20:32:16 +00:00
Daco Harkes eacd2b3e3e [vm] WeakReference check target type
Closes: https://github.com/dart-lang/sdk/issues/48264

TEST=runtime/tests/vm/dart/finalizer/weak_reference_run_gc_test.dart

Change-Id: I16d9d9768bcef3c832960f0cd33ba54a0b689ed2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231481
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-02-03 18:29:46 +00:00
Ryan Macnak f3996e4e96 [vm] Remove some dead error entry points.
TEST=ci
Change-Id: I78e13654ba4425e07e92a5a879595cae2045ea99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231360
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 17:55:16 +00:00
Vyacheslav Egorov aeb3e1d73b [vm] Avoid creating unnecessary SafepointPosition's
Register allocator does not need to associate always-calls
safepoints with live ranges of constant values because
constant values are never actually spilled and are rematerialized
instead.

@alexmarkov has observed that SafepointPosition objects for
constants account for large chunk of the total memory eaten by
the register allocation pass and this change addresses this issue.

With this change the total memory consumed by the register allocator
decreases from 21 Gb to 8.6 Gb on one of the examples
in https://github.com/flutter/flutter/issues/94461.

TEST=ci

Change-Id: I245f2678bc6f5c1d63fd282812d1df2b2958512f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231442
Auto-Submit: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-02-03 15:39:06 +00:00
Ryan Macnak 08164f88c9 [vm] Add missing safepoint transition when updating or deleting API handles.
TEST=tsan, iso-stress
Change-Id: I82f8fb8ef3bbedf510e34488fdaa7d8af5902830
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231332
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 00:41:07 +00:00
Ryan Macnak e32d98cd06 [tools] Replace the Chromium binary size tool, which no longer works.
Change-Id: Id84717e21a129a392d3bc4e9b4cce84dfb4771e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231066
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-02-02 17:22:38 +00:00
Alexander Markov 45f42d0be8 [vm] Refactor duplicated slots and rename offsets
This change removes distinct Slots for the same field:

PointerBase_data_field -> PointerBase_data
Pointer_data_field -> PointerBase_data
TypedDataBase_data_field -> PointerBase_data

Also, the following slot is renamed to match field name:

TypedDataView_data -> TypedDataView_typed_data

The following offsets are renamed to match field names /
declarations in Untagged* classes:

PointerBase::data_field_offset -> PointerBase::data_offset
TypedData::data_offset -> TypedData::payload_offset
TypedDataView::data_offset -> TypedDataView::typed_data_offset


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

Change-Id: I602545fc43018494bcb24d8692292fdbc6a8f3e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231160
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-02 16:30:50 +00:00
Ryan Macnak a7faaaa148 [vm] Properly exclude the field descriptors from product builds.
TEST=ci
Change-Id: Ia9d345f7f6488b24b780979fd624d708c7038811
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231182
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-02 00:32:25 +00:00
Ryan Macnak 6f9289ca30 [vm, compiler] Avoid false positive in assertion for eliminated write barrier.
This adjusts RISC-V to match the other architectures in checking only the generational barrier.

TEST=fuzzer
Change-Id: I86965bb2caaae27aa9770769f392cffc8edb6eb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231046
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-01 17:17:05 +00:00
Alexander Markov e4942db83e [vm/compiler] Avoid speculative conversion in ffi Pointer.asTypedList
On 32-bit ARM in AOT mode Pointer.asTypedList is generated so that
there is a LoadField from Pointer.data_field which has kUnboxedFfiIntPtr
representation (uint32) and then the value is passed to a
StoreInstanceField for TypedDataBase.data_field which has kUnboxedIntPtr
representation (int32). As a result, a speculative uint32->int32
IntConverter instruction is inserted by SelectRepresentations pass.
AOT doesn't support deoptimization so code generation crashes after
retrying without speculative inlining.

This change fixes the type incompatibility by loading value with
LoadUntagged and then converting it with ConvertUntaggedToUnboxed(kUnboxedIntPtr).

TEST=ffi/regress_flutter97301_test
Fixes https://github.com/flutter/flutter/issues/97301

Change-Id: I4a00d4ac7978b4775add0ddae510841a2b4cbae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230956
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-01 16:49:56 +00:00
Ivan Inozemtsev d7e3fadacd Revert "[vm] Disable longjmp() wrapper in exceptional flow in TSAN until g3 issue is fixed"
This reverts commit 8d412e80e1.

Reason for revert: b/209838275#comment53

TEST=ci

Original change's description:
> [vm] Disable longjmp() wrapper in exceptional flow in TSAN until g3 issue is fixed
>
> Issue b/209838275
>
> TEST=ci
>
> Change-Id: Ie0a2e6f68a0c4f855dfd367dd3dd0a37053be479
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222760
> Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

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

Change-Id: Iab202ddbd54060f609096b71f8ef83da53249d40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231005
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-01-31 15:49:54 +00:00
Alexander Aprelev 65178de9d2 [infra] Describe how to download large isolate artifacts(core dumps)
File browser web interface might fail to download large files, so one needs
to use cas tool to download those.

Change-Id: I8053860f9ba443dc481319e5574ecd6d41baf8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225560
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-01-29 06:21:23 +00:00
Jens Johansen adb1dc9380 [VM] [CFE]: Make VM send over type information for expression compilation
Missing:
* Function types.
* Type variables in bounds, like "method<T, S extends T>() {}" and
  "method<T extends Foo<T>>() {}"

This is in many ways a follow-up to
https://dart-review.googlesource.com/c/sdk/+/212286

TEST=service and (cfe) expression suite tests added.

Change-Id: I20472b59ed73e9845f073e176d73b2c213f9407a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-01-28 07:49:21 +00:00
Alexander Aprelev c925119c2f [vm] Ensure safepoint_state is updated atomically when unwinding.
Fixes https://github.com/dart-lang/sdk/issues/48229
TEST=ci,flutter

Change-Id: Ifa88ef2415ba325e9ba6fb39d96b395ac5846026
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230520
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-01-27 21:58:24 +00:00
Alexander Markov 43af470c08 [vm/compiler] Avoid assertion failure on an unreachable Unbox with incompatible types
FinalizeGraph pass removes redefinitions and can change reachable
types of values. As a result, type of an input value of Unbox
instruction can become incompatibe with representation of the result of
Unbox, even if Unbox cannot deoptimize (this may happen if
the instruction is unreachable).

Previously, code generation failed with an assertion in that case.
This change adjusts code generation to silently generate load from
box instead.

TEST=runtime/tests/vm/dart/regress_48196_test.dart
Fixes https://github.com/dart-lang/sdk/issues/48196

Change-Id: I35f80a1b3135687901cd1b57c0e5572d29c4d2e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230341
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-01-27 21:11:41 +00:00
Jens Johansen 95731547be [observatory] Fix/workaround a few crashes
TEST=N/A

Change-Id: I992acd131cee6473827d3a4306c37678cbe55d2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229966
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-01-27 18:51:24 +00:00
Ryan Macnak cf2ad9d582 [vm, gc] Have the main thread assist with concurrent sweeping when it would wait.
TEST=ci
Change-Id: If7695b91253b8004b523fd6842bee0a417e8f17c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228062
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-27 18:22:52 +00:00
Alexander Markov 76167c002d [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>
2022-01-27 16:35:20 +00:00
Daco Harkes 045b9c1715 Reland "[vm/ffi] Add common C types"
We're adding these types to `dart:ffi` rather than `package:ffi` so that
they can be used with `FfiNative`s.

Adds `NativeType`s for the following C types:

* unsigned char
* signed char
* short
* unsigned short
* int
* unsigned int
* long
* unsigned long
* long long
* unsigned long long
* uintptr_t
* size_t
* wchar_t

Because the C standard only defines minimum sizes for many of these
types, future platforms might diverge from the typical size even if all
platforms currently agree on a size. To avoid having to reification
later, we define all types as AbiSpecificIntegers rather than typedefs,
even if all current target platforms agree on the size.

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

TEST=tests/ffi/c_types_test.dart

Original patch in patchset 1.

* Removes `Char` for now until package:win32 has rolled to 2.3.8 in
  Flutter. https://pub.dev/packages/win32/versions/2.3.8/changelog
  https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8824468064587445729/+/u/Android_Views_Integration_Tests/stdout
* Adds `c_type.dart` in `ffi_source.gni` which should fix `IntPtr`
  missing when analyzing `path_provider_linux`. (However, I was unable
  to reproduce the issue locally.)
  https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8824468064571399025/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
  `/tmp/flutter_plugins.KZMNMC/packages/path_provider/path_provider_linux$ ~/flt/engine/src/out/host_debug/dart-sdk/bin/dart  analyze --fatal-infos`

Change-Id: I89130cccba285fc9c483bb53f5710a302f2b104f
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-canary-linux-debug-try,vm-fuchsia-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-debug-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-win-release-x64-try,flutter-analyze-try,flutter-engine-linux-try,flutter-frontend-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229156
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-01-27 13:09:01 +00:00
Alexander Markov 17563522da [vm/compiler] Minor improvements in hashcodes and test for inefficient hashes
This change improves a few implementations of hashcodes in compiler.
Slightly improves AOT compilation time:
gen_snapshot 60.736s -> 58.920s (-2.9%)
(on a large Flutter app, compiled in release mode for arm64).

Also, the same large app can be now compiled with
--hash_map_probes_limit=1500, meaning that all hash maps in
the compiler perform less than 1500 probes when looking for an
element.

This change also adds a test which verifies that kernel compiler
itself can be compiled with --hash_map_probes_limit=1000.
This is a sanity check to ensure we do not have a very
badly distributed hashcode in the compiler.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/43299
Change-Id: I7a802709727a33760c4f1d13f7b2c8cb263852d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229940
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-01-26 23:44:31 +00:00
Ryan Macnak 9a00395504 [vm, x64] Use a shorter addressing mode for UnboxInt64.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48221
Change-Id: I429b2d05aef595dd3ad148ada0aeb3a3225e2995
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230200
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-26 22:18:17 +00:00
Ben Konyi 1c571a12fa [ CLI ] Migrate package:dartdev to null safety
Fixes https://github.com/dart-lang/sdk/issues/47964

TEST=CQ

Change-Id: I4ee57bc5739835824b0052bd9470a0d52ccf161b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229948
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-01-26 21:16:49 +00:00
Ryan Macnak 6eb5cde512 [vm] Remove dead flag declarations.
TEST=ci
Change-Id: I32297b9791462b4a9a03918cf5ee405a3354184c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229720
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-26 18:58:58 +00:00