Commit graph

21258 commits

Author SHA1 Message Date
Ryan Macnak 7fd8d79e91 [vm, compiler] Assert against using CSP as the source/destination register for ld[x]r/st[x]r.
Fix simulator misinterpreting R31 for ldxr/stxr.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54703
Change-Id: I21d1d60f61928c766c2854024cce36e93f7fb665
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348041
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-24 01:06:28 +00:00
Derek Xu 4a82018d88 Revert "[VM/Debugger] Ignore optimized out variables when building scope in ActivationFrame::BuildParameters"
This reverts commit e727f4ecbd.

Reason for revert: breaks some tests in debug mode

Original change's description:
> [VM/Debugger] Ignore optimized out variables when building scope in ActivationFrame::BuildParameters
>
> TEST=pkg/vm_service/test/evaluate_optimized_out_variable_test.dart
>
> Issue: https://github.com/dart-lang/sdk/issues/53996
> Change-Id: I5e6f0b2c02455af73c2108e6996039c95d3f1f31
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347940
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Issue: https://github.com/dart-lang/sdk/issues/53996
Change-Id: I0d5c94b206ea31e82240f17e9304bec1b01e3580
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347942
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-01-23 21:17:57 +00:00
Derek Xu e727f4ecbd [VM/Debugger] Ignore optimized out variables when building scope in ActivationFrame::BuildParameters
TEST=pkg/vm_service/test/evaluate_optimized_out_variable_test.dart

Issue: https://github.com/dart-lang/sdk/issues/53996
Change-Id: I5e6f0b2c02455af73c2108e6996039c95d3f1f31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347940
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-01-23 20:12:42 +00:00
Daco Harkes b5fb90614a [vm/ffi] Remove reachability fence on Pointers in FFI calls
These fences were added before we decided that (1) `NativeFinalizer`s
are only attached to `Finalizable`s and (2) `Finalizer`s do not have
a guarantee against premature finalization.

Now that we're inlining, we should avoid allocating the `Pointer`
object.

TEST=Should be a no-op, running a bunch of bots just in case.

Closes: https://github.com/dart-lang/sdk/issues/54680
Change-Id: I3b2702d910c8ed53a3f3fcbf0e6f437d1b8026c5
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-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-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347740
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-01-22 22:01:35 +00:00
Alexander Markov 3545ce4966 [vm] Build elf_loader and crashpad with correct TARGET_OS
Previously they were built with TARGET_OS_FUCHSIA regardless of target OS.

TEST=ci

Change-Id: I53e95bb61c3926334e861ed56ceb3ea018e7bf1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347202
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-01-22 18:12:41 +00:00
Alexander Aprelev 84b38aee39 [vm/debugger] Use safepoint-safe RwLock for breakpoint locations locks.
Fixes https://github.com/dart-lang/sdk/issues/54650
TEST=DartAPI_BreakpointLockRace

Change-Id: I83b5be80d66ad30c46ea99de08ce7a8d70182414
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347420
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-01-22 16:07:39 +00:00
Parker Lougheed eb5c77e7c2 [sdk] Mark dart:developer APIs with since information
Without the since information added, packages can use these APIs despite their SDK constraints potentially allowing SDK versions without them. For example, in package:leak_tracker recently: https://github.com/dart-lang/leak_tracker/issues/201.

I only added Since information to APIs added since Dart 2.12 since that's the lowest relevant SDK constraint with sound null safety.

TEST=ci

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try
CoreLibraryReviewExempt: This CL does not change any APIs or their implementation, only adding relevant Since documentation to support correct triggering of the sdk_version_since diagnostic.
Change-Id: I27613ebf745f084a3056b8ffd2542221d939a838
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346200
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2024-01-22 14:58:12 +00:00
Oleh Prypin 5a1ef6089c Revert "[ffi]: Remove pointer elementAt method."
This reverts commit f706ff4ee2.

Reason for revert: b/321667799 - package:win32 uses this method - a78ff108fb/lib/src/com/iapplicationactivationmanager.dart (L46)

Original change's description:
> [ffi]: Remove pointer elementAt method.
>
> Closes #54250
>
> TEST=test/ffi
>
> R=dacoharkes@google.com
> Change-Id: I0e88adfcfe3caef0ad3bb6814ad8f27dce5dc7f4
> CoreLibraryReviewExempt: FFI only
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346380
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Auto-Submit: Shikhar <shikharish05@gmail.com>

Change-Id: I1b7a48d14e9b85676a27f76a926e21cac9c76c85
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347600
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-22 12:20:48 +00:00
Shikhar Soni f706ff4ee2 [ffi]: Remove pointer elementAt method.
Closes #54250

TEST=test/ffi

R=dacoharkes@google.com
Change-Id: I0e88adfcfe3caef0ad3bb6814ad8f27dce5dc7f4
CoreLibraryReviewExempt: FFI only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346380
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Shikhar <shikharish05@gmail.com>
2024-01-22 11:34:18 +00:00
Johnni Winther 8a2f6495b3 [cfe] Add isImplicitCall to DynamicInvocation
This adds an ìsImplicitCall to DynamicInvocation which is set on
expression like `d()` where `d` has type dynamic, to distinguish
the for `d.call()`.

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

Change-Id: I73beb911bdb315a510c862e6d4876cf7673ec3c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346240
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-01-19 08:39:30 +00:00
Ryan Macnak 6872314c66 [vm] Cleanup old TODO.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/42473
Change-Id: I2aca5b3a859ec7d1b719211734a2f41ef387be30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347180
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-18 22:56:40 +00:00
Alexander Markov 71ffaf392f [vm] Fix cross-build Windows -> android
TEST=ci
Fixes https://github.com/flutter/flutter/issues/141786

Change-Id: I9c6620b8ee25e36631da2b1213002e8bf30b6473
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347065
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-01-18 21:22:59 +00:00
Alexander Markov 4266f780bd Reland "[vm/aot/tfa] Analyze function calls"
This is a reland of commit 66d3eedb33

g3 breakage was fixed in https://dart-review.googlesource.com/c/sdk/+/346940.

Original change's description:
> [vm/aot/tfa] Analyze function calls
>
> This change adds analysis of function calls when closure target
> of a call can be inferred. Local functions are now analyzed separately
> from enclosing members. Inferred result type of function calls is now
> used in the AOT compiler.
>
> Time of AOT compilation step 2 (TFA) on a large Flutter application:
> Before: 59.448s
> After: 61.870s (+4%)
>
> Maintaining hierarchy of function types and analysis of all function
> calls is not feasible as it causes unbearable increase in AOT
> compilation time.

TEST=existing
Issue: https://github.com/dart-lang/sdk/issues/39692

> Change-Id: Ieb4d5dce23868b5ab5c87fa1e77e49b85fd656fe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345083
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I05377121ffa7e56748c8a5ab58551e2b1caef70b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346946
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-01-18 08:48:37 +00:00
Daco Harkes fb8f06baef [vm] Fix g3
Follow-up to https://dart-review.googlesource.com/c/sdk/+/346940.
Follow up to https://dart-review.googlesource.com/c/sdk/+/346907.

TEST=ci
Fixes b/320789794

Change-Id: I82e52a651174d9a84cd05995383255a01257f556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346961
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-18 08:44:22 +00:00
Alexander Markov 6ce0341f60 [vm] Fix build on vm-ffi-qemu-linux-release-arm bot
Follow-up to https://dart-review.googlesource.com/c/sdk/+/346940.

TEST=ci
Fixes b/320789794

Change-Id: I4440f06b82f92594749540c715801f71fe90759d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346907
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2024-01-18 07:33:38 +00:00
Alexander Markov 5230995e3a [vm] Fix unwinding records on Windows
This change fixes the following 2 bugs related to unwinding records
on Windows:

1) When cross-compiling from another OS to Windows, unwinding records
   were not added to the end of the code section. Later, when loading
   AOT snapshot, arbitrary bytes at the end of the code section were
   used as the unwinding data, which could result in the errors
   returned from Windows API calls.

2) When code section is mapped, its size was rounded up to the page
   size; when looking for unwinding record, size of the unwinding
   record was subtracted from the rounded size. This is not correct
   as unwinding record is placed right at the end of code section,
   so code section size should be used before rounding.

Also, magic value is added to the unwinding record in order to
verify that it is preserved and correctly found.

TEST=Manually tested repro from b/320642692
TEST=ffi/ffi_induce_a_crash_test

Fixes b/320642692
Fixes https://github.com/dart-lang/sdk/issues/54206

Change-Id: Id0c6413cd1b759da9e9f25f7617eef55f33b04a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346940
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-01-18 01:09:49 +00:00
asiva c539f57b00 [VM/vm_service] Fix for https://github.com/dart-lang/sdk/issues/54641
- Skip stdio_newline_test in AOT mode
- Fix capture_stdio_test and dds_stdout_stderr_history tests under the
  observatory directory to account for the new line fix.

TEST=ci

Bug:54641
Change-Id: Ic5403ab30a1367e4ec9e6798545837813f8f1060
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346685
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-01-17 19:19:23 +00:00
Ryan Macnak d5104d978d [vm, gc] Defer marking of SuspendState.
SuspendState changes shape on suspend and resume as new PCs change which StackMap is used to interpret the saved frame area. Shape changes are not compatible with concurrent marking because they can cause the concurrent marker to misinterpret a non-pointer as a pointer.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54410
Change-Id: I5ec35b812a4e94a2bae2628a8914f6d05116dbc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346620
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-17 17:36:08 +00:00
Tess Strickland 743c0c862c [vm] Revert caching of default type arguments within closure.
Since we already cache instantiation of type argument vectors to avoid
runtime calls as long as the cache has room, remove the default
type arguments field from Closure objects. Instead, just perform any
needed instantiation when the default type arguments are needed
using the instantiator and parent function type arguments stored
in the closure.

Also rename DefaultTypeArgumentsKind to InstantiationMode and
generalize the calculations to determine how to instantiate default
type arguments to an operation that can be performed on type arguments
in general.

TEST=ci

Fixes: https://github.com/dart-lang/sdk/issues/54589
Issue: https://github.com/dart-lang/sdk/issues/54564
Change-Id: I704ea4244fb10cbc08175629c8e92cf05b8aabea
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-arm64-try,vm-aot-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-tsan-linux-release-x64-try,vm-aot-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346021
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-01-17 14:36:48 +00:00
Ryan Macnak 58bf203064 [VM] Add support for allocation tracing in AOT
TEST=Manual
Bug: https://github.com/dart-lang/sdk/issues/51234
Change-Id: I4ab75bb85898a41dfb091b38402711170fd3b972
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271420
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-01-17 13:50:49 +00:00
Emmanuel Pellereau c111a1346e Revert "[vm/aot/tfa] Analyze function calls"
This reverts commit 66d3eedb33.

Reason for revert: breaks google3 (b/320642692)

Original change's description:
> [vm/aot/tfa] Analyze function calls
>
> This change adds analysis of function calls when closure target
> of a call can be inferred. Local functions are now analyzed separately
> from enclosing members. Inferred result type of function calls is now
> used in the AOT compiler.
>
> Time of AOT compilation step 2 (TFA) on a large Flutter application:
> Before: 59.448s
> After: 61.870s (+4%)
>
> Maintaining hierarchy of function types and analysis of all function
> calls is not feasible as it causes unbearable increase in AOT
> compilation time.
>
> TEST=existing
> Issue: https://github.com/dart-lang/sdk/issues/39692
>
> Change-Id: Ieb4d5dce23868b5ab5c87fa1e77e49b85fd656fe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345083
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Issue: https://github.com/dart-lang/sdk/issues/39692
Change-Id: Ieb9104f4263e19ef9e5bd749e935f6c2dbec3046
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346780
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2024-01-17 13:08:58 +00:00
Alexander Markov 66d3eedb33 [vm/aot/tfa] Analyze function calls
This change adds analysis of function calls when closure target
of a call can be inferred. Local functions are now analyzed separately
from enclosing members. Inferred result type of function calls is now
used in the AOT compiler.

Time of AOT compilation step 2 (TFA) on a large Flutter application:
Before: 59.448s
After: 61.870s (+4%)

Maintaining hierarchy of function types and analysis of all function
calls is not feasible as it causes unbearable increase in AOT
compilation time.

TEST=existing
Issue: https://github.com/dart-lang/sdk/issues/39692

Change-Id: Ieb4d5dce23868b5ab5c87fa1e77e49b85fd656fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345083
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-01-16 20:42:29 +00:00
Ryan Macnak 4cdfc63aa7 [test] Shrink async GC stress test to avoid timeouts on the slowest bots.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54590
Change-Id: Ib444f831e966fc980848cdd6495a5d0a343d439d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346581
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-16 19:17:13 +00:00
asiva 82c385f73a [VM/Service] Include newline in the stdout service event.
TEST=new test added

Bug:54582
Change-Id: I5e8d3aab19c37353a12e3a0a65edbb954d52bb4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346084
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-01-16 18:41:23 +00:00
Daco Harkes 8758f1f954 [vm] Bump service protocol to 4.14 and hide implementation
Follow up of https://dart-review.googlesource.com/c/sdk/+/346403.

TEST=pkg/vm_service/test/get_object_rpc_test.dart

Change-Id: I7c1d0fb565f8a128334844f7eec44eb4a4679c08
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-win-debug-x64-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346600
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-01-16 18:25:18 +00:00
Alexander Aprelev 82520abfb1 [vm/debugger] Ensure setting breakpoints is lock-safe.
Acquire reload opreation scope when deoptimizing the world to ensure locks can be acquired for compilation.
Set up scope for operations that can be run while the world is deoptimized and stopped to avoid races.
Ensure code stays unoptizimed when single stepping, prevent other isolates to reoptimize it.

TEST=DeoptimizeFramesWhenSettingBreakpoint
BUG=https://github.com/flutter/flutter/issues/140878

Change-Id: Id4c891bd585d42365fd3a60cfb9a4869892c2b03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345743
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-01-16 18:10:00 +00:00
Tess Strickland 3feab3655c [vm/compiler] Fix ARM7 regression after 1827fcbf68.
The refactoring in https://dart-review.googlesource.com/c/sdk/+/345002
erroneously assumed that if the caller to
Assembler::AddressCanHoldConstantIndex didn't pass an out parameter to
detect whether a base register was needed, that that case shouldn't be
considered.

While it's true that LoadIndexedInstr::MakeLocationSummary originally
ignored the value stored in the out parameter, it did that because it
can use TMP to store the array base, unlike the code for
StoreIndexedInstr which must have a temporary register allocated during
register allocation.

Thus, fix Assembler::AddressCanHoldConstantIndex to always require
the out parameter, and add a comment in LoadIndexedInstr as to why
we ignore the out parameter in this case instead of allocating an
additional temporary register.

TEST=vm/cc/Assembler_Regress54621

Fixes: https://github.com/dart-lang/sdk/issues/54621
Change-Id: I0af557565faf657a87641457884334446e9b7cc5
Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346201
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-01-16 12:13:41 +00:00
Daco Harkes 964e983f15 [vm/ffi] Initialize Library::ffi_native_resolver_ on deserializing snapshots
TEST=tests/ffi/native_assets/asset_process_test.dart

Closes: https://github.com/dart-lang/sdk/issues/54607
Change-Id: Id4e787a66f18db98473008b7da690dd2ca79a88e
Cq-Include-Trybots: luci.dart.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-x64-try,vm-aot-win-debug-x64c-try,vm-kernel-precomp-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346321
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-16 11:58:48 +00:00
Daco Harkes 7ba473f32b [vm] Support Finalizers in the debugger
TEST=pkg/vm_service/test/get_object_rpc_test.dart

Closes: https://github.com/dart-lang/sdk/issues/54615
Change-Id: I5262d756af63eb5d1677894f6a2e151cd0d65fc1
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-win-debug-x64-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346403
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-15 23:14:56 +00:00
Alexander Thomas a100968232 [python3.12] Fix syntax warnings in utils.py scripts
Bug: https://github.com/dart-lang/sdk/issues/54306
Change-Id: I3abfac0765721246b59451152d322a111d685644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346022
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
2024-01-12 16:38:51 +00:00
Tess Strickland a5758a0dc3 [gardening] Assert no errors in CompilerState::TypedListClass.
The assert, which is only triggered if we need to generate
calls to the _nativeGetX/_nativeSetX methods, should be checking for
no error, not that there is an error.

TEST=vm-aot-linux-debug-simriscv64 builds

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simriscv64-try
Change-Id: Ie360a067a6432503fa82ca7eb3d5f9281e0579f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346041
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-01-12 15:21:23 +00:00
Tess Strickland df72359786 [vm/compiler] Convert _TypedList get and set methods to normal methods.
Previously, they were implemented as native methods with special
replacements in the inliner.

Instead, create force-compiled versions of the original inliner
replacements and use those instead of native methods, unless the
flow graph compiler doesn't support unboxing the requested element type.
In that case, the force-compiled version just calls a native method,
and we only keep the native methods that might be needed (that is,
for double/SIMD element access).

Also, revert the change in 26911a6176, since now the _getX/_setX
methods are appropriately inlined instead of failing to inline due
to being native methods.

TEST=vm/dart/typed_list_index_checkbound_il_test

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-simarm_x64-try,vm-linux-release-simarm-try,vm-ffi-qemu-linux-release-arm-try
Change-Id: I4840883d1fc12b36a450803da339406bec149044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330786
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-01-12 10:29:09 +00:00
Ryan Macnak fa7cadde80 [vm, io] Don't have pending Dart_TypedDataAcquire during I/O operations.
I/O can take arbitrarily long, and open interior pointers prevent all other isolates in the group to reaching safepoints.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/140763
Change-Id: I1fa732d0db31500946aee232dc31f5baf324a55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345746
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2024-01-11 23:54:59 +00:00
Vyacheslav Egorov aaca6ce34a [vm] Fix running under WSL 1
On WSL 1 trying to allocate memory close to the binary
by supplying a hint fails with ENOMEM for unclear reason.
Some reports suggest that this might be related to the
alignment of the hint but aligning it by 64Kb does not
make the issue go away in our experiments. Instead
just retry without any hint.

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

TEST=manually under WSL 1

Change-Id: I0adf997fbf76e470a57da00f5ce7a26bb50706f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345802
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-01-11 22:24:44 +00:00
asiva e518b8c3be [VM/Runtime] - Do not try to resolve exec path for default namespace
TEST=new test added
Bug:54516
Change-Id: I67b1fe7ee07db342d328e5272ddca5411fd5df28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345320
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-01-11 19:12:52 +00:00
Ryan Macnak a6edfb5904 [vm] Add tests for missing write barriers in SuspendState suspend and clone.
Bug: https://github.com/dart-lang/sdk/issues/54410
Change-Id: I86f105fcba7ab95f4d526ab0b468822f50b4e62b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345568
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-11 18:57:20 +00:00
Parker Lougheed e36cca289f [vm/compiler] Expand inlining and const propagation of double.isNegative
TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-arm64-try,vm-aot-linux-product-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-linux-debug-ia32-try,vm-linux-debug-simriscv64-try
Change-Id: I586c678ddd69a3e5c1b8ddf97ae3fc781662d192
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344080
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-01-11 12:20:56 +00:00
Alexander Aprelev c8c7f8a2a1 [gardening] Clean up deleted tests from stress test list.
Follow-up to 154cf8c52b

TEST=ci

Change-Id: I27262b41d319297c41092a52b00ee06139945cc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345563
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-10 21:43:09 +00:00
Ryan Macnak 8938a7e499 [vm] Ensure the alignment gap is initialized when writing the minimal array truncation filler object.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54495
Change-Id: Iaa9c5ea6ba7312c7ded70eb1c938d8cbb2488e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345362
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-10 17:51:35 +00:00
Ryan Macnak 2ff30ee836 [vm] Don't create UnboxedConstantInstr(kUnboxedInt64) for RISCV32.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/54425
Bug: https://github.com/dart-lang/sdk/issues/54434
Change-Id: I05975376cd61ffeceda60edf76df182fbf753593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345348
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-01-09 20:44:38 +00:00
Vyacheslav Egorov e9f51b8534 [vm] Disable --write-protect-code on non-Mac OSes.
We still need to maintain W^X on iOS and Mac OS X.

TEST=ci

Change-Id: I78f005055d090d54f5da478164a73f18e11a32ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345303
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-01-09 20:28:55 +00:00
Vyacheslav Egorov 3e0ae6da5f [vm] Remove dual mapping of code
We are no longer using Dart VM in a setting where this
matters as a security measure and it just complicates
portability for no benefit.

There is an indication that it is causing problems when
running Linux build of Dart VM under Docker on Mac OS X.

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

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Change-Id: I11bdaa8faebaca1df6fd59097049bdaea9cb8e12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344581
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-01-09 12:36:55 +00:00
Tess Strickland 1827fcbf68 [vm/compiler] Fix uses of constant indexes in LoadIndexed/StoreIndexed.
Previously, CanBeImmediateIndex calculated the scaling factor for the
index using Instance::ElementSizeFor. However, the LoadIndexed and
StoreIndexed instructions which use this function have an index_scale_
field that is not necessarily the same as the element size for the
class id. This means the displacement calculated within
CanBeImmediateIndex can differ from the actual displacement calculated
within ElementAddressForIntIndex, causing the bug seen by the fuzzer.

This CL moves the check in CanBeImmediateIndex to a new static
method Assembler::AddressCanHoldConstantIndex. In addition to the
original arguments to CanBeImmediateIndex, the new static method takes
an index_scale argument, so the field value can be passed appropriately.

It also adds an is_external argument on X64 and IA32 to match the other
architectures, since assuming a non-external typed data object could
cause a register to be used in cases where it isn't necessary.

TEST=vm/dart/regress_54486

Fixes: https://github.com/dart-lang/sdk/issues/54486
Change-Id: Ia553fb7da0500113b35f8d9af91a52df55437a3c
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-linux-debug-ia32-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345002
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-01-08 15:46:01 +00:00
Tess Strickland 6672353e0f [vm] Fix instantiation of default type args in closure functions.
Previously, the default type arguments for closure functions were
instantiated in the same way as other types of functions, where the
instantiator and function type arguments of the call were used. However,
the defaults for closure functions should be instantiated with the
instantiator and parent function type arguments stored within the
closure itself.

Since the instantiation of the default type arguments only depends on
the instantiator and parent function type arguments, which are shared
between partial instantiations of the same generic closure, the VM
performs this instantiation once at closure creation and caches it in
the closure object, so it can be retrieved when the default type
arguments are needed and copied to new partial instantiations of the
same closure without need for recalculation.

As a side effect, this should speed up dynamic invocation of generic
closures, since the invoke field dispatcher that implements them
previously performed this instantiation when needed on every invocation,
but now it just retrieves the cached version instead.

TEST=language/closure/type_arguments vm/dart/regress_54426

Fixes: https://github.com/dart-lang/sdk/issues/54426
Change-Id: I9baad807befa0323f3c5b66196b9664e4d78af0a
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-tsan-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-msan-linux-release-x64-try,vm-aot-linux-release-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-mac-product-arm64-try,vm-aot-obfuscate-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344700
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-01-08 13:07:16 +00:00
Tess Strickland 57a1168875 [pkg/vm] Create @pragma("vm:platform-const-if", <cond>) annotation
If a static field or getter is annotated with
@pragma("vm:platform-const-if", <cond>) and <cond> const evaluates
to true, then uses of the static field or getter are const evaluated
when a target operating system is available. If <cond> const evaluates
to any other value, then the annotation is ignored.

For example, when runtime-only code is guarded like the following,
using Flutter's kDebugMode constant, then debug mode Flutter programs
can alter the defaultTargetPlatform for testing, but in release mode,
the defaultTargetPlatform getter is const evaluated and code guarded
with defaultTargetPlatform checks can be eliminated if unreachable:

  @pragma("vm:platform-const-if", !kDebugMode)
  TargetPlatform get defaultTargetPlatform {
   ...
   assert(() {
     if (Platform.environment.containsKey('FLUTTER_TEST')) {
       result = TestPlatform.android;
     }
     return true;
   }());
   if (kDebugMode &&
       platform.debugDefaultTargetPlatformOverride != null) {
     result = platform.debugDefaultTargetPlatformOverride;
   }
   ...
  }

TEST=pkg/vm/test/transformations/vm_constant_evaluator

Change-Id: I55b88502a908c56cf42a761dd06741f15c8a23d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333220
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-01-04 14:44:29 +00:00
Parker Lougheed 43324f6959 [vm/compiler] Remove some unused code in redundancy_elimination
While I was trying to better understand the implementation in this file I got confused by the unused IsConstant function. So this CL removes it and some other unused code.

TEST=ci

Change-Id: Ie8953cbb0db04c65cb15ad613fa50f738d4e804a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344360
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-01-03 15:04:38 +00:00
Daco Harkes 020421df65 [vm/ffi] Add Since annotation to Pointer + and -
To prevent breaking things on older SDKs when users chose to migrate.

CoreLibraryReviewExempt: VM & WASM only. Only adding an annotation.
Bug: https://github.com/dart-lang/sdk/issues/54250
Change-Id: Id026e34e78527117c571aa118445cd73b16f9a9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344022
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-01-03 08:53:07 +00:00
asiva 01ac55d5f0 [VM/tests] Temporarily remove language/closure/type_arguments_test
from the isolate stress test list as it is failing

(see https://github.com/dart-lang/sdk/issues/54426)

Change-Id: I7f5df7faa2cdc633901e54829ff9a7ccd824f5a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344461
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-01-03 01:20:09 +00:00
Aravind 64f8b912dd Small Doc Correction at await_stack_traces.md
Closes https://github.com/dart-lang/sdk/pull/54481

GitOrigin-RevId: c884fc57024154e49053dc799ea4dabdd29dde67
Change-Id: I48ee7adaab2626dc827e40225b37305afdc131a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344041
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-01-02 16:00:03 +00:00
Alexander Aprelev 544a564859 [gardening] Clean up stress test list post tests removal.
Follow-up to e95b3ed417

TEST=ci

Change-Id: I6d836d504e98aa29c6f835a5e8265310ced862e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343691
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-12-28 18:30:51 +00:00