Commit graph

103 commits

Author SHA1 Message Date
Ben Konyi 4e688b1a59 [ Service / AOT ] Include line numbers for Functions in AOT snapshots
Fixes https://github.com/dart-lang/sdk/issues/48839

TEST=Checked CPU profile for Flutter Gallery in profile mode

Change-Id: I83f372aebd77b93b459720ceb2dd9e5fa05b4475
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245200
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-06-02 16:50:19 +00:00
Ryan Macnak f76b6a8cc1 Reland "[vm] Add a timeline recorder that streams to a file."
Adjust TimelineEvent::PrintJSON to use JSONWriter for compatibility with PRODUCT mode.

TEST=ci
Change-Id: I694889c655719371364012b4324b7947d7b2d5e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240911
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-19 00:56:46 +00:00
Ben Konyi ea48265725 Reland "[ VM / Service ] Omit private fields from service responses by default"
Adds better error handling in DDS to prevent google3 breakages due to
Flutter binary update lag times.

This reverts commit 28e958febb.

TEST=N/A

Change-Id: Ida454f0ef3caeedd1b0326c37fef58d4b73557d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227620
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-01-11 23:35:28 +00:00
Ivan Inozemtsev 28e958febb Revert "Reland "[ VM / Service ] Omit private fields from service responses by default""
This reverts commit 91a496e5db.

Reason for revert: breaks hot reloads internally

Original change's description:
> Reland "[ VM / Service ] Omit private fields from service responses by default"
>
> This reverts commit 7d39d2dd51.
>
> TEST=N/A
>
> Change-Id: I2119c841719c77be5380857ce209532ed036bd0e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226322
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I6e751343244a4788a1f080ea1aef5fdd18417109
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227503
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2022-01-11 14:06:04 +00:00
Ben Konyi 91a496e5db Reland "[ VM / Service ] Omit private fields from service responses by default"
This reverts commit 7d39d2dd51.

TEST=N/A

Change-Id: I2119c841719c77be5380857ce209532ed036bd0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226322
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-01-06 18:05:36 +00:00
Michal Terepeta 7d39d2dd51 Revert "[ VM / Service ] Omit private fields from service responses by default"
This reverts commit 75abd86407.

Reason for revert: Breaks internal tests (http://b/207612278)

Original change's description:
> [ VM / Service ] Omit private fields from service responses by default
>
> Service responses and events previously could include "private"
> properties, which have names starting with "_". This change removes
> these properties from service objects unless explicitly requested via a
> private parameter.
>
> See go/smaller-dart-vm-service-responses for response size reduction
> data.
>
> TEST=Existing service suite
>
> Change-Id: Ia65b14872e798eaa843f7d180c57721b82371d0b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221143
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I0b015baadfcdf4211426efa9a92804b163f88649
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221280
Reviewed-by: Michal Terepeta <michalt@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
2021-11-25 10:28:33 +00:00
Ben Konyi 75abd86407 [ VM / Service ] Omit private fields from service responses by default
Service responses and events previously could include "private"
properties, which have names starting with "_". This change removes
these properties from service objects unless explicitly requested via a
private parameter.

See go/smaller-dart-vm-service-responses for response size reduction
data.

TEST=Existing service suite

Change-Id: Ia65b14872e798eaa843f7d180c57721b82371d0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221143
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-11-24 00:34:31 +00:00
Ryan Macnak e3a9d70591 [vm, service] Remove unsafe querying across threads during Isolate::PrintJSON.
Note this would be unsafe even if under a safepoint operation because not all of the queried threads participate in safepoints.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/44304
Bug: https://github.com/dart-lang/sdk/issues/44385
Change-Id: I8156e8c6049165e5c53b66c3391f3e8a496ddaaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175000
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-12-08 00:36:38 +00:00
Ben Konyi c54ec8d5f3 [ package:dds ] Handle expression evaluation invocations in DDS and forward compileExpression calls to clients which provide their own compilation service.
Change-Id: I2daec26929ad4f530d28d0073a0b2758850bec0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150694
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-06-11 22:43:39 +00:00
Ryan Macnak 6fe15f6df9 [vm] Represent tagged pointers as C++ value types instead of C++ pointer types.
This works around bugs in UndefinedBehaviorSanitizer and Clang.

Bug: b/28638298
Change-Id: I6be595f9664516019d28017d24559583a1ae3a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144354
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-25 05:21:27 +00:00
Alexander Aprelev 9e636b5ab4 Reland "[vm/service] Introduce IsolateGroup entity to vm service api.""
This reverts commit f020ce5d23 with patchset 1 having original revert, rest - fixes
for calling destructors on unlinked IntrusiveDL elements and for assuming int is int64(which breaks down on simarm, ia32 bots).

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

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

Change-Id: I867526c7de3786806670d1f43dbff07228f80028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121870
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-10-17 03:45:41 +00:00
Alexander Aprelev f020ce5d23 Revert "[vm/service] Introduce IsolateGroup entity to vm service api."
This reverts commit f219e5152d as it breaks few bots.

Change-Id: I8d1d42d1ac662c2dba9ea9270c7a6cdc4f0621bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121886
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-10-16 19:45:23 +00:00
Alexander Aprelev f219e5152d [vm/service] Introduce IsolateGroup entity to vm service api.
This is to enable vm clients to ask how much memory is consumed by isolate group.

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

Change-Id: I4f1c499bf02c20b80e9802d8ad60e7ea65cfb375
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119724
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-16 18:05:06 +00:00
Ben Konyi a75ded625e [ VM / Service ] Made VM timeline functionality public through the service API.
Change-Id: I8228f0417047af53edc6f570940d452da3155bbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106061
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-06-19 16:06:12 +00:00
Ben Konyi 2babb218d6 [ VM / Service ] Removed fixedId parameter from Isolate responses
Change-Id: I0c8c9caa78d770ebe5c57202e6bebe029774c7f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104080
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-05-31 00:20:15 +00:00
Ryan Macnak a651838652 [vm] Fix misc printf format bugs.
Bug: https://github.com/dart-lang/sdk/issues/35009
Change-Id: I6b509e1eb8e76e07f60a086c67358d65d2a1fae4
Reviewed-on: https://dart-review.googlesource.com/c/82460
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-01 16:37:22 +00:00
Alexander Aprelev a5e41681e5 Add support for expression compilation via service.
If there is registered expression compiler, VM debugger uses it to compile expressions. Otherwise, it will fallback to use kernel service compiler.
This is needed to support Flutter use case where compiler is running on developer's host machine, not on the device where VM is running.

Bug: dartbug.com/31981
Change-Id: I8bdfc8ab45a57c306169abe189f1e24e1b0bcf40
Reviewed-on: https://dart-review.googlesource.com/57520
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-06-05 04:16:39 +00:00
Alexander Markov 172786b906 [VM] Extract simple JSON writer out of VM service-specific JSONStream
The purpose of this refactoring is to provide a convenient way to
write JSON independently of VM service, which is excluded in PRODUCT
build mode.

Change-Id: I55700d9ead6ef9269a98714d8178f1edb35435cb
Reviewed-on: https://dart-review.googlesource.com/18502
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-11-03 18:31:50 +00:00
Ryan Macnak 5efa08b663 Reapply "[reload] Add facility to check for program elements changed in the last reload but not executed."
- Weaken assert for identity reloads to account for lazy finalization.
 - Store actual field end positions instead of computing from a terminating semicolon.
 - Consider unfinalized classes to be unchanged if they have same sequence of tokens.

Change-Id: I3fcd7fed924bfac47dc382702ce63207bb8aa031
Reviewed-on: https://dart-review.googlesource.com/8164
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-09-27 02:50:35 +00:00
Ryan Macnak 9dd3730ea2 Revert "[reload] Add facility to check for program elements changed in the last reload but not executed."
This reverts commit 4a0d5cbf3f.

Change-Id: Ic90f78443b5c1878ac6f17a1a1439f8e4515db42
Reviewed-on: https://dart-review.googlesource.com/7681
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-21 22:56:39 +00:00
Ryan Macnak 4a0d5cbf3f [reload] Add facility to check for program elements changed in the last reload but not executed.
Change-Id: Ifdc73166be68c5d2915e8b9d71db0a09d06835a0
Reviewed-on: https://dart-review.googlesource.com/5330
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-09-21 20:28:06 +00:00
Ryan Macnak 3d21a46b72 Limit preserialized JSON for timeline events from Dart code to the arguments.
Avoids string copies in C++ and map copies in Dart.

Also remove some vestiages of removed feature that allowed an embedder to add pre-encoded events to the timeline.

Change-Id: I962a67093ba461c991d9169b0391c44af1d489db
Bug: https://github.com/dart-lang/sdk/issues/30787
Reviewed-on: https://dart-review.googlesource.com/6762
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-19 23:29:55 +00:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Ben Konyi c0511ad2ef Reimplemented zone memory tracking to avoid race conditions that were causing crashes in the previous implementation and made some minor name changes.
BUG=
R=asiva@google.com, johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2762323002 .
2017-03-23 09:03:08 -07:00
John McCutchan ebe7d148f3 Document some recent service protocol features
Document the `reloadSources` RPC.

Document the `PausePostRequest` pause event.

Document the 'IsolateReloaded' event.

BUG=
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2614643003 .
2017-01-04 13:45:27 -08:00
Ben Konyi 35a49bc1ff Created methods to surface zone memory information for each isolate and thread in JSON.
BUG=
R=asiva@google.com, johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2554983002 .
2016-12-12 09:56:49 -08:00
Todd Turnidge e0d350aa27 Implement rewind on all platforms except for dbc.
BUG=

Review URL: https://codereview.chromium.org/2534413005 .
2016-12-01 17:19:31 -08:00
Todd Turnidge 193ddba4db Revert "Implement rewind: drop one or more frames from the debugger."
This reverts commit af1875be91.

BUG=

Review URL: https://codereview.chromium.org/2521413002 .
2016-11-22 16:05:26 -08:00
Todd Turnidge af1875be91 Implement rewind: drop one or more frames from the debugger.
Not yet implemented on dbc.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2523053002 .
2016-11-22 15:26:08 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
John McCutchan d8eb5ffb57 Do not allow a hot reload if the isolate has a sticky error
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/2278613002 .
2016-08-24 11:31:46 -07:00
Ryan Macnak d418dde65b Reduce copying in sending service responses.
Add missing safepoint transitions.

Issue #27092
Likely contributes to Issue #27010

dart2js hello
Peak RSS at first Observatory visit -> Peak RSS after visiting timeline (with endless recorder)
Before 215M -> 321M
After 182M -> 233M

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2254543006 .
2016-08-18 10:34:50 -07:00
John McCutchan 51ace86544 Bug fixes for hot reload
- [x] Report the reload error synchronously from the _reloadSources RPC.
- [x] Add sticky reload error to an isolate so we can report the error.
- [x] Remove redundant 'OnStackReload'.
- [x] Fix a bug where a class could have a field added but we wouldn't reject it.
- [x] Add unit test for above bug fix.
- [x] Enable reload via the service protocol with a live stack.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2070873002 .
2016-06-16 11:02:35 -07:00
John McCutchan 1a4c2005cc DevFS initial implementation.
This cl implements an experimental filesystem maintained in the vm, called dart-devfs.  This will allow service protocol users to read and write source files while the vm is running.  This is needed for the reload support for flutter.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/2059883003 .
2016-06-10 12:33:50 -07:00
John McCutchan 48c8ffa7f3 Initial isolate reload support
This is a cut of the work that Todd and I collaborated on in the reload branch.

In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet.

- [x] Support for hot reloading of isolate source code
- [x] Unit test harness and many tests
- [x] Service protocol and Observatory support
- [x] Product build does not include support for hot reloading.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1965823002 .
2016-05-17 12:19:06 -07:00
Todd Turnidge 5e196ada5d VMMustBePaused -> IsolateMustBePaused
Closes #24537

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1973303003 .
2016-05-16 11:19:22 -07:00
John McCutchan 9bc7398eb8 Ensure embedder timeline callbacks are called for service protocol requests
BUG=
R=chinmaygarde@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1799933002 .
2016-03-15 07:59:04 -07:00
John McCutchan 32abe2ce55 Stream blocks of timeline events over the service protocol. Can be used to monitor long running programs without buffering all events inside the VM.
- Rename TimelineEventStreamingRecorder to TimelineEventCallbackRecorder. Note that this should only be used for tests.

- Add 'Timeline' service event stream.
- Send a 'TimelineEvents' event on the 'Timeline' stream whenever a TimelineEventBlock is finished and the 'Timeline' stream is subscribed to.

- Simple service protocol test.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1765563002 .
2016-03-04 12:30:50 -08:00
John McCutchan d77d376124 Replace intptr_t with TokenDescriptor
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).

There are some cleanups I plan on doing as a follow up CL:

- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()

R=iposva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
Todd Turnidge 222f6726d0 getObject now supports specifying offset,count for strings.
Closes #25157

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1653183002 .
2016-02-01 14:49:47 -08:00
John McCutchan ce650790a1 Return an error in many service RPCs if the isolate is not runnable
- Return kIsolateMustBeRunnable error when an isolate must be runnable for a service RPC to complete.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1645423002 .
2016-01-29 11:16:23 -08:00
John McCutchan 89c49b9e87 Add dart:developer.postEvent for posting events to the service protocol from Dart code
- Add dart:developer.postEvent for posting events to the service protocol.
- Add 'Extension' service protocol event stream.
- Unit test.
- Update service.md

- Bug fix for logging stream.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1537523002 .
2015-12-17 09:34:52 -08:00
Ivan Posva 6249c2bcf3 - Remove the legacy debug protocol.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1497033003 .
2015-12-03 17:46:02 -08:00
Ryan Macnak df64bb1619 - Annotate instructions that load objects from the ObjectPool or Thread.
- Remove disassembly tooltips.
- Surface whether a function has an intrinsic or is recognized.
- Mark intrinsified or ffi functions in the profile.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1439893002 .
2015-11-12 15:18:31 -08:00
John McCutchan f55de246ec More timeline cleanups
- Blocks are associated with threads and not isolates.
- Fix isolate filters when iterating over blocks and events.
- Always add the isolateNumber argument when serializing events.
- Add new (kSerializedJSON) EventType for events already serialized to JSON.
- Have events coming from Dart code use the standard event structure w/ type = kSerializedJSON.
- Remove now unused DartTimelineEvent and machinary.
- Dart and C++ events now use the same structures and system.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1411783004 .
2015-10-20 09:14:23 -07:00
Todd Turnidge cc672473b9 Use offset and count to request slices of lists, maps, and typed_data.
This should allow debugging clients to support pagination of these
potentially large types.

Closes #24536

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1400393002 .
2015-10-14 11:05:21 -07:00
Todd Turnidge 435bcdbe6c We can now name the current VM using the service protocol.
Adds a 'VM' stream and a 'VMUpdate' event.

Makes Event.isolate optional in service.md.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1398823002 .
2015-10-08 15:37:49 -07:00
John McCutchan fd6135927e Ensure that service protocol specification and implementation use the correct numeric types
Fixes #24245

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1387433002 .
2015-10-01 11:05:13 -07:00
John McCutchan 3d0c4bf586 Make timeline use the same clock source as mojo's tracing infrastructure
- This ensures that we have consistent timestamps across processes.
- This is necessary to properly support mojo.
- Add new public API to query timeline clock.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1367973004 .
2015-09-25 10:04:23 -07:00