Commit graph

21289 commits

Author SHA1 Message Date
Alexander Markov 97164b3a01 [vm/jit] Disable field guards for late fields
Late field inialization stubs don't update field guard state which
causes incorrect optimizations when they rely on that state.
This change disables field guards for late fields in order to fix this
bug.

As an alternative, we could have added the code to update field guard
state from late field initialization stubs. However, it would require
duplicating and generalizing a lot of code used to implement
GuardFieldClass, GuardFieldLength and GuardFieldType instructions.
At the moment it is not clear if field guards provide sufficient
performance improvements to justify this.

Another possible approach would be to outline initializing field
stores from the stubs back to the application code
but that would cause either substantial increase in AOT code size
or an undesired discrenacy between JIT and AOT.

TEST=runtime/tests/vm/dart/regress_flutter142532_test.dart
Fixes https://github.com/flutter/flutter/issues/142532

Change-Id: I15e737aa5d1b73e71e0cb935580a3b9a2dcbb77a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350985
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-02-09 14:59:40 +00:00
Vyacheslav Egorov 14f7622ef4 [vm] Remove bin/*_android{.cc,.h} and use Linux implementations.
Android is based on Linux, so most of the files were identical
sans some subtle discrepancies caused by drift over time.

This discrepancies were making code base harder to maintain and in fact
were hiding bugs. For example, on Android eventhandler's implementation
of timers which relied on passing timeout to `epoll_wait` contained
a bug which was not present on Linux which used `timerfd` instead.

TEST=ci and manual testing of Flutter app on Android device

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

Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-product-arm-try,vm-ffi-android-product-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try
Bug: b/311165013
Change-Id: Ia166f69c14177ec34160805a0983eafee8ea65f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350923
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-02-09 14:10:49 +00:00
Ryan Macnak 8baa99a697 [vm] Fix some left shifts of negative values.
TEST=ubsan
Change-Id: I606a3c1ee0a4bf5da8e03b458ad6031dcd65ca05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350941
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-02-07 21:52:22 +00:00
Ben Konyi 515c14ab40 [ Service ] Unregister isolate with the service before sending an IsolateExit event
This prevents the ServiceIsolateVisitor from including the isolate
that's shutting down in a `getVM` response. This is likely the cause of
flakiness in some tests that explicitly wait for a certain number of
IsolateExit events before requesting state for all remaining isolates.

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

TEST=Existing service tests

Fixed: 54783
Change-Id: Ic990d8c64baac98d2fd67f528d6f7d0dd6009b82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349520
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-02-07 18:47:51 +00:00
Martin Kustermann eba0e68e1a [vm/ffi] Allow Pointer objects to be shared across isolates
We consider `Pointer` objects as simple value types. We may unbox them
in the future to be simple integers - at which point our message sending
code wouldn't even know they are pointers anymore. There's therefore no
reason to prevent sending them across `SendPort`s.

Owners of `Pointer`s may implement `Finalizable` and sending such
finalizables across `SendPort`s is prohibited.

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

TEST=vm/dart/isiolates/fast_object_copy*_test

Change-Id: Ia215d119c5bb0e48e2c5dc83cc82e132f46931c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350822
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-02-07 12:48:50 +00:00
Martin Kustermann f7e3c62e1e [gardening] Fix vm/dart/run_appended_aot_snapshot_test
The change in [0] broke the test due to some refactorings in
`package:dart2native`.

As the test isn't run from a Dart SDK but rather from the files in the
build folder, it cannot use the methods from `package:dart2native` which
now relies on being run from the Dart SDK.

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

TEST=Fixes vm/dart/run_appended_aot_snapshot_test

Change-Id: I74ff86f49a4fb790b407358b6493de003a89c926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350820
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2024-02-07 10:24:09 +00:00
Ben Konyi d9797db9ea [ VM ] Inherit system isolate property on child isolate spawn
This prevents --pause-isolates-on-start and --pause-isolates-on-exit
from impacting isolates spawned from system isolates. This should be
revisited to determine if:

- Inheriting the system isolate property is actually what we want to do
  in general
- Isolate.spawn* APIs should instead include a parameter to specify an
  isolate as a system isolate

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

TEST=Manual testing

Change-Id: Ibacdea845db6344148c11bebf001e4cac3377a62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348460
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-02-06 23:38:53 +00:00
Ryan Macnak fd2c27ff4e [vm, gc] Avoid TSAN warning for accessing Page::top_.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/54766
Change-Id: Ic297b426977b835d11c2a98357839f1df8cfbc39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349711
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-02-06 22:53:59 +00:00
Derek Xu 60833d9cd9 [VM/Service] Update dart:io service extension spec
The main purpose of these changes is to make sure that the types in
package:http_profile are compatible with the interfaces in the spec.

See runtime/vm/service/service_extension.md and
pkg/vm_service/CHANGELOG.md for the full list of changes.

TEST=pkg/vm_service/test/get_http_profile_test.dart, DevTools tests

CoreLibraryReviewExempt: Only touches sdk/lib/io/network_profiling.dart
to update the version returned by the getVersion dart:io service
extension.
Change-Id: I1b9d0b7d43defbc857a2a8fde003012effd1ee15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341120
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-06 19:26:06 +00:00
Vyacheslav Egorov 0ea5013250 [vm] Respect catchError attached to the last async frame.
Our async unwinding code used to only respect `catchError`
which occured between async frames and ignored trailing
`catchError` like in the code below

    Future(...).catchError((_) { /* handle error */ });

This CL also simplifies how we communicate the presence of the
exception handler to the debugger: the code in the debugger did
not actually care about which frame catches the error (for async
handlers), so we don't need to precisely mark async gaps with
`has_catch_error` flag. Instead we have a single boolean
produced by unwinding which signals whether there we encountered
an asynchronous error handler or not.

Fixes https://github.com/flutter/flutter/issues/141882

TEST=service/pause_on_unhandled_async_exceptions5

Change-Id: Id6f6a97ee5444c197b2c621f68d1e47082fc8997
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350320
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-02-05 21:09:38 +00:00
Liam Appelbe dff831dbfc [ffi] Fix callback subtyping test
Previously we were reusing the ensureNativeTypeToDartType function to
check that Dart function passed as a callback matches the native type.
This works if the types exactly match, but the subtyping test is
backwards, so it doesn't allow certain cases that should be allowed. The
main case is that when the native function type returns void, the Dart
function should be allowed to return anything.

So I added ensureDartTypeToNativeType, which reverses the subtype test.

As well as making the return types more permissive, this has also
changed what parameters are allowed to be passed to callbacks. For
example, in tests/ffi/vmspecific_static_checks_typeddata_test.dart:80,
passing a Handle to a function expecting an Int8List used to work, but
is now a compile error. I think this change is an improvement, because
previously it would have been possible to pass any type of object to
that callback. So this change turns some potential runtime type errors
into compile errors. But technically I think this is a breaking change.

Fixes: https://github.com/dart-lang/sdk/issues/53659
Bug: https://github.com/dart-lang/sdk/issues/53659
Change-Id: I6846a59fc309ec897cba8f985d7dd0a63b912b42
TEST=tests/ffi/function_callbacks_subtype_test.dart and others
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346440
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-05 03:19:01 +00:00
Daco Harkes 28c7f5bd1e [vm/ffi] Refactor dart:ffi generator
Refactor to avoid conflicts later with concurrent work on:
- https://github.com/dart-lang/sdk/issues/45508
- https://github.com/dart-lang/sdk/issues/44589

Change-Id: I7b7ea2e4ec29115da42b0c196a2952c3cd5d3fa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349901
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-02-02 18:11:00 +00:00
Martin Kustermann 105825dfc4 [vm] Fix memory leak of [AppSnapshot] object
This leak start to happen after [0] landed.

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

TEST=Fixes vm/dart/isolates/regress_54528_test in ASAN mode

Change-Id: I0f24c4d997abcb0b0b6d396a505a5498bb633650
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349862
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-02-02 10:45:27 +00:00
Daco Harkes c0c7c1ef49 [vm/ffi] Update inner pointer accesses in IL
FFI loads and stores via structs can have a TypedData as receiver,
so this CL updates those loads to `kMayBeInnerPointer`.

This CL adds an IL test to verify that for `Pointer` loads the untagged
value is treated correctly as `kCannotBeInnerPointer`.
(And adds some prefer-inline pragmas to make some common operations
be inlined to avoid allocating `Pointer` objects.)

This CL updates the load in the FFI closures to use a load-field.
This can also potentially enable not allocating a pointer object when
this closure is inlined.

TEST=tests/ffi/unwrap_typeddata_generated_test.dart
TEST=tests/ffi

CoreLibraryReviewExempt: Only adding some pragmas.
Change-Id: If687e54c676f275cc849b3fed526a13766ab331a
Cq-Include-Trybots: luci.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-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-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-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-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349241
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-02-01 18:28:53 +00:00
Alexander Aprelev 3a3433fd38 [gardening] Skip test that requires aot on ia32.
TEST=vm/dart/isolates/regress_54528_test

Change-Id: I31c26a4f61ed45128dacf94fff46ffc08f010a55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349624
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-02-01 16:07:49 +00:00
Daco Harkes 24eb977761 [vm] Fix Mac Arm64 AOT
The magic number has the opposite endianness on the arm64 macs.

TEST=locally verified + SDK build

Closes: https://github.com/dart-lang/sdk/issues/54796
Change-Id: I4a66f44e0a32fbc3530bda6ffca177ba14d9dca7
Cq-Include-Trybots: luci.dart.try:vm-aot-mac-release-arm64-try,vm-mac-debug-arm64-try,dart-sdk-mac-arm64-try,pkg-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349661
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-02-01 15:30:08 +00:00
asiva eabfad1158 [VM/Runtime] Report error when an AOT snapshot is used in spawnUri while
running in the JIT VM

TEST=new test added

Bug:54528
Change-Id: Ifa0176ee453e5af4e45bb0b74cf9ac9ba23fb93e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346060
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-01-31 21:43:27 +00:00
Ben Konyi f063c0047d [ Service ] Remove steal_breakpoint_test.dart
This tests behavior for a flag that no longer exists.

TEST=Deleting a test

Change-Id: Id010b029bf70fb160be69adac1dd5ede8f29496d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349521
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-01-31 20:23:10 +00:00
Alexander Aprelev ce728a1037 [io] Align io_service_no_ssl.h with io_service.h.
Follow-up to 2ead86ab9d
TEST=ci

Change-Id: I7c64e367a8a169f23ab6078372f31e44a017337e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349410
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-01-31 19:32:09 +00:00
Ryan Macnak 9d3e923bf3 [vm] Fix memory leak freeing boringssl stack types.
TEST=lsan
Bug: https://github.com/dart-lang/sdk/issues/54765
Change-Id: Ibd22bb77d2941da33ac3afeb1ab8c7c0bcd3d267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349411
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-31 19:24:29 +00:00
Daco Harkes 70e4ff3e1a Revert "[vm/ffi] Unwrap typed data in FFI calls"
This reverts: https://dart-review.googlesource.com/c/sdk/+/338620

We'd like to support this use case with a different API. See the
discussion in https://github.com/dart-lang/sdk/issues/54739.

TEST=tests/ffi

Bug: https://github.com/dart-lang/sdk/issues/44589
Bug: https://github.com/dart-lang/sdk/issues/54771
Change-Id: Ic22fbcab14d374bb9c81bba1f1bf6ae2dfc9e674
Cq-Include-Trybots: luci.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-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-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/+/349340
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-01-31 09:22:45 +00:00
Ryan Macnak 1501d688c0 [vm] Avoid allocation when printing type names.
Avoids recursive assertion failures when a GC assertion failure occurs during a compile.

TEST=ci
Change-Id: I2fd2b29c1a7d83c426ceb437f3880746a4c8d8b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349142
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-01-29 23:53:19 +00:00
Alexander Markov 8c5407b3dd [vm/compiler] Fix truncation of class id when it is stored in FieldGuardState
Class id can occupy more than 16 bits, so bit field
FieldGuardState::GuardedCidBits is extended. Also added assertion that
it has at least target::UntaggedObject::kClassIdTagSize bits.

TEST=ci, manually tested repro from b/322790241.
Fixes b/322790241

Change-Id: I39d0592a5a1c8e0c83b7af7d30de6f966b358fda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349082
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-01-29 23:44:59 +00:00
Ryan Macnak 362e5784b5 Roll boringssl to d24a38200fef19150eef00cad35b138936c08767.
TEST=ci
Change-Id: I789fd6c238743f040c229e342880392af2e118ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348761
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-01-29 23:24:36 +00:00
Ben Konyi d48a76e988 [ DDS ] Migrate DDS specific tests from service/ and update package:dds_service_extensions to 1.7.0
TEST=migrated tests

Change-Id: Id77f46c7e348614f707fc4d50d8a3101120b48ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347941
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-01-26 22:45:14 +00:00
Alexander Aprelev 1d1531c8d9 [vm/io] Null-terminate scope-copied CStrings.
Fixes https://github.com/dart-lang/sdk/issues/54741
TEST=standalone/io/io_override_test

Change-Id: Ie907360dc4bcea05ef6fe3a5d4626e4e31399fc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348723
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-01-26 22:08:37 +00:00
Alexander Aprelev 34484719ca [io/ssl] Better error message when security context private key is missing.
Fixes https://github.com/dart-lang/sdk/issues/54719
TEST=standalone/io/security_context_no_private_key_test.dart

Change-Id: I6619b845a9cad8913efc00fc4f012bd87b27796a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348720
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-01-26 20:49:09 +00:00
Ryan Macnak 4e6cd29eef [vm, gc] Mark through new-space.
- Initial and final marking no longer visit all of new-space, reducing the STW pause for major GC.
 - A scavenge during concurrent marking must forward / filter objects in the marking worklist that are moved / collected, increasing the STW pause for minor GC.
 - Unreachable intergenerational cycles and weak references are collected in the next mark-sweep instead of first requiring enough scavenges to promote the whole cycle or weak target into old-space.
 - Artificial minor GCs are no longer needed to avoid memory leaks from back-to-back major GCs.
 - reachabilityBarrier is now just a count of major GCs.

TEST=ci
Change-Id: I1e653c9b5d3e02e45b280302c832157a75788db6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345350
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-01-26 18:58:54 +00:00
Ryan Macnak 24f838370d [vm] Avoid querying boot time on Mac/iOS.
mach_absolute_time uses the same clock as CLOCK_UPTIME_RAW. There are privacy concerns that boot time can be used for device fingerprinting. Dart doesn't not need to know boot time, only some monotonic clock.

TEST=ci
Change-Id: I57acd080bb93ce9cf51b4b90aec09bb7cab7f7af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348044
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2024-01-26 18:21:14 +00:00
Parker Lougheed 7901612ea3 [vm] Remove macOS 10.14 and iOS 12 availability checks
macOS 10.14 has been Flutter's minimum for a while, and iOS 12 is the new minimum as of https://github.com/flutter/flutter/issues/140474.

Dart has not marked these platforms as supported for an even longer time.

Supported platforms reference: https://docs.flutter.dev/reference/supported-platforms

TEST=ci

Bug: https://github.com/flutter/flutter/issues/140474
Change-Id: I12377975d9c4d57e19d486898f0fcd89a1583f7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-01-25 08:23:51 +00:00
Derek Xu b3abf245a8 Reland "[VM/Debugger] Ignore optimized out variables when building scope in ActivationFrame::BuildParameters"
This is a reland of commit e727f4ecbd

We allow the arguments array in
EvaluateCompiledExpressionHelper to contain
Object::optimized_out().ptr() when we have determined that the receiver
has been optimized out but isn't used by the compiled expression. So, I
have moved the assertion that checks for optimized out arguments from
EvaluateCompiledExpressionHelper to
Instance::EvaluateCompiledExpression.

TEST=vm-linux-debug-x64 tryjob

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>

Change-Id: Id6df0b0b3e0d26239068041126b034e9469b87af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347945
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-01-24 16:49:39 +00:00
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