Commit graph

21512 commits

Author SHA1 Message Date
Johnni Winther ae03b57cbb [cfe] Remove .isNonNullableByDefault from package:kernel
This removes the .isNonNullableByDefault properties and similar from
the AST nodes in package:kernel. NNBD is now always enabled so these
properties are trivial.

TEST=existing

Change-Id: I75ca0551ac4b5910ea63530dd0c9c2e68bd01aff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366320
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-05-15 08:31:38 +00:00
Vyacheslav Egorov 3afb61aa7a [vm] Use Hash as TypeArguments canonicalization hash
Fixes https://github.com/dart-lang/sdk/issues/55666

TEST=ci

Change-Id: Ib7d53e14f5be0f56851576dec2e6a3f136b41e44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366301
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-05-15 08:06:29 +00:00
Ryan Macnak d45304cd6f [vm] Add support for the Zalasr extension.
TEST=ci
Change-Id: Ic1a98751ac6b46310e420b44f487720f0dc237c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366162
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-14 16:40:59 +00:00
Ryan Macnak aac993f867 [vm] Remove RV_Zbc from RV_B.
The B Standard Extension has been ratified as Zba + Zbb + Zbs.

TEST=ci
Change-Id: Ifad5d68104e8f98e49a34e5a5ae76fa13c377b38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365988
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-13 21:39:22 +00:00
Vyacheslav Egorov 04cc5098ab [vm] Enable test pattern (a&b == 0) fusion in AOT on X64/ARM64
Previously we would only fuse this pattern for Smi operations
which (almost) never happens in AOT. This CL enables fusion
for Int64 operations as well.

The implementation is limited to X64 and ARM64 for now
because implementing it on 32-bit platforms is somewhat
cumbersome.

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

R=alexmarkov@google.com
TEST=vm/cc/IL_TestIntInstr,vm/dart/test_int_pattern_il_test

Cq-Include-Trybots: luci.dart.try:vm-linux-release-simarm-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-simarm_x64-try,dart-sdk-linux-riscv64-try,vm-aot-linux-debug-simriscv64-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-simriscv64-try,vm-linux-release-ia32-try
Change-Id: I62a482640db45befac6b0b78850f23a8cc624c75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365463
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-05-11 08:53:29 +00:00
Ben Konyi 5f3cd4afe3 [ CLI ] Implicitly set --mark-main-isolate-as-system-isolate for dart test
Fixes https://github.com/flutter/flutter/issues/143170

TEST=test_test.dart

Change-Id: I98044ab2362adcdd55c4f6def0752a755b1385b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366040
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2024-05-10 19:28:45 +00:00
Ryan Macnak 57f57dbbf2 [vm] Don't assert assuming FLAG_max_polymorphic_checks is the same between AppJIT training and execution.
Compare FLAG_optimization_counter_threshold, which can likewise change; optimized compilation might happen sooner or later than with a consistent flag value, but should still be correct.

TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/55625
Change-Id: Iced616163ecf8b3d0a811c67e0c01a9be3d8b18b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365904
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-10 18:14:46 +00:00
Dustin Green dcb6b1a7c1 [fuchsia][sysmem2] route fuchsia.sysmem2.Allocator
Closes https://github.com/dart-lang/sdk/pull/55682

GitOrigin-RevId: 5d2d87cb8f01e9aaa068eeb7435558095fbbbc09
Change-Id: I580c70c1c8d3519ad9a2fdfb3732bc6bebf73c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365871
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-10 17:00:29 +00:00
Ryan Macnak f7cc159e38 [vm, compiler] Fix double-call with --no_polymorphic_with_deopt.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/55622
Bug: https://github.com/dart-lang/sdk/issues/55623
Change-Id: If841fcfee242b2d2bc3b0c970d42488bfe202fb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365868
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-09 22:39:17 +00:00
Ryan Macnak 108576253a [observatory] Avoid distracting UI refreshes in response to service extensions being registered.
Flutter testing generates a lot of these events.

TEST=look at main page
Change-Id: Ic788b72802fad4165a0ec03b452a9e6f32b089da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365987
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-09 21:35:57 +00:00
Ryan Macnak 25aa0cdaa1 [vm, compiler] Fix ARM64 MSAN and TSAN.
TEST=local build
Change-Id: I5e99d703a12c490350933f530df4f44ab67d8907
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365864
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-09 17:06:39 +00:00
Ryan Macnak e22fc12715 [vm, compiler] Mark CalculateElementAddressInstr as not speculative.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/55595
Bug: https://github.com/dart-lang/sdk/issues/55663
Change-Id: I7475ef81857be60910d93262123d01936c5ab15a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365902
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-08 21:10:29 +00:00
Ryan Macnak e3599b6b5e [vm] Fix MSVC build.
TEST=vm-win-release-arm64
Change-Id: I6aff6fc17441d366885b0da59c519343832beb67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365922
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-08 20:14:48 +00:00
Devon Carew 9130ee32a8 [deps] remove the package:usage dep from the sdk
Change-Id: I1ff70767f686e3ec7635294e80fbdb0137e938ee
Tested: pubspec only change to remove a no-longer-used dep
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365920
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-05-08 19:54:20 +00:00
Ryan Macnak 8c1de038e0 [vm, compiler] Allow targeting TSAN or MSAN by passing a flag to gen_snapshot.
Add check that the snapshot and runtime agree on whether to use MSAN. We already have this check for TSAN.

TEST=vm/dart/sanitizer_compatibility_test
Bug: https://github.com/dart-lang/sdk/issues/55637
Bug: https://github.com/dart-lang/sdk/issues/55638
Change-Id: I320e6f55cd59209ce6e58a82ac205a87c8a60a84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365487
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-05-08 17:03:59 +00:00
Johnni Winther 6bec589f00 [cfe] Add least supported version check of 2.12
Change-Id: Iff8a3ea624b7130cb09359fbc9787a98ba07c4e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364700
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2024-05-08 09:28:45 +00:00
Daco Harkes 4945c2a76b [gardening] Increase timeout
Test started being flaky after timeouts got halved. Try increasing
timeout on simulators.

Bug: https://github.com/dart-lang/sdk/issues/55658
Change-Id: If0be49b42045e26ef3d03fed93d8349a54b1ee29
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365585
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-05-08 06:47:30 +00:00
Ryan Macnak 5918b3a4ee [vm, gc] Don't double-visit remembered cards to decide if they should remain remembered.
TEST=ci
Change-Id: Ib92dbbabf90f80c6e984c21b9eaee67fd4205f8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365543
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-07 17:04:29 +00:00
Ryan Macnak 40655e56f0 [dartfuzz] Set dart:io's exitCode, not the shadowing local.
Change-Id: Ib13d004a4290279204b61f0b9aef754ff90c219d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365485
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-06 21:22:28 +00:00
Alexander Markov 95d96cf06d [vm/compiler] Fix incorrect DSE
Dead Store Elimination (DSE) propagates "dead store" state backwards
across basic blocks to predecessors. If place is defined in a loop
(either its instance or index are defined in a loop), propagating
"dead store" state across backedge of the loop is incorrect, as each
loop iteration effectively has its own place.

This bug is fixed by disabling propagation of "dead store"
state beyond defining blocks of instance and index of a place.
This is done by setting bits in "live_in" of the blocks corresponding
to the instance and index definitions of a place.

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

Change-Id: I223ff433daa3d7bcafefc9d91360b16c9554964e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365302
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-05-06 14:12:52 +00:00
Ryan Macnak 06dd95bd8e [infra] Expand sanitizer test coverage.
TEST=ci
Change-Id: I5e7709572f3ea0a16925996be8ab903b6eccc0e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365100
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-02 23:31:48 +00:00
Ryan Macnak 3bba14e56e [dartfuzz] Avoid LUCI's I/O timeout.
Print the number of pending task every 5 minutes to avoid getting killed by the 20 minute I/O timeout. We'll still get killed if we exceed the 50 minute step timeout.

Change-Id: I0bc12c5b78176303432d35fc6107b669ed7c6a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365282
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-02 19:36:09 +00:00
Ryan Macnak 6c95160d23 [vm, compiler] Don't emit AOT instance calls with --no_polymorphic_with_deopt.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/55622
Bug: https://github.com/dart-lang/sdk/issues/55623
Change-Id: Ib327d9cb2621eb6cfd509db83b2e04d17967d857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364960
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-02 17:52:02 +00:00
Ryan Macnak f5fe3dddcc [vm] Avoid strdup during the segfault handler.
malloc is not signal-safe.

TEST=tsan
Change-Id: I8bd6cae743b7ae2d64525f4e88fb412373d4e3df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365187
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-02 16:36:20 +00:00
Vyacheslav Egorov 84fed14131 [vm] Fix vm:align-loops pragma
Use aligned text offset for instructions when resolving static
calls during relocation.

The vm/dart/align_loops_test is adjusted to cover this issue:
previous we only verified alignment but did not actually run
the generated code, so the bug was undetected.

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

TEST=vm/dart/align_loops_test
R=alexmarkov@google.com

Change-Id: I56521c104f91b85150584539f58191cf4592f4f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365144
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-05-02 07:18:20 +00:00
Ryan Macnak ed5aeab889 [test] Fix data race in samples/ffi/async/async_test.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/55615
Change-Id: I4de5701037640f5b0ae6b176f695907c4c5e1ef5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365209
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-05-02 06:44:29 +00:00
Ryan Macnak dfe009cace [vm] Make Dart_DumpNativeStackTrace work if called before VM startup.
TEST=add crash to VM
Change-Id: I6188cee39cdea4075eedee9f1ad176ea1008f21b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363643
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-05-01 20:13:07 +00:00
Alexander Aprelev 842ce8264a [vm/gardening] Skip sendport_api_test on simulators.
The test uses ffi, which is not supported on simulators

TEST=ci

Change-Id: I480a78d041d8e643427d06be741d6596e72d1ec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365183
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-05-01 18:08:59 +00:00
Alexander Aprelev de4029ee1b [vm/sendports] Introduce an api that can be safely used to rebuild SendPort.
Existing api is not aware of origin_id, which leads to problems when a port gets closed, origin_id can't be properly restored.

Fixes https://github.com/dart-lang/sdk/issues/55605
TEST=vm/dart/sendport_api_test

Change-Id: Ia8a5978a968f6ea643d7921c64146cebf17d2e0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365120
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-05-01 17:19:16 +00:00
Ryan Macnak be210a8e76 [dartfuzz] Also stress test using dart2js with various GC and compiler flags.
TEST=dartf
Change-Id: I03fde5903159eeabe6df12513ca491844b0e8fec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364962
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-04-30 21:43:38 +00:00
Ben Konyi 01ef827761 [ Service ] Fix assertions around 'offset' and 'count' parameters for getObject
Both 'offset' and 'count' should support values of 0, even if they don't
produce any interesting results.

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

TEST=N/A

Fixed: 55603
Change-Id: If1b5869368c21634b13da5e3ba2ddfb9d219cf49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365080
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-04-30 20:46:37 +00:00
Alexander Markov 29c14f0a00 [vm/compiler] Remove Smi->Int32 widening optimization
This optimization is a dead code: it was disabled since 2018 (97ffcd9a3d)
because it incorrectly changes Smi instructions to Int32 instructions
without accounting for a larger range of the result which may not be
expected by uses of the instruction.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/32619
Change-Id: Ice34ff36929c998e7d1a1584e061834119636e2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364965
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-04-30 19:43:10 +00:00
Alexander Markov 6e5aae8e0f [vm] Unsound mode cleanup: remove legacy types from the VM
TEST=ci

Change-Id: I0ade9ebf5dff2b283a2c7e0ff99dc6b56f548ba9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364622
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-04-30 17:49:37 +00:00
Ryan Macnak dced438e75 [vm] Access Function::code_ with acquire-release ordering.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/55597
Change-Id: I915dfc6e3ec9e547f50e649b9dd430a5c7c52752
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364969
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-04-30 17:48:19 +00:00
Ryan Macnak d42a4b7219 [test] Run FFI tests on Fuchsia ARM64.
- Compile tests to kernel and use that instead of source for the Fuchsia test package.
 - Skip multitests instead of the running them and approving the failures.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: Idd9bef0f6026c6d882712eb1083e88433bb53b13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333121
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-04-30 17:37:45 +00:00
Alexander Markov ac3a99b760 [vm] Optimize double.remainder
Bypass runtime entry and directly call `fmod` from generated code,
similarly to double.operator %.

On a micro-benchmark (from #55479):

JIT
Before: Remainder(RunTime): 1347507.0 us.
After:  Remainder(RunTime): 19465.037735849055 us. (69x faster)

AOT
Before: Remainder(RunTime): 1232950.0 us.
After: Remainder(RunTime): 19465.377358490565 us. (63x faster)

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

Change-Id: I5b35b15f21da74aa4e2c92d7aa2804dae9efff99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-29 17:47:21 +00:00
Alexander Markov 9ee25d3ce1 Cleanup unsound mode from pkg/vm, frontend_server and dart2native
TEST=ci

Change-Id: Ica8b8b68f69e8f4a8cd5af3375da4a9ff0947c35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364602
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-04-29 14:18:01 +00:00
Ryan Macnak f02007839d [test_runner] Reduce timeouts.
We've roughly doubled bot speeds; half timeouts to provide pressure against this simply getting filled with slower tests.

Change-Id: I812da7adc6c08e6d484732c2558e0d3f63b2694a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364385
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-04-26 21:39:34 +00:00
Lasse R.H. Nielsen b464fc9037 Reland "Tweak expect.dart library."
This reverts commit cd2c566bcf.

Reason for revert: Updating to not remove field used by Flutter engine.

Original change's description:
> Revert "Tweak `expect.dart` library."
>
> This reverts commit ff5f391c0a.
>
> Reason for revert: The expect library is used by Flutter engine, and some of its tests use assertStatementsEnabled. There should be a migration path that doesn't require an atomic change, like adding the replacement api before removing the old one.
>
> Original change's description:
> > Tweak `expect.dart` library.
> >
> > Make API more consistent for a few methods.
> > Reduce the number of language features used in tests:
> > * Never iterating an iterable, always converting it
> >   using `.toList()` first and iterating using indices
> >   (fx `setEquals`).
> >   Also require a `List` in places where an `Iterable`
> >   wasn't necessary.
> > * Avoid doing complicated computations that are also
> >   used for the error message. Do simple check first,
> >   then recompute to get better error messages
> >   (fx `allDistinct`).
> >
> > Renamed some rarely used members for consistency
> > (`stringContainsInOrder`->`containsInOrder`,
> > where other string-contains functions just start
> > with `contains`, and `containsOneOf` -> `containsAny`
> > to match `Iterable.any` phrasing, and also it accepts
> > if containing at least one, not precisely one.)
> >
> > Removed a function that wasn't used anywhere.
> >
> > Moved `assertStatementsEnabled` to `variations.dart` as `asserts`.
> > Removed `typeAssertionsEnabled` and `checkedModeEnabled`. The former used in one place, where it was replaced with `checkedImplicitDowncasts` from `variations.dart`, the latter wasn't used anywhere.
> >
> > Deprecates `package:expect/minitest.dart`. It was never intended
> > to be used for new tests, only as a help to convert existing tests
> > written against `package:unit_test`.
> > All existing imports marked as `// ignore: deprecated_member_use`.
> >
> > Change-Id: I07e21d4c0f3ccf11b82ee34af2668fdbb22264d2
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352360
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Reviewed-by: Ömer Ağacan <omersa@google.com>
> > Reviewed-by: Nate Bosch <nbosch@google.com>
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Commit-Queue: Lasse Nielsen <lrn@google.com>
>
> Change-Id: I360b4347470a0bb2b63c3108e2b83ee2a771bf3f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362020
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Ömer Ağacan <omersa@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: William Hesse <whesse@google.com>

CoreLibraryReviewExempt: Reland
Change-Id: I53db40edc0733842a008839c3913d51c885e39ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362502
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-04-26 15:28:26 +00:00
Alexander Markov 9b07891e4f [vm] Unsound mode cleanup: disallow reading legacy types from kernel
TEST=ci

Change-Id: Ia4fb1dc04b5ed3dce04ba9455575836bbb5aec35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364560
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-26 13:58:27 +00:00
Vyacheslav Egorov b0535bddd6 [vm] Add pragma vm:unsafe:no-bounds-checks
This pragma instructs compiler to remove all bounds checks from the
annotated function. This can be helpful when tuning performance of
hot tight loops where compiler is unable to eliminate bounds check
itself.

For very tight loops I have measured 25-50% overhead from bounds
checks which I think comes from some combination of general code
quality issues due to fixed input registers and increased branch
density.

In future it could be possible to teach our range analysis to
eliminate bounds checks when loop bound is itself bounded by
array length, but for now we can resort to this pragma for
extremely hot library code.

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

TEST=vm/cc/BoundsCheckElimination_Pragma
R=alexmarkov@google.com

Change-Id: Ia7b1e88a16a2b45fa8593a227a4985568892b29c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364500
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-04-25 14:26:55 +00:00
Daco Harkes 4b66657b98 [vm/ffi] address of operator for FFI leaf calls
During FFI leaf calls, the Dart GC will not run. This means that we
can pass pointers into `TypedData` to FFI calls that take `Pointer`
arguments.

After this CL, we have three types of arguments that can flow into
`Pointer` argument in an FFI call:
* `Pointer`.
* `TypedData`: Any typed data including views.
* `_Compound`: A TypedData/Pointer and an offset in bytes.

The is only possible for `@Native external` functions, `asFunction`
does not support passing in `TypedData`. (See related GitHub issues
for discussion. TLDR: FFIgen should generate bindings without config.)

`.address` expressions on `TypedData` and `Array` elements do _not_
introduce bounds checks, even though `TypedData` and `Array` have
bounds information. E.g. `ffiNative(Uint8List(10)[20].address)` does
not throw.

Implementation details:

The CFE analyzes call-sites to `@Native external` functions. If the
arguments are `.address` expressions, it transforms the call site to
pass the compound or `TypedData`. If an additional offset needs to be
applied, the CFE constructs a new `_Compound` with the correct offset
in bytes.

The CFE then also creates a new `@Native external` function which have
`TypedData`s and `_Compound`s parameters. To avoid name clashes, these
functions are postfixed with `#` and `P`, `T`, or `C` for each Pointer
parameter.

TEST=pkg/vm/testcases/transformations/ffi/address_of_*

In the VM, `TypedData` arguments are passed as tagged values, and the
address is loaded inside the `FfiCallInstr`. `_Compound` arguments
turn into two IL definitions, one for the `TypedDataBase` (tagged),
and one for the offset in bytes (unboxed). The address is then loaded
inside the `FfiCallInstr` and the offset in bytes is applied.

Adding the offset in bytes required an extra temp register for ia32.
Also, it uncovered that the temp register in arm32 was conflicting
with the argument registers. However, TMP should suffice instead.

TEST=tests/ffi/address_of_array_generated_test.dart
TEST=tests/ffi/address_of_struct_generated_test.dart
TEST=tests/ffi/address_of_typeddata_generated_test.dart

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

CoreLibraryReviewExempt: VM only, unsupported in dart2wasm
Change-Id: I01fb428cfd6f9096a34689c2819c124a8003cb6b
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360882
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-04-25 10:06:16 +00:00
Ben Konyi ec34e34d12 [ VM ] Remove hard coded line and token numbers from JSON_JSONStream_DartObject
Fixes https://github.com/dart-lang/sdk/issues/51389

TEST=json_test.cc

Change-Id: I303c5981d8fd43d82e2498410f6d2abc6b3f5bc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364221
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-04-24 14:44:28 +00:00
Vyacheslav Egorov d801cb4f19 [vm] Fix pragma vm:unsafe:no-interrupts
It was not removing all CheckStackOverflow instructions.

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

TEST=vm/cc/CheckStackOverflowElimination_NoInterruptsPragma

Change-Id: I1a3db6539951ab4b6450804393c89bc6aafff5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364324
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-04-24 14:17:30 +00:00
Daco Harkes c42fd69433 [gardening] Skip test in iso-stress
Closes: https://github.com/dart-lang/sdk/issues/55554
Change-Id: I2ca3ecab0d0f985fb1aa50aa12ded52469d08d8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364323
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-04-24 11:00:07 +00:00
Vyacheslav Egorov 2a2781edff [vm] Add vm:align-loops pragma
This pragma forces compiler to align loop headers within the
function by architecture specific boundary: 32 bytes on X64
and ARM64 (with the exception of Apple Silicon, which explicitly
discourages aligning branch targets in the optimization manual).

Current implementation is rather naive and does not do any
attempt to decide whether aligning is actually profitable
based on loop body itself.

I have found this pragma to be helpful both to stabilize
benchmark results and achieve better performance
for tight loops on Intel hardware.

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

TEST=vm/dart/align_loops_test

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-aot-win-product-x64-try,vm-aot-win-release-arm64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try
Change-Id: Ic22fb90d85e7fdebeeaa3908a43328c59436ab58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364121
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-04-24 08:52:18 +00:00
Alexander Markov c04da2f81f [vm/compiler] Avoid load forwarding for weak fields
TEST=runtime/tests/vm/dart/weak_field_load_forwarding_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/55518

Change-Id: I4576b25ba8f88fe5bb1bd319baa5980fe22cccce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364201
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-23 22:01:13 +00:00
Jason Simmons ced6074176 Add missing zlib dependency to the gen_snapshot build rules
Required for moving zlib out of the Flutter buildroot
(see https://github.com/flutter/flutter/issues/146598)

TEST=build

Change-Id: I8143ced85c1f4eeb011d985550cff8956e165417
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364163
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2024-04-23 21:31:03 +00:00
Ben Konyi 6bce6c2c4a [ CLI ] Add 'development-service' to the list of known DartDev commands in the VM
TEST=N/A

Change-Id: I0487b03e480edd19647f36ef18a7fd35ead0a01a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364220
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-04-23 19:13:44 +00:00
Ryan Macnak ce99413b5d [vm] Inform the profiler we're not running Dart code when calling out to memmove etc.
Otherwise the profiler may misinterpret a C frame as a Dart frame, and crash if the C frame has optimized away frame pointers.

TEST=profiler_memmove_test
Bug: https://github.com/dart-lang/sdk/issues/55537
Change-Id: Idb53804cea78e15f12e893a46be812aa8702c94b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363962
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-04-23 17:35:09 +00:00