Commit graph

21296 commits

Author SHA1 Message Date
Alexander Markov 9d6b79749b [vm] Remove core-jit snapshots
Core-jit snapshots are no longer used.

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

Change-Id: Ifadd6e8d913794f3e70cd4dfdc1758b0cd45f3ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352382
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-02-14 00:08:30 +00:00
Ryan Macnak 48cbd9b322 [vm] Identify the vm isolate etc by construction not by name.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54855
Change-Id: I31699c4343822e99a8fa275ba00dcdfa51cdd06b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351220
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-02-13 23:32:01 +00:00
Ryan Macnak 448b9ef989 [vm] Don't unnecessarily extend lifetime of KernelLoader handles.
ZoneHandles out-live the HANDLESCOPE for class finalization, and can accumulate a lot of objects during FinalizeAllClasses.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54886
Change-Id: Ia1330e0f27770c1a786a1b70e56881127cd936b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352052
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-02-13 17:30:29 +00:00
Alexander Markov a261196ea7 [vm] Remove context allocations for tear-offs
Previously, when taking a tear-off, a separate Context object was
allocated in order to capture receiver. Now, receiver is stored directly
in the Closure object in the 'context' field. This saves 1 object
allocation per tear-off and makes tear-offs cheaper compared to
explicit closures which can share context with other closures.

Benchmarks in AOT mode:

x64:
TearOff.NotInlined +40%
TearOff.NotInlined.InTry +43%
TearOff.Inlined.InTry +47%

arm64:
TearOff.NotInlined +27-43%
TearOff.NotInlined.InTry +29-43%
TearOff.Inlined.InTry +58-94%

arm64c:
TearOff.NotInlined +71%
TearOff.NotInlined.InTry +72%
TearOff.Inlined.InTry +96%

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/54808
Change-Id: I3ad95e8a8a4fc23f856bbc0fe238da58a9d25b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350945
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-02-13 15:33:38 +00:00
Alexander Markov 3421f48d50 [vm] Cleanup dead code around native closure functions
Closures cannot be declared native, so code which handles the
case of native function being closure function is dead.

TEST=ci

Change-Id: I47e124eecf4e778ad9fd3751a7b62459a032e800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351560
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-02-12 18:26:00 +00:00
Miguel Flores Ruiz de Eguino d1ba46c05e [inspect] Update Inspect library usage
The new Inspect library uses InspectSink as described in RFC-168 [1].
Additionally it's using the new CPP bindings instead of the deprecated
HLCPP bindings.

[1]: https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0168_exposing_inspect_through_inspectsink?hl=en

TEST=build locally together with the flutter engine and internal code.
Bug: https://g-issues.fuchsia.dev/issues/320785253
Change-Id: Ide167f67217dd964167133c9aafd9e33ec81afc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Miguel Flores <miguelfrde@google.com>
Auto-Submit: Miguel Flores <miguelfrde@google.com>
2024-02-12 18:18:01 +00:00
Alexander Markov 632a8baac5 [vm] Avoid altering static types when removing redundant type casts
VM can use static type of receiver in order to omit parameter
type checks. Removing a redundant AsExpression node can incorrectly
change static type of a receiver and break parameter type checks.

So, instead of removing redundant AsExpression nodes they are now
marked as Unchecked. This turns them into a no-op when building
flow graph, but keeps static type unchanged.

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

Change-Id: Ic283158c9b7ba11cb5c140226a6d057e98c8ce77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351621
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-02-12 17:54:32 +00:00
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