Commit Graph

1978 Commits

Author SHA1 Message Date
Ivan Inozemtsev 9c88769967 Dartdev cross compilation support
- Add `target-arch` option to `dart compile exe|aot-snapshot`
- Add artifacts cache in `~/.dart`, and download gen_snapshot and
  dartaotruntime from cloud storage if necessary

I've manually built an aot snapshot and exe on macOS ARM64 for Linux
X64, copied them over to a linux machine, and made sure they work.

Change-Id: I74dd581ecb573ff4069a2fe19f9d04aaa352538e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417801
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-02 08:14:28 -07:00
Ryan Macnak 0d46393ee7 [vm, compiler] Handle constant null input to MemoryCopyInstr.
TEST=vm/dart/regress_60391_test
Bug: https://github.com/dart-lang/sdk/issues/60391
Change-Id: I46cb09a685e4b4382d586bac8f538ba2f5b1a593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417482
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-03-25 09:42:20 -07:00
Alexander Markov 8e1c0bce3d [vm,compiler] Fix incorrect handling of unwrapped phi in constant propagation
When constant propagation evaluates EqualityCompare or StrictCompare,
it can unwrap phis (if they are redundant wrt current set of reachable
blocks), and calculate value if both lhs and rhs operands are the same.

Previously, phi was marked as unwrapped only if that calculation changes
the constant value of comparison.

This is not correct as calculation based on unwrapped phi
needs to be invalidated anyway if more reachable blocks are discovered
and unwrapped phi becomes non-redundant.

The fix is to mark the unwrapped phis regardless of whether the constant
value of comparison has been changed or not.

TEST=vm/dart/regress_60349_test

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

Change-Id: I01e46d6def67fdc5d4c0bdc3a73aaac94725e221
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417021
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-03-20 10:20:31 -07:00
Ryan Macnak 7fbec00895 [vm, simarm64] Handle FFI callouts.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/60204
Change-Id: I2a7546cea0886b05873dbc59f5c9f049aad963c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411960
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-03-04 09:38:00 -08:00
Lasse R.H. Nielsen aab7621900 Remove some multitest runtime-tests.
Change-Id: I8fb69fecbe67236a4cbad9c1eb899a31a26a1ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410002
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-02-19 04:21:42 -08:00
Ryan Macnak 12be1f79d2 [vm] Test active mutator stealing works with dart:concurrent locks.
- Add Monitor.notifyAll.
 - Refactor Mutex.runLocked to unlock if interrupted by unwind error.
 - Fix skipped DLRT_ExitHandleScope during an unwind error.

TEST=vm/dart/isolates/many_isolates_blocked_at_monitor_test
Bug: https://github.com/dart-lang/sdk/issues/55991
CoreLibraryReviewExempt: VM-only experimental library
Change-Id: I7a37544436e22158e45ee44567600fcf7ff7d7b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409561
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-02-18 10:33:14 -08:00
Martin Kustermann 23cac7c840 [gardening] Make more robust test for mutator bit stealing mechanism
We also disable the test in hotreload mode, because threads that are
stuck in ffi calls don't participate in hot-reload requests.

This is something we may want to look into. Right now it's conservative in
the sense that if an embedder did a `Dart_LookupClass()` in such a ffi call
and then a reload happened, such a handle would possibly hold pointer to
an old class object and weird things may happen.

This fixes test failures in hot reload / rollback mode of

  `vm/dart/isolates/many_isolates_blocked_at_ffi_test`

and also make it more robust.

TEST=tests/ffi/dl_api_exit_enter_isolate_test

Change-Id: I823d07a6ab04e62e051e4d22ec80cbc3649762a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409100
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-02-13 01:19:14 -08:00
Robert Nystrom 3f0dc30379 Remove deleted language test from VM stress test list.
Change-Id: I45b5c58cc040fa0624de4c3643ccafe2d4b26071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409183
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-02-11 20:27:02 -08:00
Liam Appelbe cb02b8726a [vm] Isolate ownership API
go/dart-isolate-ownership-api

Change-Id: Ia778a916de3fecec9f0aa1a5c8bc9fd7dd421267
Bug: https://github.com/dart-lang/native/issues/1908
TEST=runtime/vm/dart_api_impl_test.cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2025-02-11 20:09:11 -08:00
asiva b1e10bff4f [gardening] Remove deleted test from stress test configuration.
TEST=vm/dart/isolates/concurrency_stress_sanity_test

Change-Id: I3648e58dd301578b44f2dfd5981e892dd377985b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409184
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-02-11 17:25:36 -08:00
Martin Kustermann e072cdb204 [vm] Add test to ensure class hierarchy is present in output of analyze_snapshot
go/dart-ama

Change-Id: I533ca49d0e27a59f2f2763cc14c69485a470c281
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408561
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-02-11 11:40:24 -08:00
Ryan Macnak 2a08770912 [vm] If waiting for an active mutator slot for too long, steal a slot from a thread at a native safepoint.
The thread whose slot was stolen will take the slow path attempting to exit its safepoint and wait to reacquire an active mutator slot.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54687
Change-Id: I49c4c12b38d38d7afa4df6b346c2a464f75ef6e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406404
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-02-10 09:38:42 -08:00
Ryan Macnak 4617198d58 [vm] Add option for GC at [re]throw.
Add a reduced test for crash / false ConcurrentModificationError observed by the isolate stress test.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/60017
Change-Id: I665a7ec48c150d270e751ab13393384613d44674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408201
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-02-05 14:24:32 -08:00
Alexander Markov 30d6cc9394 [vm,tests] Fix vm/dart/devirtualization_during_inlining_il_test on vm-aot-optimization-level-linux-release-x64
TEST=vm/dart/devirtualization_during_inlining_il_test
Fixes https://github.com/dart-lang/sdk/issues/54940

Change-Id: If867cdcffbed32925ff40094fc112cd6b238ac97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408120
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-02-05 10:47:00 -08:00
Alexander Markov 7fd0d073a9 [vm] Cleanup experimental createUriForKernelBlob API
This API was added in https://dart-review.googlesource.com/c/sdk/+/232682
in order to support one of the strategies for running macros,
but it is no longer needed.

TEST=ci

Change-Id: I8da233932351f27fd5dfd01b66f481195d7ca0e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407540
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-02-03 12:55:53 -08:00
Tess Strickland 8e17d8b841 [gardening] Remove deleted test from stress test configuration.
TEST=vm/dart/isolates/concurrency_stress_sanity_test

Issue: https://github.com/dart-lang/sdk/issues/60031
Cq-Include-Trybots: luci.dart.try:vm-linux-release-x64-try
Change-Id: I10852f8268a8a2ab03049eccf254379324d48565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407380
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
2025-02-03 03:15:07 -08:00
Alexander Markov 6ddd96b45a [vm,compiler] Treat 'Never' return type as unreachable
When building a flow graph, break control flow (close fragment) after
a call with return type 'Never'. Append 'Stop' instruction after
the call to make sure the return address is still within function
code range.

TEST=runtime/tests/vm/dart/regress_59941_il_test.dart

Fixes https://github.com/dart-lang/sdk/issues/59941
Issue https://github.com/dart-lang/sdk/issues/56969

Change-Id: I5bbc0b9740a4f7e06b8560589daeb2b44f13d084
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405604
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-01-27 08:16:08 -08:00
Tess Strickland 1ac77f57dd [vm] Align entry point verification and the precompiler.
For entry-point pragma annotations, most of the time they are
used with either no argument or with an argument that evaluates
to either

* false to denote the annotation should not take effect, or
* null or true to denote the annotation should take effect.

However, the user can also specify that only part of the operations
on a member should be accessed from native code by using a string
argument that is either 'call', 'set', or 'get'.

The entry point verification in Invoke/InvokeGetter/InvokeSetter
assumes that for getters and setters, the only valid string argument
is 'get' or 'set', respectively. This is because those methods are
called via `Dart_GetField`[0] and `Dart_SetField`, respectively, as if
they were the getter or setter of a defined field.

However, the precompiler previously assumed that the string
argument 'call' was the only string argument that meant the link
to a function's code object should be saved. Similarly, it assumed the
string argument 'get' for functions meant that their implicit closure
function should be saved, which ends up including getters. Furthermore,
it did not do anything with setters annotated with the string argument
'set'. This means that the code link would not be saved for getters or
setters that were annotated with the string argument expected by the
entry point verifier.

This CL aligns the precompiler to match the expectations of other
parts of the codebase. It also changes TFA to report an error
if a getter or setter is marked with the string argument 'call'.

[0] `Dart_Invoke` can be called with the name of a getter that
returns a closure, but doing so is semantically equivalent to
calling `Dart_GetField` followed by `Dart_InvokeClosure`.

TEST=vm/dart/entrypoint_verification_test

Fixes: https://github.com/dart-lang/sdk/issues/59920
Change-Id: Ia2768bbaf9058bb14a1cdfb331eb85fa082a0e90
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-product-x64-try,vm-aot-mac-product-arm64-try,vm-aot-obfuscate-linux-release-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404823
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-01-24 03:21:22 -08:00
Alexander Markov 9e8e8e5fca [vm,dynamic_modules] Support members which are overridden implictly (transitively) by a dynamic module
Consider the following situation: member M1 is overridden by another
member M2; M2 is overridden in a dynamic module.

Members which can be overridden in a dynamic module (such as M2)
should be specified as 'can-be-overridden' in the dynamic interface.
Members which are overridden implicitly/transitively (such as M1)
are not required to be mentioned in the dynamic interface.
However, when determining possible targets for a call with
interface target M1, compiler should treat it as potentially
overridden in a dynamic module.

This change adds such handling to the VM/AOT. Dynamic interface
annotator now marks members such as M1 with
'dyn-module:can-be-overridden-implicitly' pragma, and
VM/AOT takes both can-be-overridden and can-be-overridden-implicitly
into account.

This change also simplifies handling of implicitly extenable classes
in the VM/AOT - now VM handles both extendable and implicitly-extendable
pragmas (from dynamic interface annotator) instead of recalculating
implicitly extendable classes on its own.

TEST=pkg/vm/test/transformations/dynamic_interface_annotator_test.dart
TEST=dynamic_modules_suite/implicitly_extendable

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

Change-Id: Id4570cc86303f8e45a061d696e9bca0d0b2b4b81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403951
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-01-15 08:13:52 -08:00
Vyacheslav Egorov 4bcd8c2b8c [vm/compiler] Prune SSA during construction using liveness
Only insert Phi at JoinEntry and Parameter at CatchBlockEntry if
corresponding variable is alive into the block. This keeps insertion
consistent with environment pruning logic employed by RenameRecursive:
which prunes dead variables out environments when entering the block
based on contents of the live_in set.

Previously we would insert Parameter instructions for dead variables
which lead to an incorrect (unsound) set of catch entry moves
generated by the backend due to an inconsistency between Parameter
insertion and environment pruning logic and the fact that
catch entry moves generator would simply ignore all moves if the
source of the move was an optimized_out (aka constant_dead) marker.

The following situation was possible: if the variable was assigned
inside the try and partially alive inside of it (e.g. we had
blocks where it was alive and blocks where it was not) then we
would end up inserting Parameter for it, but some of the exceptional
edges (corresponding to blocks where the variable was dead) would
carry optimized_out value into that Parameter. However
`CatchEntryMoveFor` would not record these moves leading to
uninitialized garbage arriving on those exceptional edges instead.

Note that Phis were not susceptible to the same issue as Parameters
because regalloc / backend would not treat optimized_out value
specially.

This change converts silent treatment of optimized_out in the
catch entry moves generation into a release assert instead.

Reviewing other uses of constant_dead in the compiler revealed
a bug in canonicalization rule for `o.runtimeType` which
did not take exceptional edges into account. We add a
regression test for that and fix that issue as well.

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

TEST=vm/dart/regress_59822,vm/dart/regress_runtime_type_in_trycatch

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try
Change-Id: I8dc397cb98d84048a1791b9dd6baa7586a2688c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403583
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-01-10 00:24:29 -08:00
Ivan Inozemtsev 735a73943d Reland "[vm] Turn on entry point checking in JIT mode."
This is a reland of commit 982b9fad44

Original change's description:
> [vm] Turn on entry point checking in JIT mode.
>
> Now that Flutter tests that access entry points from native code
> have been annotated[1], we can turn on entry point checking in JIT
> mode.
>
> This CL also removes the A flag category from flag_list.h and the
> AOT_FLAG_MACRO definitions and uses from flags.[cc,h], as they were
> created as a temporary measure until this flag could be unconditionally
> defaulted to true.
>
> [1] See the following PRs:
> * https://github.com/flutter/engine/pull/57158
> * https://github.com/flutter/flutter/pull/160158
> * https://github.com/flutter/flutter/pull/160421
>
> TEST=vm/dart/entrypoints_verification_test vm/cc/IRTest
>      vm/cc/StreamingFlowGraphBuilder vm/cc/STC vm/cc/TTS
>
> Issue: https://github.com/dart-lang/sdk/issues/50649
> Issue: https://github.com/flutter/flutter/issues/118608
>
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try
> Change-Id: Ibe5b21bb74f1a6fb88824b71ff87b9e555216dbf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400301
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

TEST=vm/dart/entrypoints_verification_test vm/cc/IRTest
     vm/cc/StreamingFlowGraphBuilder vm/cc/STC vm/cc/TTS

Change-Id: Ibd5f362f908b4aaa68cda870a387c081537bbc16
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403360
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-01-08 00:26:40 -08:00
Gabriel Terwesten 5c1796f4e0 [vm,ffi] Avoid linking test DLLs to dart.exe
The `ffi_test_functions` shared library needs to access functions from
`dart_api.h` and `dart_native_api.h`, which are only available in
the Dart executable.

UNIX shared libraries can have undefined symbols, which are resolved at
runtime and can be found in the loading executable. Windows DLLs cannot
have undefined symbols, but they can be dynamically linked to an
executable (in this case `dart.exe`). This requires the DLL to be able
to find the executable at runtime.

A better solution is to include implementations for the Dart APIs in the
DLL itself, that use `GetModuleHandle(NULL)` to get a handle to the
executable and `GetProcAddress` to get the address of the function.

This is what `dart_api_win.c` does.

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

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-win-release-ia32-try,vm-win-debug-x64c-try,vm-win-debug-x64-try,vm-win-debug-arm64-try,vm-msvc-windows-try,vm-aot-win-debug-x64c-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,dart-sdk-win-try,dart-sdk-win-arm64-try

Change-Id: I7f971a8ce21e03d18ed2967e74998f925c9236b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400582
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-01-07 08:15:39 -08:00
Alexander Markov ce8a8b29b6 [vm,compiler] Recalculate loops when aligning loop headers
Loop information may be outdated by the time code is generated
(for example, if flow graph is serialized/deserialized).

Recalculate loop information during code generation if it is needed
in order to align loop headers.

TEST=vm/dart/align_loops_verify_alignment_test

Change-Id: I1edd63354cee9940bbd474dc95535b4b74081830
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401863
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-12-20 05:49:02 -08:00
Alexander Markov da257d2766 [vm,compiler] Support SIMD constants in IL serialization
TEST=vm/dart/isolates/fast_object_copy2_test

Change-Id: I934d92f54f9ab51bbdd42edd90588d404bc9be37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401920
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-12-19 10:41:40 -08:00
Ivan Inozemtsev 3ba5bd0f39 Revert "[vm] Turn on entry point checking in JIT mode."
This reverts commit 982b9fad44.

Reason for revert: b/385114574

Original change's description:
> [vm] Turn on entry point checking in JIT mode.
>
> Now that Flutter tests that access entry points from native code
> have been annotated[1], we can turn on entry point checking in JIT
> mode.
>
> This CL also removes the A flag category from flag_list.h and the
> AOT_FLAG_MACRO definitions and uses from flags.[cc,h], as they were
> created as a temporary measure until this flag could be unconditionally
> defaulted to true.
>
> [1] See the following PRs:
> * https://github.com/flutter/engine/pull/57158
> * https://github.com/flutter/flutter/pull/160158
> * https://github.com/flutter/flutter/pull/160421
>
> TEST=vm/dart/entrypoints_verification_test vm/cc/IRTest
>      vm/cc/StreamingFlowGraphBuilder vm/cc/STC vm/cc/TTS
>
> Issue: https://github.com/dart-lang/sdk/issues/50649
> Issue: https://github.com/flutter/flutter/issues/118608
>
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try
> Change-Id: Ibe5b21bb74f1a6fb88824b71ff87b9e555216dbf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400301
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

Issue: https://github.com/dart-lang/sdk/issues/50649
Issue: https://github.com/flutter/flutter/issues/118608
Change-Id: Id403cd0832807e417202e17dac57c2224cab09e7
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401880
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2024-12-19 09:06:24 -08:00
Alexander Markov 6abaa310e0 [vm,compiler] Cleanup catch entries from GraphEntry and fix IL serialization
After https://dart-review.googlesource.com/c/sdk/+/356311,
GraphEntryInstr::catch_entries() is no longer needed and can be replaced
with FlowGraph::try_entries().

This change also fixes crash during IL deserialization if flow graph
contains a catch block.

TEST=vm/dart/checked_parameter_assert_assignable_stacktrace_test

Change-Id: Iad398e142bbd00110457e3b121bd446c32a5ac46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401860
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-12-19 08:04:08 -08:00
Vyacheslav Egorov f1394aa2db [vm] Fix unwinding through FutureIterable and FutureRecordN wait
Add awaiter-links leading from callbacks attached to
the original Futures to Completer produced by wait.

This requires changing representation of _FutureResult
slightly because we do not support annotating arbitrary
fields as awaiter-links only variables can be annotated

Thus we need to capture onReady callback in a the context of
closures passed to Future.then.

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

TEST=pkg/vm_service/test/pause_on_unhandled_exceptions_future_extensions_test.dart,runtime/tests/vm/dart/awaiter_stacks/async_stacks_test.dart

CoreLibraryReviewExempt: No API or significant implementation changes
Change-Id: I904b441b27c4e06f08b7ea7ba066a2fb03504ce6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401062
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-12-18 11:39:40 -08:00
Alexander Aprelev 4093bdaf5a [vm] Change try-catch IL representation.
Previously catch blocks were hanging off the function entry blocks being effectively an alternative entry-point into the function. Now catch blocks are hanging off the try-entry blocks.
  Previously all the variables that are used in the catch block and beyond were declared as parameters to catch block. Now only those that have their definitions not dominating catch entry will become parameters (for example, if a variable is assigned in the try-block, it becomes a parameter to catch block).
  During OSR, if OSR target entry point is inside some try-blocks, then all of corresponding try-entry/catch-blocks are pulled up to the OSR entry forming a chain that ends with a jump to the OSR target entry.

TEST=vm/dart/trycatch*, ci
Change-Id: Iae20c6548d5d65c63be6d7a53c1b0d2adac7ac31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356311
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-12-18 09:30:10 -08:00
Tess Strickland 982b9fad44 [vm] Turn on entry point checking in JIT mode.
Now that Flutter tests that access entry points from native code
have been annotated[1], we can turn on entry point checking in JIT
mode.

This CL also removes the A flag category from flag_list.h and the
AOT_FLAG_MACRO definitions and uses from flags.[cc,h], as they were
created as a temporary measure until this flag could be unconditionally
defaulted to true.

[1] See the following PRs:
* https://github.com/flutter/engine/pull/57158
* https://github.com/flutter/flutter/pull/160158
* https://github.com/flutter/flutter/pull/160421

TEST=vm/dart/entrypoints_verification_test vm/cc/IRTest
     vm/cc/StreamingFlowGraphBuilder vm/cc/STC vm/cc/TTS

Issue: https://github.com/dart-lang/sdk/issues/50649
Issue: https://github.com/flutter/flutter/issues/118608

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try
Change-Id: Ibe5b21bb74f1a6fb88824b71ff87b9e555216dbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400301
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-12-18 03:42:55 -08:00
Robert Nystrom 96d18bae05 Reformat tests/language/assign/.
Change-Id: I3be46d802ac851b4fca7ddf4100b04f8d4a38f9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399880
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2024-12-13 10:52:25 -08:00
Robert Nystrom b3f839bda6 Remove deleted language tests from VM stress test.
BUG=59713

Change-Id: I977f9001e822d0f4037efde8f505ab04916a8509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400500
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-12-12 18:35:31 -08:00
Alexander Aprelev cd7b1342bd [gardening] Cleanup stress test list.
Follow-up to https://github.com/dart-lang/sdk/commit/1d684cdfb0277ee2848571645bc72cf7cc0843a4 which deleted the test.

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

Change-Id: I11ddaacf75af2234e6228f80f569b47d3f3b9490
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400360
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2024-12-12 08:38:48 -08:00
Alexander Aprelev e4f7f4f6b4 [gardening] Fix stress test list.
Follow-up to https://github.com/dart-lang/sdk/commit/752a9134266e2c874711f83e9b039a1df8f46323 which deleted some tests.

Change-Id: Ic75ac76fddf41b790381a9be1c8a90aa6ec10e9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400149
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2024-12-11 20:19:09 -08:00
Ryan Macnak 322baef3e1 [io] Exit the isolate during Process.runSync and sleep.
This prevents such an isolate from occupying one of the limited number of mutator slots and blocking other isolates in the same group from running.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51254
Bug: https://github.com/dart-lang/sdk/issues/54687
Bug: https://github.com/dart-lang/sdk/issues/57119
Change-Id: Ic04bbaa7f482d533ad0ecf2c6da17ea9f00c264e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398927
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-12-05 00:16:38 +00:00
Tess Strickland 9b06e26620 Reland "[vm] Enforce that entry points must be annotated by default."
This is a reland of commit cb9ecbc363

This reland only turns on the entry point verification flag by
default in AOT mode. After Flutter tests that use native access
in JIT mode have been appropriately updated, a followup CL will
turn this flag on by default in JIT mode as well.

Original change's description:
> [vm] Enforce that entry points must be annotated by default.
>
> Changes the default value of the --verify-entry-points flag
> to true.
>
> Changes the default value for the check_is_entrypoint argument to
> to the Invoke/InvokeGetter/InvokeSetter flags to true. The mirrors
> library implementation and calls via vm-service explicitly pass
> false for this argument now.
>
> Add annotations as needed, such as annotating classes with
> annotated generative constructors. In some cases, the annotations
> were more general than needed (e.g., annotating with a no-argument
> entry point annotation when only the setter is needed), so make
> those annotations more specific.
>
> As this pattern is already common in downstream code, allow
> Dart_Invoke on fields as long as the field is annotated for getter
> access. (That is, calling Dart_Invoke for a field is equivalent to
> retrieving the closure value via Dart_GetField and then calling
> Dart_InvokeClosure.)
>
> TEST=vm/cc/DartAPI_MissingEntryPoints
>      vm/dart/entrypoints_verification_test
>
> Issue: https://github.com/dart-lang/sdk/issues/50649
> Issue: https://github.com/flutter/flutter/issues/118608
>
> Change-Id: Ibb3bf15632ab2958d8791b449af8651d47f871a5
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
> CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363566
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

TEST=vm/cc/DartAPI_MissingEntryPoints
     vm/dart/entrypoints_verification_test

Change-Id: I24919c32ab4760c7c5435c378879791086256f02
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,flutter-linux-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try
CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391620
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-12-04 14:36:46 +00:00
Martin Kustermann 4eca32f6a6 [gardening] Remove deleted tests from iso stress builder test list
Change-Id: Ib50cd380e74da8187671b2ca6d0cf62bb689ad4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398200
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-11-29 16:48:19 +00:00
Ryan Macnak c67598f54c [vm, compiler] Don't use MayBeSameAsFirstInput for smi srl.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/59611
Change-Id: I6a41e690e048163eaa71a02924a6c942e9fdc93b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397641
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-11-27 17:45:59 +00:00
Ryan Macnak e2b7ec229d [vm] Try to expose data races to rr by simulating a store buffer.
TEST=ci
Change-Id: I3fc7c27a8aba5c2eeb1de6d01e9156535e767d6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393621
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-11-26 19:24:31 +00:00
Ryan Macnak c42b74db6f [gardening] Fix or mark some slow tests.
TEST=ci
Change-Id: Ic453ec3583dd912374f88d53434a1b42ff3f364d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396662
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-11-20 20:38:58 +00:00
Ryan Macnak 91746d112b [vm, compiler] Add binary op reductions for the reflexive case.
TEST=vm/dart/binary_op_reductions_il_test
Change-Id: Ice3f4e40db670f29f466d4f0ae85bac46b6fae20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392161
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-11-20 18:24:26 +00:00
Ryan Macnak 651bde574b [vm, compiler] Implement MathMinMaxInstr with min/max when available.
TEST=vm/dart/min_max_test
Change-Id: I727a421d8c38261effdf3b09dbd4fd9330693f82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394800
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-11-19 17:08:28 +00:00
Alexander Markov f3d8167443 [vm/compiler] Do not convert null-aware int? equality to IfThenElse
IfThenElse instruction expects a simple Smi comparison and it doesn't
support null-aware int? comparison (although it uses the same kTagged
representation).

TEST=runtime/tests/vm/dart/regress_b378737064_test.dart
Fixes b/378737064

Change-Id: Iaf9243ff5505b986bbfe4510834972e75869dc61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394570
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-12 22:40:28 +00:00
Alexander Markov 0ca1ff2281 [vm/compiler] Support int32, uint32 unboxed representations in comparisons
TEST=runtime/tests/vm/dart/multiple_uint32_comparisons_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/56839

Change-Id: Ib4e0372e8def991d34b6b045d3acf62839296443
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393905
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-11-11 14:17:09 +00:00
Jens Johansen a9469269d7 [kernel] BinaryReader takes Uint8List, not List<int>
In AOT this makes reading faster:

Output from `out/ReleaseX64/dart pkg/front_end/tool/benchmarker.dart --iterations=10 --snapshot=pkg/front_end/test/kernel_binary_bench.aot.1 --snapshot=pkg/front_end/test/kernel_binary_bench.aot.2 --arguments="--warmups=10" --arguments="--iterations=5" --arguments="AstFromBinaryEager" --arguments="out/ReleaseX64/vm_platform_strong.dill"`:

```
msec task-clock:u: -8.6925% +/- 0.5737% (-167.09 +/- 11.03)
page-faults:u: 0.1410% +/- 0.0051% (243.00 +/- 8.71)
cycles:u: -10.2918% +/- 0.6161% (-732576747.50 +/- 43853449.16)
instructions:u: -14.4988% +/- 0.0004% (-1636799813.90 +/- 39902.18)
branch-misses:u: -3.4891% +/- 2.1142% (-1166085.00 +/- 706582.35)
seconds time elapsed: -8.7005% +/- 0.5634% (-0.17 +/- 0.01)
seconds user: -9.9752% +/- 1.5104% (-0.17 +/- 0.03)
```

Stats running manually (run as e.g. `out/ReleaseX64/dart-sdk/bin/dartaotruntime pkg/front_end/test/kernel_binary_bench.aot.1 --warmups=10 --iterations=5 AstFromBinaryEager out/ReleaseX64/vm_platform_strong.dill`):

```
AstFromBinaryEagerCold: -12.5174% +/- 3.10688%
AstFromBinaryEagerWarmup: -8.33675% +/- 2.62433%
AstFromBinaryEager: -10.3432% +/- 3.68375%
```

I don't expect there to be much of a change (if any) in JIT as the actual type was in practise always Uint8List anyway.

TEST=Existing tests.

Change-Id: I86b16ed207343848dee2e376f42598c223bbc48f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393740
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-11-08 08:23:42 +00:00
asiva 8b2b6b2440 Reland ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
This reverts commit 74c5aa3a7a.

Reason for revert: Fix golem breakage by not changing the script dart_precompiled_runtime2

TEST=ci

Original change's description:
> Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
>
> This reverts commit f81a402aa1.
>
> Reason for revert: golem benchmarks are failing to run
>
> TEST=ci
>
> Original change's description:
> > "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
> >
> > This reverts commit 75e6a748f7.
> >
> > TEST=ci
> >

Change-Id: I9efe40643c59bc617f6fb484b89b038deaffbb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393941
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-11-08 04:36:23 +00:00
Alexander Markov 9645a7114c [vm/compiler] Simplify code generation of comparisons by moving constant operands to the right
TEST=ci

Change-Id: Ifa17f11ca297de9da733dffc132ade498c9e0f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393604
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-11-06 13:58:40 +00:00
Siva Annamalai 74c5aa3a7a Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
This reverts commit f81a402aa1.

Reason for revert: golem benchmarks are failing to run

TEST=ci

Original change's description:
> "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
>
> This reverts commit 75e6a748f7.
>
> TEST=ci
>
> Original change's description:
> > Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > This reverts commit 1b331d05c2.
> >
> > Reason for revert: golem builds are failing
> >
> > Original change's description:
> > > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> > >
> > > TEST=ci
> > >
>
> Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Iec494940412aa31dbefdc5280e35ae99e8cecb26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393764
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-11-06 05:37:46 +00:00
asiva f81a402aa1 "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime

This reverts commit 75e6a748f7.

TEST=ci

Original change's description:
> Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> This reverts commit 1b331d05c2.
>
> Reason for revert: golem builds are failing
>
> Original change's description:
> > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> >
> > TEST=ci
> >

Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-06 03:10:31 +00:00
Siva Annamalai 75e6a748f7 Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
This reverts commit 1b331d05c2.

Reason for revert: golem builds are failing

Original change's description:
> [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
>
> TEST=ci
>
> Change-Id: I96ed52994e0d955300c18026032e68003504666d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Change-Id: I5dc14973f4ee4e577b2c996839d5e497c97fb440
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393761
Commit-Queue: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-05 21:58:09 +00:00
asiva 1b331d05c2 [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
TEST=ci

Change-Id: I96ed52994e0d955300c18026032e68003504666d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-11-05 20:39:15 +00:00