Commit Graph

358 Commits

Author SHA1 Message Date
Derek Xu 3dc9d8dcf9 [VM/Service] Add getQueuedMicrotasks RPC
TEST=pkg/vm_service/test/get_queued_microtasks_rpc_test

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes within
sdk/lib/vmservice/.
Change-Id: Ie5488f498e4d0f3d201e3f31423fd5029b74a726
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425160
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-05-13 14:29:37 -07:00
Ryan Macnak eb563faf6d [vm, gc] Report RSS as timeline counter events, sampled before and after GC.
Catapult will display a nice graph for this.

TEST=view timeline
Change-Id: I6b6fdede463b37dbb10841cfa7c1e08c95e7cb62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427060
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-05-12 10:46:39 -07:00
Derek Xu 2877d78576 Reland "[VM/Service] Record timeline events representing completed microtasks"
This is a reland of commit 22021cc120

I showed some excerpts of Golem results to @mraleph for varying targets
and constant CPU, patch A, and patch B. Those constants being:
  CPU: Intel Xeon
  patch A: revision=115869&patch=20143
  patch B: revision=115876
(example results:
https://golem.corp.goog/Comparison?repository=dart#targetA%3Ddart%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D115869%3BpatchA%3Dderekx-Reland---VM%2FService--Record-timeline-events-representing-completed-microtasks--4%3BtargetB%3Ddart%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D115876%3BpatchB%3DNone)

He said that this change could be relanded as long as the following
"RunTime as Score" regressions of the "dart" target were noted in the
commit message:
  - StreamSingleSubTest: -3.907% (-0.8 noise)
  - ScheduleMicrotaskTest: -12.67% (-0.6 noise)

TEST=pkg/vm_service/test/timeline_events_for_completed_microtasks_test

Original change's description:
> [VM/Service] Record timeline events representing completed microtasks
>
> TEST=pkg/vm_service/test/timeline_events_for_completed_microtasks_test
>
> CoreLibraryReviewExempt: This CL does not include any core library API
> changes, it only modifies the implementation of microtasks (by
> instrumenting them).
> Change-Id: I54d886db9519c73f9e3218a9cc1c46bc9fe9acc3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420221
> Commit-Queue: Derek Xu <derekx@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

CoreLibraryReviewExempt: This CL does not include any core library API
changes, it only modifies the implementation of microtasks (by
instrumenting them).
Change-Id: Ia7741a9bb9ab948e8d5fff1cf9abe9915e247d81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423921
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-04-25 08:51:22 -07:00
Alexander Aprelev 69485e9b28 [vm] Move origin_id from isolate to isolate group.
Isolates in one group share same origin_id anyway, so it makes sense to store it on the group too.


Remove isolate's _originNumber from service api - isolate group should be used instead.

Based on feedback from https://dart-review.git.corp.google.com/c/sdk/+/418503/21/runtime/lib/isolate.cc#107

TEST=ci
Change-Id: Iab4b6393a042c9302e911a276a6afc6dab63e70d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424140
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-04-23 15:26:21 -07:00
Derek Xu 26d1f3d77e Revert "[VM/Service] Record timeline events representing completed microtasks"
This reverts commit 22021cc120.

Reason for revert: I didn't gate stacktrace collection behind `--profile-microtasks` correctly

Original change's description:
> [VM/Service] Record timeline events representing completed microtasks
>
> TEST=pkg/vm_service/test/timeline_events_for_completed_microtasks_test
>
> CoreLibraryReviewExempt: This CL does not include any core library API
> changes, it only modifies the implementation of microtasks (by
> instrumenting them).
> Change-Id: I54d886db9519c73f9e3218a9cc1c46bc9fe9acc3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420221
> Commit-Queue: Derek Xu <derekx@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I82b4a49764956254c51bd3abfee0cb3cd1b329d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423920
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Jessy Yameogo <yjessy@google.com>
Auto-Submit: Derek Xu <derekx@google.com>
2025-04-22 11:48:48 -07:00
Derek Xu 22021cc120 [VM/Service] Record timeline events representing completed microtasks
TEST=pkg/vm_service/test/timeline_events_for_completed_microtasks_test

CoreLibraryReviewExempt: This CL does not include any core library API
changes, it only modifies the implementation of microtasks (by
instrumenting them).
Change-Id: I54d886db9519c73f9e3218a9cc1c46bc9fe9acc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420221
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-22 07:42:27 -07:00
Derek Xu 1d69b0b980 [VM] Add automatic detection of timers that are significantly overdue
This change makes it so that when the VM detects that a timer is at
least 100 ms overdue, it sends a warning in a VM Service event on the
'Timer' stream.

TEST=Built an Android Flutter app with a modified Engine that contained
a `sleep` call in `eventhandler_linux.cc` and confirmed that the warning
event got sent, built an iOS Flutter app with a modified Engine that
contained a `sleep` call in `eventhandler_macos.cc` and verified that
the warning event got sent,
pkg/vm_service/test/overdue_timer_detection_test

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes.
Change-Id: Ie8db047116b7f63cfb5413f763eaf56c7bdd6975
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409500
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-04-14 07:36:31 -07:00
Liam Appelbe 50a3bf663b [vm] Improve const constructor coverage
The way coverage collection was implemented for const constructors was a bit of a hack. After ordinary coverage collection was complete and all ordinary source ranges had been added to the report, SourceReport::CollectConstConstructorCoverageFromScripts would iterate through all the const constructors and add extra ranges to the source report that reported them as being hit. The old ranges were still in the report, reporting the constructors as missed, but the miss was overwritten by the hit when package:coverage turned the source report into a coverage report. That hacky approach didn't work for branch coverage.

I've refactored it to gather all those const constructor hits before ordinary coverage gathering, and store the hits in the script table. Then during the ordinary coverage collection flow, when we see one of those const constructors, we mark everything inside the function as hit.

This also fixes a related bug that we hadn't noticed before, where calls inside the const constructor were treated as missed.

Note: If there are dozens of const constructors in a single script, it might be worth sorting ScriptTableEntry.const_constructor_hits and then binary searching it, but I don't think that's worth doing atm.

Bug: https://github.com/dart-lang/tools/issues/513
Fixes: https://github.com/dart-lang/tools/issues/513
Change-Id: Ie66a153fbeaac5b3ecfc9a28a7f8d129ab61114a
TEST=source_report_test.cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421720
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2025-04-10 18:00:30 -07:00
Ivan Inozemtsev d510876d9e Revert "[VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization"
This reverts commit 56ccf437e6.

Reason for revert: b/409535026

TEST=ci

Original change's description:
> [VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization
>
> TEST=pkg/vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test,
> pkg/vm_service/test/failure_to_start_vm_service_during_vm_initialization_test
>
> Fixes: https://github.com/dart-lang/sdk/issues/60256
> Change-Id: I0543ab26e5721a4048136f27e8f4429bef04920f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416300
> Commit-Queue: Derek Xu <derekx@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

Change-Id: I61eb42f0f00ad97e95e3ebf19990fe75d2d416aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421622
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-09 09:29:58 -07:00
Derek Xu 56ccf437e6 [VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization
TEST=pkg/vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test,
pkg/vm_service/test/failure_to_start_vm_service_during_vm_initialization_test

Fixes: https://github.com/dart-lang/sdk/issues/60256
Change-Id: I0543ab26e5721a4048136f27e8f4429bef04920f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416300
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-08 08:57:17 -07:00
Derek Xu 19e2a2d58c [VM/Debugger] Make Debugger::FindBestFit skip functions with non-real start or end positions
TEST=confirmed that pkg/vm_service/test/regress_60396_test passes with
the changes in this CL and fails without them

Fixes: https://github.com/dart-lang/sdk/issues/60396
Change-Id: I093fa3abf98b41c47786f0d37987ae771efe072e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420880
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-07 13:48:53 -07:00
Derek Xu 639f293530 [VM/Service] Delete waitForServiceInfo from service_test_common.dart
It is now dead code.

Change-Id: I181cd5ca9f649348763ae9327cb2af62617af8ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419642
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-04-01 11:05:48 -07:00
Derek Xu 069dcae8c5 [VM/Service] Move test logic of http_get_isolate_group_rpc_test from testee to main process
This should fix the test's flakiness.

Change-Id: I3ec88c4154f473a3a9151e49b37e57842abc0a64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419641
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-01 11:05:48 -07:00
Derek Xu eca9969734 [VM/Service] Move test logic of http_get_vm_rpc_test from testee to main process
This should fix the tests' flakiness.

Change-Id: I613e6c21babda6254579b4dc24f7d1da7647e619
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419640
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-01 11:05:48 -07:00
Vyacheslav Egorov 39dc9d8a7d [vm] Intern callstacks when writing Perfetto profile
This significantly reduces the space occupied by callstacks
e.g. 5 second recording of fibonacci computation goes from
1.5Mb to 600Kb.

Also fixes flakiness of pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.

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

This relands commit f07915cb6e
with a fix for Android build.

TEST=ci

Change-Id: Id182692d30e953b20ad2f6ade587e4036fac7e7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418221
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-03-27 06:44:23 -07:00
Vyacheslav Egorov 2a437c54a0 [vm] Intern strings when writing Perfetto timeline
Intern the following fields:

* Category names
* Event labels
* Debug annotation keys and values

This significantly reduces the size of the timeline
(e.g. a timeline containing 60k slices goes from 15Mb
to 5Mb timeline)

This relands commit f2614d24f8
with a fix for Android build.

TEST=ci and manually

Cq-Include-Trybots: luci.dart.try:vm-ffi-android-release-arm64c-try
Change-Id: I88d4c5e1142ff66b270a22b82bacd1e9313fa953
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418220
Reviewed-by: Derek Xu <derekx@google.com>
2025-03-27 06:44:23 -07:00
Vyacheslav Egorov f9e5b9282b Revert "[vm] Intern strings when writing Perfetto timeline"
This reverts commit f2614d24f8.

Reason for revert: Android build broken

Original change's description:
> [vm] Intern strings when writing Perfetto timeline
>
> Intern the following fields:
>
> * Category names
> * Event labels
> * Debug annotation keys and values
>
> This significantly reduces the size of the timeline
> (e.g. a timeline containing 60k slices goes from 15Mb
> to 5Mb timeline)
>
> TEST=ci and manually
>
> Change-Id: I59e850279b6714b8b75c5b8e79e6a8b0a981a261
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417202
> Reviewed-by: Derek Xu <derekx@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I17b83f06ca78fb4b91af554ff4b2aff00366d107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418024
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
2025-03-26 14:26:58 -07:00
Vyacheslav Egorov f07915cb6e [vm] Intern callstacks when writing Perfetto profile
This significantly reduces the space occupied by callstacks
e.g. 5 second recording of fibonacci computation goes from
1.5Mb to 600Kb.

Also fixes flakiness of pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.

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

TEST=ci

Change-Id: I6202ce7e87ceb64f4330b7052e72e519a848e571
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417521
Reviewed-by: Derek Xu <derekx@google.com>
2025-03-26 14:08:23 -07:00
Vyacheslav Egorov f2614d24f8 [vm] Intern strings when writing Perfetto timeline
Intern the following fields:

* Category names
* Event labels
* Debug annotation keys and values

This significantly reduces the size of the timeline
(e.g. a timeline containing 60k slices goes from 15Mb
to 5Mb timeline)

TEST=ci and manually

Change-Id: I59e850279b6714b8b75c5b8e79e6a8b0a981a261
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417202
Reviewed-by: Derek Xu <derekx@google.com>
2025-03-26 14:05:39 -07:00
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -07:00
Sam Rawlins fd3eaa6831 _http: ensure _HttpProfileData.startResponse is called before finishResponse
Fixes https://github.com/flutter/devtools/issues/8509

From my research into the bug:

> I see indeed that `_HttpProfileData.finishResponse()` is called before `_HttpProfileData.startResponse()`. I think this is just a result of microtask scheduling; when the response has no body, `_incoming.dataDone` completes before `_httpRequest._responseCompleter`.

> Since `startResponse` is responsible for setting `responseInProgress` to `true`, the call to `finishResponse` short circuit returns immediately. We therefore don't finish the response timeline, or log the end time, etc.

The fix here does not rely on microtask organization, which I think would be fragile. Instead, we don't listen to the `dataDone` future
until we've logged the start of the response.

Change-Id: Ib735742b297a261e6566ae8caf9eac0d71fc8fdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415140
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-03-17 10:21:44 -07:00
Sigurd Meldgaard 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00
FMorschel 1ce0b0e7ec [analyzer] Adds new warning for multiple combinators
Fixes: https://github.com/dart-lang/sdk/issues/56879
Change-Id: Ifd53878e3603090efa7905b3cd021b8a63344c26
Tested: trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-10 15:43:12 -07:00
Derek Xu 2e238e92d9 [VM/Service] Fix profile_period_cli_option_test
I've seen up to 2500 samples get collected when running this test on
`vm-linux-debug-ia32` configs. 3000 is still significantly less than
5000, so this CL just changes the `lessThan(2000)` expectation to
`lessThan(3000)`.

Fixes: https://github.com/dart-lang/sdk/issues/60257
Change-Id: Iea88ec8dab6a3be9ca843bc445a8205730b8f2aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414280
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-03-07 09:27:40 -08:00
Derek Xu dfb5f034a9 [VM/Debugger] Ignore uninitialized late variables when building scope in ActivationFrame::BuildParameters
Following the suggestion on
https://github.com/dart-lang/sdk/issues/57048 to plug the crash while
the CFE works on a better solution.

TEST=pkg/vm_service/test/evaluate_uninitialized_late_variable_test

Issue: https://github.com/dart-lang/sdk/issues/57048
Change-Id: I570631e26fb40971674732e4eac73e9fc1976322
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412960
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-02-28 13:49:04 -08:00
Derek Xu 0a7aae2648 [VM/Profiler] Correctly apply the value of --profile-period specified on the CLI
TEST=Verified that pkg/vm_service/test/profile_period_cli_option_test
passes with the changes in this CL and fails without them.

Change-Id: Ic36014abe682f9b4c829317b59bb664683e12d7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412781
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-02-28 10:26:02 -08:00
Derek Xu b08d83706d [VM/Service] Move test logic of http_get_isolate_rpc_test from testee to main process
Issue: https://github.com/dart-lang/sdk/issues/60165
Change-Id: Ic393518dd2b85aa0e5385745bf19591f747791c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411420
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-02-27 12:43:14 -08:00
Derek Xu c33983985f [VM/Service] Ensure that wildcard_test.dart exercises the VM Service's Frame building code
The test didn't catch https://github.com/dart-lang/sdk/issues/60121
because it was defining a named function and the compiler can optimize
wildcard parameters out of named functions.

TEST=confirmed that wildcard_test test passes with the changes in
https://github.com/dart-lang/sdk/commit/411ca9ceac3a762628e239bb6b32af7916e7d416
and fails without them.

Issue: https://github.com/dart-lang/sdk/issues/60121
Change-Id: I67b17b0b1656cb49fc72a9c695e2494b6d9dd184
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410220
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-02-27 12:17:22 -08:00
Sigurd Meldgaard a9ab52bcbb Language version bumps for publish_to: none pkgs
Also a separate pubspec for the tools/ folder

Extracted from https://dart-review.googlesource.com/c/sdk/+/397164

Change-Id: If49a6ede07e4864d0c0fcb210c04c18c804849df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412041
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-02-27 00:48:40 -08:00
Derek Xu 2c790d3823 [VM/Service] Fix get_perfetto_cpu_samples_rpc_test
My change
https://github.com/dart-lang/sdk/commit/f3536c5c4211479918c9de34c9e74d866dd31c52
has made the test start failing on more configs, because now the `fib`
computation isn't lasting long enough for any samples to get collected.
This change makes the `fib` computation take longer.

Issue: https://github.com/dart-lang/sdk/issues/54401
Change-Id: I0f038df21bb116f97a5093e7d2e58ccda7447977
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411161
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2025-02-21 07:37:23 -08:00
Derek Xu f3536c5c42 [VM/Service] Fix get_perfetto_cpu_samples_rpc_test
This test recently flipped back to flaky on vm-linux-debug-ia32. I
believe the problem is that calculating `fib(44)` takes a long time on
less powerful machines, which can cause enough samples to get collected
to fill up the sample buffer and cause data to get overwritten.

Issue: https://github.com/dart-lang/sdk/issues/54401
Change-Id: I63b0bdca5b04b066db098c12cfc22845a9b3c9dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410781
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-02-20 12:26:03 -08:00
Derek Xu 13f5fc6b16 [VM/Service] Fix evaluate_with_scope_with_resident_compiler_test
This test is currently marked as flaky
(https://dart-current-results.web.app/#/filter=pkg/vm_service/test/evaluate_with_scope_with_resident_compiler_test&showAll)
and I believe that this change will fix it.

Issue: https://github.com/dart-lang/sdk/issues/59909
Change-Id: Ib13d298347c1ebd768e4c9ac8fd5449e8291c870
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410780
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-02-19 11:12:28 -08:00
Jens Johansen 8521d4f5d9 [CFE] Fix coverage destroyed by (wrong) offsets on extension method tearoffs
Say you have a class method like this:

```
class Bar {
  /*offset a*/ void /*offset b*/ qux() {
    /*offset c*/ print("hello");
  }
}
```

Lets also say that this method is run.
This will mark offset a and offset c as hits.
Offset b does not exist in coverage terms.

Now say you have an extension mehod like this:

```
extension Foo on Bar {
  /*offset a*/ void /*offset b*/ baz() {
    /*offset c*/ print("hello");
  }
}
```

Lets also say that this method is also executed.
This will mark offset a and offset c as hits.
Offset b does not exist in coverage terms for this method.

Because extension methods are special though we create a special tearoff for
it. Lets say we didn't execute that one.
The tearoff method - before this CL - had offset b on positions that caused
the position to exist in coverage terms, and as the method wasn't executed
this would make it a miss.

This CL fixes the issue by setting the offsets on the tearoff that before
introduced offset b to offset a instead.

Change-Id: I3a5339135f3d76327624b35f04cc14afccaf487a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404563
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-01-27 01:27:50 -08:00
Jens Johansen 46c9c29b6f [vm] Fix crash when expression evaluating with extension type with type parameter is available
Fixes https://github.com/dart-lang/sdk/issues/59653

Tested: Manually; added pkg/vm_service/test/issue_59653_test.dart and existing tests / CI.
Change-Id: I0969720c4d7c50e8756406477abe791891877abb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405381
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-01-23 23:26:39 -08:00
Jens Johansen 663c55b7bd [ package:vm_service ] Deduplicate expression evaluation testing helper
Change-Id: I371ef13859bf73a44e89ffbf0f5f8c042a112e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405362
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-01-23 23:25:22 -08:00
Derek Xu c8151ab03a [VM/Service] Write the info files associated with resident compilers started by tests into temp directories
Also re-enables the tests on vm-win-release-x64 because having different
tests try to communicate with the same resident compiler in parallel was
definitely a source of flakiness, and I don't think there's any way of
knowing whether or not it was the only source of flakiness without
re-enabling it on the bots.

Issue: https://github.com/dart-lang/sdk/issues/59909
Change-Id: I831f32779e0946fb35811edaeaaa5ddb38e51d97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404460
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-01-23 07:59:07 -08:00
Jens Johansen 73a059d406 [ package:vm_service ] Make update_line_numbers tool be able to update entire folder
Also add functionality for the tool to do offsets.

Finally run in on the pkg/vm_service/test/ folder.

Change-Id: Ifa4ca60ed0707e6211baf4b9df140802d5cecf6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404881
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-01-23 06:31:51 -08:00
Derek Xu 337e07fab6 [VM/Service] Use the resident frontend server for hot reload when it's available
TEST=pkg/vm_service/test/reload_sources_with_resident_compiler_test.dart
and pkg/vm_service/test/breakpoint_resolution_after_reloading_with_resident_compiler_test.dart

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes within
sdk/lib/vmservice/.
Change-Id: Ibc99cd37439ddd8aca97fa7e18a5112cbfc3b4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401646
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-01-08 14:51:12 -08:00
Derek Xu 7e94becfe4 Unconditionally shut down the resident frontend server after each VM Service test run that uses it
Change-Id: I67af9d4813a5b9e7a3b425bb8dc3394923f9a90d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403400
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-01-07 07:58:37 -08:00
Derek Xu 26fdfabf14 [VM/Service] Use the resident frontend server for expression evaluation when it's available
TEST=tests added to pkg/vm_service/test

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes within
sdk/lib/vmservice/.
Change-Id: I191bb7f3ec3abf1f42405a43ce72016796bc43f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394523
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-12-20 09:00:17 -08:00
Vyacheslav Egorov f1394aa2db [vm] Fix unwinding through FutureIterable and FutureRecordN wait
Add awaiter-links leading from callbacks attached to
the original Futures to Completer produced by wait.

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

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

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

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

CoreLibraryReviewExempt: No API or significant implementation changes
Change-Id: I904b441b27c4e06f08b7ea7ba066a2fb03504ce6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401062
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-12-18 11:39:40 -08:00
Derek Xu 652794d16d [VM/Debugger] Mark the = tokens within assignment statements as locations where breakpoints can be set
TEST=pkg/vm_service/test/break_on_equals_signs_of_assignments_test.dart

Fixes: https://github.com/dart-lang/sdk/issues/56932
Change-Id: Id5ed23c645b614586e4bf769dbbea9704035746b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398680
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-12-16 08:14:21 -08:00
Derek Xu 1c8a22605d [VM/Service] Add stoppedAtLineColumn helper to service_test_common.dart
Change-Id: Iba6d24eaaa521b428f2df72c887de11302b2f037
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398980
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-12-16 08:14:21 -08:00
Jens Johansen e8ebee8845 [CFE] Expression evaluation will use static type when given 'dynamic'
Fixes https://github.com/dart-lang/sdk/issues/57040

Change-Id: I0f954390c364a91816f66af821e12bee93d4746a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400302
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-12-16 00:28:58 -08:00
Jens Johansen 555d9ea9c3 [vm_service] Rename another test to _test
I missed this one in
https://dart-review.googlesource.com/c/sdk/+/400320/ - although I did
add the entry for it in pkg/pkg.status :/

Change-Id: Iedcd0ba4804b136e73397939183a1535becec4fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400560
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-12-13 05:35:38 -08:00
Jens Johansen aa6ed3fff7 [vm_service] Renamed badly named tests to _test.dart
We've accumulated some tests that wasn't named as such, thus not
actually being run.

Change-Id: Ia42a99de14312af6f7b3ddfa5a107b74bf5ae663
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400320
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-12-12 23:08:49 -08:00
Jens Johansen 91ba6976db [CFE/VM] Fix expression evaluation to not introduce new parameters because of extension types
To support expression evaluation on extension types - which are a static
thing and thus doesn't exist in the VM - on the CFE side we try to find
the available variables so that, for any variables that are found to be
extension types, we can treat them as such. This was introduced in
https://dart-review.googlesource.com/c/sdk/+/339900.

The problem is that this could accidentally _introduce_ new variables,
which would introduce new arguments to the created procedure causing
weird behavior in the VM as for instance seen in
https://github.com/dart-lang/sdk/issues/56911.

This CL makes sure to only set the type for already known variables (as
passed by the VM), thus not introducing new variables and fixing the
issues seen.

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

Change-Id: Ie8b8ae12438338e9c3d248d00cc5da81df5b8ece
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-12-12 23:03:32 -08:00
Jens Johansen f9f7b29acd [VM] Mark initializing formal variables as invisible
Fixes https://github.com/dart-lang/sdk/issues/59661

Tested: pkg/vm_service/test/issue_59661.dart and existing tests.
Change-Id: I09f708dabfeb71ae8aa078d73fc23295562a451c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399900
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-12-11 09:03:40 +00:00
Derek Xu 3f6928c172 [VM/Service] Correctly forward errors returned by external clients that handle 'compileExpression' requests
TEST=pkg/vm_service/test/forward_compile_expression_error_from_external_client_with_dds_test.dart
and pkg/vm_service/test/forward_compile_expression_error_from_external_client_without_dds_test.dart

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes in
sdk/lib/vmservice/running_isolates.dart.
Fixes: https://github.com/dart-lang/sdk/issues/59603
Change-Id: I2b9edf69feb6149c80afe9fc753c73e069af0479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397580
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-11-27 17:31:07 +00:00