Commit Graph

21699 Commits

Author SHA1 Message Date
Derek Xu 8fa0f56f45 [VM/Service] Add private _deleteIdZone RPC
TEST=pkg/vm_service/test/id_zones_test.dart, CI

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: I0b951505edd98364373d5913b7a01f6d4775998e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380360
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-28 16:41:50 +00:00
Derek Xu daa8cbb29e [VM/Service] Add private _invalidateIdZone RPC
TEST=pkg/vm_service/test/id_zones_test.dart, CI

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: I02fcb2502b698066885b3f090435e43a34ed6fcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379820
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-28 16:41:50 +00:00
Derek Xu 6b978a8339 [VM/Service] Add secret _idZoneId parameters to all Service methods
TEST=pkg/vm_service/test/id_zones_test.dart, CI

Issue: https://github.com/dart-lang/sdk/issues/55869
CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes in
sdk/lib/vmservice/running_isolates.dart.
Change-Id: Ib8af3f073f6db9172df90a5ea221269411f72156
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379545
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-28 16:41:50 +00:00
Derek Xu 8b9be74d23 [VM/Service] Add private _createIdZone RPC
TEST=pkg/vm_service/test/id_zones_test.dart,
runtime/vm/object_id_ring_test.cc, CI

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: I6b092ea6ba4c7787635671af26e09af496ad9a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379544
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-28 16:41:50 +00:00
Alexander Markov 2e63d3135a [dart2bytecode, vm/interpreter] Records
TEST=language tests in vm-aot-dyn-linux-debug-x64 configuration

Change-Id: I6dd7d5617f5c076c722304ab2a753159f22c0bf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382421
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-08-28 13:12:48 +00:00
Daco Harkes e65551b7ea [vm/ffi][test] Fix test on Fuchsia
Change-Id: I4db7ecda7196c4023ad7b2ee91d552edb5f6a114
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382541
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-08-28 10:40:21 +00:00
Daco Harkes 1b125fb337 [gardening] Fix concurrency_stress_sanity_test
Closes: https://github.com/dart-lang/sdk/issues/56585
Change-Id: Ib0cfb9772ac04f73c57ab0f5bbc10786c6db740d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382561
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-08-28 10:27:24 +00:00
Tess Strickland 27e15ae053 [vm] Cleanup other BitField uses.
Also add a SignedBitField alias so that sign extended BitFields can
be declared with default positions and/or sizes.

TEST=ci

Change-Id: I46bf7f9e378e0f20e7f2e4b4e7ed3e242946d9bb
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-win-release-arm64-try,vm-aot-win-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382404
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-28 08:52:19 +00:00
Aravind b5928642ff [vm/ffi] Supporting .address.cast() expression in ffi leaf calls
Closes https://github.com/dart-lang/sdk/pull/56357

GitOrigin-RevId: 605e7d3fa5f4c7ce367539a76402e2e51aa69422
Change-Id: I79524b443326a161afe221d0a2afb6bed5866e59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378221
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-08-28 06:34:09 +00:00
Ryan Macnak 6e04f11571 [vm, gc] Fix race installing a page's card table.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/56579
Change-Id: I057f898ec8d7cf3b6796c5ec1587b1399c5a8f9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382460
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-08-27 21:14:16 +00:00
Tess Strickland d3c165d7b5 Reland "[vm] Improvements in the BitField API."
This is a reland of commit bfc1a44527

Change how the partial specializations for AtomicBitFieldContainer
are written so that Visual Studio properly chooses them instead of
the base BitField template when appropriate.

TEST=Windows ARM64 CI trybots

Original change's description:
> [vm] Improvements in the BitField API.
>
> If no position is specified, then the bitfield starts at bit 0.
>
> The default size for bool BitFields is 1 instead of the remaining
> bits in the container.
>
> If the size of the value type is smaller than the remaining bits
> in the container, then the size of the value type is used as
> the default size instead.
>
> If a signed value is used in a non-sign-extended BitField, only
> the magnitude of the value is stored, not the sign bit. This means
> the actual size of the bitfield may be one less than the requested
> size in this case.
>
> If the requested size of the bitfield is larger than the size of the
> value type, a compile-time error is thrown. (For signed types, the
> requested size is allowed to be the size of the entire value, even if
> only the magnitude bits are stored.)
>
> Rework uses of BitFields to avoid using separate constants for
> bit positions/sizes except for macro-defined bitfields (which now
> are universally bool, and so size 1).
>
> TEST=vm/cc/BitFields_Defaults
>
> Change-Id: I40711c929d2e5165ce40823772beb49e8cfdb820
> Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-release-simarm_x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381644
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

Change-Id: I5e3a9e3e2a80d5689a23a0603f8f81fac1576cd3
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-win-debug-x64c-try,vm-win-release-x64-try,vm-aot-win-release-x64-try,vm-win-release-arm64-try,vm-aot-win-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382383
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-27 19:03:02 +00:00
Samuel Rawlins b3f31a0440 Revert "Reapply "analyzer: separate unused_element_parameter from unused_element""
This reverts commit b551690c56.

Reason for revert: flutter customer tests failing: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8738601049545714785/+/u/run_test.dart_for_customer_testing_shard_and_subshard_None/stdout

Original change's description:
> Reapply "analyzer: separate unused_element_parameter from unused_element"
>
> Fixes #49025. Fixes #48401
>
> This allows users to blanket ignore unused_element_parameter without
> ignoring unused_element. They are reported in distinct situations so it
> is valid to separate them.
>
> This reverts commit b888da751e.
>
> Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
> Tested: trybots
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: Ie0df2f4be45e5db2fa255dcf8c30ddf8408c155b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382420
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Matan Lurey <matanl@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-27 17:44:28 +00:00
Lasse R.H. Nielsen 310d91aee8 Make async error injection set stack trace on errors.
Also removed a bunch of `CheckNotNullable`s that shouldn't be necessary any more. Any remaining non-sound-null-safety code runs today, and no more should be written. (And if it is, it'll mostly just err somewhere else, with a worse error message.)

Tested: New test added. Removed older tests checking for unsound null-safety.
Change-Id: I28626909cd8c1f91db6c61fc2b93042ed1b085dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380780
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-08-27 12:51:26 +00:00
Tess Strickland 66eca4abfd Revert "[vm] Improvements in the BitField API."
This reverts commit bfc1a44527.

Reason for revert: Broke Windows build.

Original change's description:
> [vm] Improvements in the BitField API.
>
> If no position is specified, then the bitfield starts at bit 0.
>
> The default size for bool BitFields is 1 instead of the remaining
> bits in the container.
>
> If the size of the value type is smaller than the remaining bits
> in the container, then the size of the value type is used as
> the default size instead.
>
> If a signed value is used in a non-sign-extended BitField, only
> the magnitude of the value is stored, not the sign bit. This means
> the actual size of the bitfield may be one less than the requested
> size in this case.
>
> If the requested size of the bitfield is larger than the size of the
> value type, a compile-time error is thrown. (For signed types, the
> requested size is allowed to be the size of the entire value, even if
> only the magnitude bits are stored.)
>
> Rework uses of BitFields to avoid using separate constants for
> bit positions/sizes except for macro-defined bitfields (which now
> are universally bool, and so size 1).
>
> TEST=vm/cc/BitFields_Defaults
>
> Change-Id: I40711c929d2e5165ce40823772beb49e8cfdb820
> Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-release-simarm_x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381644
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

Change-Id: I13bf2218ecc47a42f3a6091821037b51b56618fb
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-release-simarm_x64-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382380
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-08-27 10:16:48 +00:00
Tess Strickland bfc1a44527 [vm] Improvements in the BitField API.
If no position is specified, then the bitfield starts at bit 0.

The default size for bool BitFields is 1 instead of the remaining
bits in the container.

If the size of the value type is smaller than the remaining bits
in the container, then the size of the value type is used as
the default size instead.

If a signed value is used in a non-sign-extended BitField, only
the magnitude of the value is stored, not the sign bit. This means
the actual size of the bitfield may be one less than the requested
size in this case.

If the requested size of the bitfield is larger than the size of the
value type, a compile-time error is thrown. (For signed types, the
requested size is allowed to be the size of the entire value, even if
only the magnitude bits are stored.)

Rework uses of BitFields to avoid using separate constants for
bit positions/sizes except for macro-defined bitfields (which now
are universally bool, and so size 1).

TEST=vm/cc/BitFields_Defaults

Change-Id: I40711c929d2e5165ce40823772beb49e8cfdb820
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-release-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381644
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-08-27 09:28:51 +00:00
Brian Quinlan 00778c316d Fixes a bug where the timezone was not currectly reported on older android
versions.

Bug:https://github.com/dart-lang/sdk/issues/53276
Change-Id: I653298f9179b78a310574e66c4f4a6e73891d5b8
Tested: manual (performance with Google perfgate tool)
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382260
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2024-08-26 23:25:24 +00:00
Ryan Macnak b61bde3ea8 Roll Clang to 0cfd03ac0d3f9713090a581bda07584754c73a49.
TEST=ci
Change-Id: I20dd9779e30716f9dbf521391c49096c85de2936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382241
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-08-26 22:14:39 +00:00
Alexander Markov 062b0738e3 [dart2bytecode, vm/interpreter] await/yield/yield*
TEST=language tests in vm-aot-dyn-linux-debug-x64 configuration

Change-Id: I205bec19c2072fe9ac11a3211123bba43cb99d5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381945
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-26 20:35:18 +00:00
Sam Rawlins b551690c56 Reapply "analyzer: separate unused_element_parameter from unused_element"
Fixes #49025. Fixes #48401

This allows users to blanket ignore unused_element_parameter without
ignoring unused_element. They are reported in distinct situations so it
is valid to separate them.

This reverts commit b888da751e.

Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
Tested: trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-23 20:49:01 +00:00
Daco Harkes 156e02bc01 [doc/ffi] Contributing to dart:ffi doc 2
Change-Id: I2a939f9dd561e644696e2cead3363351aaed63f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381622
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Hossein Yousefi <yousefi@google.com>
2024-08-23 09:53:38 +00:00
Daco Harkes 6378a26212 [vm] Variable scoping fixes
This CL fixes two bugs related to scoping:
1. Empty variable name lookup in outer functions failing.
2. Let expressions not pushing and popping contexts.

Additionally, this CL introduces a `--print-scoping` debug flag to
ease debugging scoping issues in the future.

Variable lookup is now only using kernel offset, unless the offset
is `kNoKernelOffset`. In that case, the names are used.
All synthetic variables in the VM now use `kNoKernelOffset` as their
offset.

The let expressions not pushing contexts is fixed by pushing context.
The context is only pushed if the scope captures variables. So this
should not lead to performance regressions. (Any lacking pushing of
scopes should have lead to crashes.)

TEST=tests/ffi/regress_56412_2_test.dart
TEST=tests/ffi/regress_56412_test.dart

Closes: https://github.com/dart-lang/sdk/issues/56412
Change-Id: I85fc4a161b833df80ce8f2911d618aa2ac9797eb
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-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-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-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-arm64-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-arm64-try,vm-fuchsia-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-arm64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-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/+/380983
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-08-23 07:03:15 +00:00
Alexander Markov 48f66ec572 Revert "[vm, gc] Run parallel GC tasks on mutator threads blocked for the safepoint instead of new thread pool workers."
This reverts commit 111e64de39.

Reason for revert: timeouts on multiple Flutter HHH bots
(flutter-linux-framework-coverage, flutter-linux-framework-tests-libraries, flutter-linux-framework-tests-misc, flutter-linux-framework-tests-widgets, flutter-linux-customer-testing).
"Run *** tests" step increased from 8-13m to 1.5h+.

Original change's description:
> [vm, gc] Run parallel GC tasks on mutator threads blocked for the safepoint instead of new thread pool workers.
>
> unit_test_suites.dart --skipTestsThatRequireGit -j8
> 6:59 -> 6:23 (-8.6%)
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/55713
> Change-Id: I5256175abf4751b3b5e877ed5abdc76a90cd2fb3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381383
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

Bug: https://github.com/dart-lang/sdk/issues/55713
Change-Id: I34dc15e80451d39cefa123e0e49c54cd17b068c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381900
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-22 20:10:52 +00:00
Daco Harkes a645b6b4f7 [doc/ffi] Contributing to dart:ffi doc
Change-Id: I6d75a63b02bec44e8850d2380bc37b332b23d0e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380261
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-08-22 09:56:08 +00:00
Ryan Macnak 111e64de39 [vm, gc] Run parallel GC tasks on mutator threads blocked for the safepoint instead of new thread pool workers.
unit_test_suites.dart --skipTestsThatRequireGit -j8
6:59 -> 6:23 (-8.6%)

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/55713
Change-Id: I5256175abf4751b3b5e877ed5abdc76a90cd2fb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381383
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-08-21 16:35:28 +00:00
Derek Xu 382b33f3ff [dart:developer] Allow Service.getObjectId to lazily create the default Service ID zone of an isolate
This functionality is required by leak tracker.

TEST=locally patched these changes into the failing cbuild roll
(build/find/b1d1836082dbf5d3b78601522b0c97ce7faf8c54) and confirmed that
they fix the failing tests.

Change-Id: I307ec8ae4bd0afc1570eeee272aa54f28250b4b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381680
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-21 15:32:30 +00:00
Derek Xu b1d1836082 Reland "[VM/Service] Change how the default Service ID zone is stored in an Isolate"
This is a reland of commit c5935aa16e

Initialization of `service_id_zones_` has been made lazy in this reland
CL. I performed a Golem run
(https://golem.corp.goog/Comparison?repository=dart#targetA%3Ddart%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D111556%3BpatchA%3Dderekx-Reland---VM%2FService--Change-how-the-default-Service-ID-zone-is-stored-in-an-Isolate--2%3BtargetB%3Ddart%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D111542%3BpatchB%3DNone)
on this reland CL, and confirmed that the benchmarks that had gotten
regressed by my original CL
(https://golem.corp.goog/Revision?repository=dart&revision=111543) no
longer get regressed.

Original change's description:
> [VM/Service] Change how the default Service ID zone is stored in an Isolate
>
> This CL makes it so that the default Service ID zone of an Isolate will
> now be stored in a MallocGrowableArray, in preparation for adding the
> ability for Isolates to each store multiple Service ID zones.
>
> TEST=CI
>
> Issue: https://github.com/dart-lang/sdk/issues/55869
> Change-Id: Ie729c1854faac1f61a466ae893ee8ad0a2128499
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379543
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

TEST=CI

Change-Id: I01cf0f54b05ae82a2dfd9f9c7fd48cda1ddfa90e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381061
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-20 20:38:19 +00:00
Brian Quinlan d19ef1227b Fix zlib inflation to ignore data past the ADLER32 trailer.
Bug:https://github.com/dart-lang/sdk/issues/56481
Change-Id: I880ca6f546dd28c408066d6b52dd3d3cfba18dfc
Tested: zlib_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380861
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-08-20 18:13:33 +00:00
Alexander Markov 84fd647969 [vm] Refactor access to Integer value
Add methods to provide uniform access to values of Dart integers:

  Integer::Value()
  Integer::Value(IntegerPtr)

  Smi::Value()
  Smi::Value(SmiPtr)

  Mint::Value()
  Mint::Value(MintPtr)

Remove

  AsInt64Value()
  AsTruncatedInt64Value()
  AsTruncatedUint32Value()
  GetInt64Value(IntegerPtr)

Also, rename AsDoubleValue() to ToDouble() and
remove unused (FitsIntoSmi, AsValidInteger) and
value-based methods (IsZero, IsNegative).

TEST=ci

Change-Id: I28786ec3a14703574b7a192ead42eeefdbd09106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380586
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-19 21:46:26 +00:00
Vyacheslav Egorov 49ed2007e5 [vm] Fix deadlock in AllocateSuspendState
AllocateSuspendState was calling `Instance::SetField` but did not allow lazy deopt to occur. Possibility of lazy deopt from those
field stores is only theoretical, but it manifested as a
deadlock between background compiler and main thread: if main
thread calls `SetField` which tries to acquire write access to
the program lock, while background compiler has already
acquired write access to the program lock and is trying to
stop all mutators at a GC+Deopt safepoint then we will
deadlock as `AllocateSuspendState` does not allow Deopts
(safepoint level was lowered by 5bc107c29d).

We fix this problem by bypassing field guard and simply
writing affected fields directly in AllocateSuspendState.
We make sure to initialize guarded state for these fields
eagerly, so it never needs to change.

TEST=added assertion which validates that attempting to acquire program lock for write can only occur where GC+Deopt are permitted.

Change-Id: I6ee6b82f3296f49f799c0069e42850711c9320ac
Bug: b/355226004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-08-19 14:04:47 +00:00
Alexander Markov 9685ee28df [vm,dart2bytecode] Fix function types and local functions in bytecode
When reading function types from bytecode, number of implicit
parameters should be set in the FunctionType.

Capture variable holding a local function when local function
invocation happens from a different function scope.

Also remove debug prints from bytecode reader.

TEST=corelib/list_for_each_test
TEST=language/closure/closure6_test

Change-Id: I69c92ba2749509a24d13e8b2a10c5dea76973a56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381081
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-08-19 13:09:31 +00:00
Vyacheslav Egorov 090c07ad1f [vm] Improve unwinding for Future.timeout
Make unwinding follow the awaiter link attached to the timeout handler,
which allows it to continue past the asynchronous gap into the
corresponding listeners. This significantly improves the stack trace:
for example a timing out `await Socket.connect()` now produces:

    SocketException: Connection timed out, ...
    _NativeSocket.connect.<anonymous closure>.<anonymous closure>
    _RootZone.run (dart:async/zone.dart:1655:54)
    Future.timeout.<anonymous closure>
    <asynchronous suspension>
    _RawSocket.connect.<anonymous closure>
    <asynchronous suspension>
    Socket._connect.<anonymous closure>
    <asynchronous suspension>
    main
    <asynchronous suspension>

Where without this change it produced:

    SocketException: Connection timed out, ...
    _NativeSocket.connect.<anonymous closure>.<anonymous closure>
    _RootZone.run
    Future.timeout.<anonymous closure>
    Timer._createTimer.<anonymous closure>
    _Timer._runTimers
    _Timer._handleMessage
    _RawReceivePort._handleMessage

Which is much less informative.

TEST=vm/dart/awaiter_stacks

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

Change-Id: If4798e9e216ed88480a2b2b91ad6fa13dcb14ca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380982
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-08-19 06:52:34 +00:00
Derek Xu cce42a346b Revert "[VM/Service] Change how the default Service ID zone is stored in an Isolate"
This reverts commit c5935aa16e.

Reason for revert: Golem regressions

Original change's description:
> [VM/Service] Change how the default Service ID zone is stored in an Isolate
>
> This CL makes it so that the default Service ID zone of an Isolate will
> now be stored in a MallocGrowableArray, in preparation for adding the
> ability for Isolates to each store multiple Service ID zones.
>
> TEST=CI
>
> Issue: https://github.com/dart-lang/sdk/issues/55869
> Change-Id: Ie729c1854faac1f61a466ae893ee8ad0a2128499
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379543
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: I76fc2dc15d896a24ac8b9ec4bb44e67eaaf50fd2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380801
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2024-08-16 16:59:37 +00:00
Alexander Markov 758c490ae5 [vm] Update dynamic modules for the recent changes in the VM
* Revise uses of ObjectPtr::GetClassId which now handles Smis.
* Accomodate for _Map and _Set moved to dart:_compact_hash.

Also, a bit of code cleanup in the interpreter:
* Replace RAW_CAST with Handle::RawCast
* Replace NULL with nullptr.

TEST=Manual

Change-Id: Ib49f66cfcbac26200294d3ee55edc1b99c94fcf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380685
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-08-16 08:27:22 +00:00
Derek Xu c5935aa16e [VM/Service] Change how the default Service ID zone is stored in an Isolate
This CL makes it so that the default Service ID zone of an Isolate will
now be stored in a MallocGrowableArray, in preparation for adding the
ability for Isolates to each store multiple Service ID zones.

TEST=CI

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: Ie729c1854faac1f61a466ae893ee8ad0a2128499
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379543
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-08-15 20:15:36 +00:00
Alexander Aprelev f9c603e76b [io/win] Always use absolute, canonicalized paths.
This ensures that on Windows we take advantage of 32k-character file name limit consistently for all files and directories operations.

TEST=ci
BUG=https://github.com/dart-lang/sdk/issues/56125
BUG=https://github.com/dart-lang/sdk/issues/55972
CoreLibraryReviewExempt: adds windows-specific error code for invalid file name
Change-Id: I83bd3ceac579e589469e47b2cf5216db457cae8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375421
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-08-15 17:51:10 +00:00
Ben Konyi eda6e99a04 [ Service ] Omit BoundVariables for wildcard variables in service responses
This will prevent wildcard parameters and local variables from appearing
in the debugger variables pane. Responses that describe program
structure (e.g., function parameters) will continue to report wildcard
elements.

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

TEST=pkg/vm_service/test/wildcard_test.dart

Change-Id: Id546fe177bc734e36f69fa6ed8102ca7e5832ab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380340
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-08-15 15:20:29 +00:00
Alexander Markov 8fbca8ba67 [vm] Initial implementation of dynamic modules in the VM/AOT
TEST=Manually tested dynamic modules

Change-Id: Icb2616e414167bd1fbd10f01dea64c57dbdeeac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380281
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-15 14:09:52 +00:00
Alexander Markov bf2fba78e0 [vm] Fix ObjectPtr::IsSmi and other ObjectPtr::Is* methods to account for Smis
Arbitrary ObjectPtr can be a non-heap object (Smi), so methods
ObjectPtr::Is* which test class id should account for Smi.

Changed ObjectPtr::GetClassId to account for Smi similarly to
Object::GetClassId. Added unsafe ObjectPtr::GetClassIdOfHeapObject
which can be used when caller knows the heap nature of the object.

This change also fixes Integer::GetInt64Value which was relying on ObjectPtr::IsSmi.

TEST=vm/cc/Smi, vm/cc/Mint

Change-Id: I1391600e2acedc7b2a8f35c814df113ec9ba8698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380280
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-14 17:09:07 +00:00
Martin Kustermann b888da751e Revert "analyzer: separate unused_element_parameter from unused_element"
This reverts commit c1976b097d.

Reason for revert: It seems this change caused failures on Flutter
HHH bot. Example log can be found at [0]:
```
| lib/src/super_reader/super_reader.dart:615:14: Error: Final field 'showDebugLeaderBounds' is not initialized.
| Try to initialize the field in the declaration or in every constructor.
|   final bool showDebugLeaderBounds;
|              ^^^^^^^^^^^^^^^^^^^^^

```
Looking at the sources it seems that may be related to the
`// ignore: unused_element` analyzer directive:

```
   602	/// A [SuperReaderDocumentLayerBuilder] that builds a [SelectionLeadersDocumentLayer], which positions
   603	/// leader widgets at the base and extent of the user's selection, so that other widgets
   604	/// can position themselves relative to the user's selection.
   605	class _SelectionLeadersDocumentLayerBuilder implements SuperReaderDocumentLayerBuilder {
   606	  const _SelectionLeadersDocumentLayerBuilder({
   607	    required this.links,
   608	    // ignore: unused_element
   609	    this.showDebugLeaderBounds = false,
   610	  });
   611
   612	  /// Collections of [LayerLink]s, which are given to leader widgets that are
   613	  /// positioned at the selection bounds, and around the full selection.
   614	  final SelectionLayerLinks links;
   615
   616	  /// Whether to paint colorful bounds around the leader widgets, for debugging purposes.
   617	  final bool showDebugLeaderBounds;
```

So tentatively reverting this CL.

[0] https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8739650477551803313/+/u/Run_customer_testing_tests/stdout

Original change's description:
> analyzer: separate unused_element_parameter from unused_element
>
> Fixes https://github.com/dart-lang/sdk/issues/49025
>
> This allows users to blanket ignore unused_element_parameter without
> ignoring unused_element. They are reported in distinct situations so it
> is valid to separate them.
>
> Tested: Presubmit CI
> Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
> Change-Id: I4844a6a0e0a67cd5e37ed8735b1526e174deb950
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378500
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Ibbba75fe56601c7c4b5535c9142cf94c2dd80b91
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380460
Commit-Queue: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-08-14 08:05:37 +00:00
Ryan Macnak 365985eab7 [vm, gc] Scale new-gen size with number of mutators.
unit_test_suites.dart --skipTestsThatRequireGit -j8
10:51 -> 7:23 (-32%)

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/55713
Change-Id: I98c3dfd4227d335c4b5096036fb717badb9f4f5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378380
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-08-13 21:13:39 +00:00
Derek Xu baa9a043d2 [VM/Service] Fix documentation of ObjectIdRing
TEST=only a comment was changed

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: I42485e2108d2619ba9ae8cef89728e312b29b8b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379542
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-08-13 17:09:59 +00:00
Derek Xu 004fbe9119 [VM/Service] Improve documentation of JSONStream::Setup
TEST=CI

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: Ib839ca76b1aa9ab0de0b8b3afd02a708a3e8b0a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379541
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-13 17:09:59 +00:00
Sam Rawlins c1976b097d analyzer: separate unused_element_parameter from unused_element
Fixes https://github.com/dart-lang/sdk/issues/49025

This allows users to blanket ignore unused_element_parameter without
ignoring unused_element. They are reported in distinct situations so it
is valid to separate them.

Tested: Presubmit CI
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I4844a6a0e0a67cd5e37ed8735b1526e174deb950
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-13 12:12:13 +00:00
Vyacheslav Egorov 196f6c90c2 [vm] Create dart:_compact_hash library.
This opens possibility for other core libraries to access implementation
details of compact hash maps/sets and call special "core-library-only"
methods.

TEST=ci

CoreLibraryReviewExempt: VM only library change
Change-Id: I1d7524932c34e6fbe2428853dd547d58bef2d061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379840
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-08-13 09:20:05 +00:00
Sam Rawlins c008c159ee Enable feature digit-separators
This CL  makes the `digit-separators` feature enabled by default in
Dart Language Version 3.6.

Tested: Presubmit bots
Change-Id: If0776e96066ecaad3baa7f92fce167317fb976f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379660
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-08-13 04:09:39 +00:00
Tess Strickland d71837a316 [vm/compiler] Remove dead code in LocalScope/bitfield in LocalVariable.
There are no callers of CaptureLocalVariables(), and only
CaptureLocalVariables() checks the IsForcedStackBit bitfield of
LocalVariables, so remove that and its setter/getter as well.

TEST=ci (dead code removal)

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

Change-Id: I8032ff8f8cd7a43d3d30f1a4ec4e37cbfcee0a82
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379802
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-08-09 14:16:49 +00:00
asiva 8ab797db11 [VM/Runtime] Create Error object instead of Exception object
Should fix https://github.com/dart-lang/sdk/issues/56411

TEST=ci

Change-Id: If3f62d94e09201eb52b38f8d752368abbac86704
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379742
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-08-09 02:51:19 +00:00
asiva 4fa15453b6 [VM/Runtime] Throw error when native service port cannot be created
Throw error when a native service port cannot be created instead of
returning null. Fix the dispatch code to account for potential error
when creating the native service port and have it handle the error
in the catch block.

Should fix https://github.com/dart-lang/sdk/issues/55606

TEST=ci (a new test for this specific condition was hard to add)

Change-Id: I6ba6a66d36448ed3c323ee3350a2d4984288f359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378544
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-08-08 21:02:48 +00:00
Alexander Aprelev fcfb20d018 Revert "[vm/mac] Disable setting of the process name as it has side-effects on macos 15+"
This reverts commit 146126ff84.

Reason for revert: As of mac os 15 beta 3 the issue no longer shows up.

Original change's description:
> [vm/mac] Disable setting of the process name as it has side-effects on macos 15+
>
> Fixes https://github.com/flutter/flutter/issues/152723
> TEST=manually on mac os 15 beta
>
> Change-Id: Idd100bebf2aaf3ed6f97f052a9f58429520d0bcb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379142
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Alexander Aprelev <aam@google.com>

Change-Id: I6cc666de06e62b277d6dc4223c67c64a40d0d2f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379340
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-08-07 19:28:10 +00:00
Vyacheslav Egorov f27e990354 [vm/android] Fix ThreadInterrupter::InterruptThread
e105029f62 changed OSThread::id on Android
to be pthread_self, but InterruptThread expects actual tid.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try
Change-Id: I973c9d345343fbbbf1a5846f5badec1687b5ff7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379360
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-08-07 16:39:10 +00:00