Commit graph

727 commits

Author SHA1 Message Date
Martin Kustermann 23109940e0 [vm] Separate for-snapshot vs embed-sources bools when compiling to kernel
Fixes https://github.com/dart-lang/sdk/issues/53010

TEST=Fixes vm/dart/regress_48523_test

Change-Id: I2066ffd250228c01bb7aa2de5d1d0362ba6f7071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316581
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-07-28 10:01:53 +00:00
asiva 5d872a8737 [VM/Runtime] - Deprecate Dart_UpdateExternalSize and Dart_UpdateFinalizableExternalSize from the Dart C API
https://github.com/dart-lang/sdk/issues/52568

TEST=new test added.

Change-Id: I4f4b6b607fa2e0daa14fc25e3bdf99214f6ccb6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-07-20 17:06:44 +00:00
Daniel Bali a3e84160ec Expand collection of object instances.
TEST=vm/dart/analyze_snapshot_binary_test

Change-Id: I96ef5d8fc92292151444e52d189e6b2d10a99375
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308303
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-07-03 12:29:15 +00:00
Ryan Macnak dbd7b967af [fuchsia] Plumbing for the VMEX resource.
TEST=ci
Change-Id: I2e812e6eef2a3c6f91aec955609ece2ca4df15a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308805
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-06-20 19:28:18 +00:00
Derek Xu f98f292708 Reland "[VM/Timeline] Add Dart_RecordTimelineEvent Embedder API to support reporting flow events that can be serialized in Perfetto's format"
Patchset 1 is a reland of commit
f52bdb96aa, and Patchset 2 adds a
corrected reland of commit 0d0e301979.

The leak in g3 was caused by moving the `state_ = 0;` line before the
`owns_label()` check in `TimelineEvent::Reset`.

TEST=Ran the g3 tests that were failing on a cbuild copy with these
changes (sponge2/1134a5bb-5168-4e4c-bb03-72a7d7ad6ab4).

Original change's description:
> [VM/Timeline] Add Dart_RecordTimelineEvent Embedder API to support reporting flow events that can be serialized in Perfetto's format
>
> Added a deprecation notice to Dart_TimelineEvent as well.
>
> TEST=Used the embedder API to report an events of each of the following types:
> Dart_Timeline_Event_Begin, Dart_Timeline_Event_Duration,
> Dart_Timeline_Event_Instant, Dart_Timeline_Event_Async_Begin, and
> Dart_Timeline_Event_Async_Instant, each associated with flow IDs. Then,
> retrieved the trace using GetPerfettoVMTimeline and checked that flow arrows
> were displayed correctly in the Perfetto trace viewer.
>
> Change-Id: I82e49554b5970767e306dc4149a782e99a5c6512
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302963
> Commit-Queue: Derek Xu <derekx@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

Change-Id: I08783d6b5575fb3fe43da3203e58902bf9b7d038
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308721
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-06-12 19:31:38 +00:00
Derek Xu 524cf849b2 Revert "[VM/Timeline] Add Dart_RecordTimelineEvent Embedder API to support reporting flow events that can be serialized in Perfetto's format"
This reverts commit f52bdb96aa.

Reason for revert: https://dart-review.googlesource.com/c/sdk/+/308360
was reverted due to g3 problems, and the code in this CL will leak
without the code in that CL.

Original change's description:
> [VM/Timeline] Add Dart_RecordTimelineEvent Embedder API to support reporting flow events that can be serialized in Perfetto's format
>
> Added a deprecation notice to Dart_TimelineEvent as well.
>
> TEST=Used the embedder API to report an events of each of the following types:
> Dart_Timeline_Event_Begin, Dart_Timeline_Event_Duration,
> Dart_Timeline_Event_Instant, Dart_Timeline_Event_Async_Begin, and
> Dart_Timeline_Event_Async_Instant, each associated with flow IDs. Then,
> retrieved the trace using GetPerfettoVMTimeline and checked that flow arrows
> were displayed correctly in the Perfetto trace viewer.
>
> Change-Id: I82e49554b5970767e306dc4149a782e99a5c6512
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302963
> Commit-Queue: Derek Xu <derekx@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

Change-Id: I98a259c7de8fa4b7dbcbe42f7332ab20b553e9cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308680
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-06-12 15:40:07 +00:00
Derek Xu f52bdb96aa [VM/Timeline] Add Dart_RecordTimelineEvent Embedder API to support reporting flow events that can be serialized in Perfetto's format
Added a deprecation notice to Dart_TimelineEvent as well.

TEST=Used the embedder API to report an events of each of the following types:
Dart_Timeline_Event_Begin, Dart_Timeline_Event_Duration,
Dart_Timeline_Event_Instant, Dart_Timeline_Event_Async_Begin, and
Dart_Timeline_Event_Async_Instant, each associated with flow IDs. Then,
retrieved the trace using GetPerfettoVMTimeline and checked that flow arrows
were displayed correctly in the Perfetto trace viewer.

Change-Id: I82e49554b5970767e306dc4149a782e99a5c6512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302963
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-06-08 21:32:38 +00:00
Christophe B b66afce6ca Add missing void in function declarations to avoid warning
Closes https://github.com/dart-lang/sdk/pull/52563

GitOrigin-RevId: e7577ad346046a30712fbec61243af2779f24c72
Change-Id: I066f363f4197171cdb45f8679279239f780a59ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307880
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-06-08 13:16:18 +00:00
Derek Xu 475240d234 Reland "[VM/Timeline] Make timestamp1_or_id variables more understandable"
This is a reland of commit 46e70a7c07

It turns out that flow events do need to be associated with IDs in
Chrome's trace format, so the diff between patchset 1 and 6 contains the
changes required to document that.

TEST=Checked that duration events still looked correct in traces written
by the Perfetto file recorder. Checked that events still looked correct
in traces recorded to the MacOS recorder. Checked that flow events still
looked correct in Observatory. Ran the
vm/cc/DartAPI_TimelineEvents_Serialization test in debug mode, and with
ASAN and TSAN.

CoreLibraryReviewExempt: Does not change any APIs, just stops passing a
value that will never be read. Specifically, we do not need to pass a
flow ID on the end side of track events.
Change-Id: I6b8bb3236339dbe54378b2e9dea06faf22b964a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306664
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-06-01 19:50:38 +00:00
Derek Xu e7fd092044 Revert "Reland "[VM/Timeline] Make timestamp1_or_id variables more understandable""
This reverts commit 46e70a7c07.

Reason for revert: New asserts failing in Flutter Engine tests

Original change's description:
> Reland "[VM/Timeline] Make timestamp1_or_id variables more understandable"
>
> Relanding without changes because the cbuild failure was unrelated.
>
> TEST=Checked that duration events still looked correct in traces written
> by the Perfetto file recorder. Checked that events still looked correct
> in traces recorded to the MacOS recorder.
>
> This is a reland of commit 354e1d22cb
>
> Original change's description:
> > [VM/Timeline] Make timestamp1_or_id variables more understandable
> >
> > This CL improves documentation, and renames fields/methods to make it
> > more understandable that timestamp1 and id are stored in the same field
> > of dart::TimelineEvent (because the event types that need to store
> > timestamp1 are disjoint from the ones that need to store id).
> >
> > TEST=Checked that duration events still looked correct in traces written
> > by the Perfetto file recorder. Checked that events still looked correct
> > in traces recorded to the MacOS recorder.
> >
> > Change-Id: I25ff1f4c6cc432f035ac2be99fa7f162290ea77f
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305880
> > Reviewed-by: Ben Konyi <bkonyi@google.com>
> > Commit-Queue: Derek Xu <derekx@google.com>
>
> Change-Id: I28c0c3af9869900cc8bb2b3b416904a231d143e0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306301
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: Ia1fe524268c06fd68c689fe048d8cc38a6ed8a23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306661
Reviewed-by: Ben Konyi <bkonyi@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-31 16:51:49 +00:00
Derek Xu 46e70a7c07 Reland "[VM/Timeline] Make timestamp1_or_id variables more understandable"
Relanding without changes because the cbuild failure was unrelated.

TEST=Checked that duration events still looked correct in traces written
by the Perfetto file recorder. Checked that events still looked correct
in traces recorded to the MacOS recorder.

This is a reland of commit 354e1d22cb

Original change's description:
> [VM/Timeline] Make timestamp1_or_id variables more understandable
>
> This CL improves documentation, and renames fields/methods to make it
> more understandable that timestamp1 and id are stored in the same field
> of dart::TimelineEvent (because the event types that need to store
> timestamp1 are disjoint from the ones that need to store id).
>
> TEST=Checked that duration events still looked correct in traces written
> by the Perfetto file recorder. Checked that events still looked correct
> in traces recorded to the MacOS recorder.
>
> Change-Id: I25ff1f4c6cc432f035ac2be99fa7f162290ea77f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305880
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: I28c0c3af9869900cc8bb2b3b416904a231d143e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306301
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-30 15:40:33 +00:00
Derek Xu 2e29ed3874 Revert "[VM/Timeline] Make timestamp1_or_id variables more understandable"
This reverts commit 354e1d22cb.

Reason for revert: broke cbuild

Original change's description:
> [VM/Timeline] Make timestamp1_or_id variables more understandable
>
> This CL improves documentation, and renames fields/methods to make it
> more understandable that timestamp1 and id are stored in the same field
> of dart::TimelineEvent (because the event types that need to store
> timestamp1 are disjoint from the ones that need to store id).
>
> TEST=Checked that duration events still looked correct in traces written
> by the Perfetto file recorder. Checked that events still looked correct
> in traces recorded to the MacOS recorder.
>
> Change-Id: I25ff1f4c6cc432f035ac2be99fa7f162290ea77f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305880
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: I37c74620105299c0b5e7725fd994609af177a9f8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306280
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-29 19:10:27 +00:00
Derek Xu 354e1d22cb [VM/Timeline] Make timestamp1_or_id variables more understandable
This CL improves documentation, and renames fields/methods to make it
more understandable that timestamp1 and id are stored in the same field
of dart::TimelineEvent (because the event types that need to store
timestamp1 are disjoint from the ones that need to store id).

TEST=Checked that duration events still looked correct in traces written
by the Perfetto file recorder. Checked that events still looked correct
in traces recorded to the MacOS recorder.

Change-Id: I25ff1f4c6cc432f035ac2be99fa7f162290ea77f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305880
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-29 18:46:54 +00:00
Vyacheslav Egorov f86f41226d [vm/timeline] Include callback data into Dart_TimelineRecorderEvent.
This simplifies embedders which otherwise need to maintain
special mappings to find their isolate specific data structures.

TEST=vm/cc/DartAPI_SetTimelineRecorderCallback

Change-Id: If819437cad2e1bf3fe5ba50fe67d01e8bd992064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304962
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-05-25 10:19:48 +00:00
Ben Konyi 8d97964e6e [ VM ] Move class name from heap profiler report callback to allocation callback
Moving the class name of the allocated object to the allocation callback
gives more flexibility to the embedder, which may decide to track all
sampled allocations, not just those that are still alive.

TEST=Updated DartAPI_HeapSampling_*

Change-Id: Iaae290e15b67ca3e47d72e1896fa6e32b2d4b081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297761
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-04-25 13:02:49 +00:00
Martin Kustermann f9eb97fdff Reland "[vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}"
For applications that want to have arbitrary number of isolates call
into native code that may be blocking, we expose the API functions that
allows those native threads to exit an isolate before running
long/blocking code.

Without the ability to exit/re-enter isolate, one may experience
deadlocks as we have a fixed limit on the number of concurrently
executing isolates atm.

In the longer term we may find a way to do this automatically
with low overhead, see [0]. But since those API functions are quite
stable and we already expose e.g. `Dart_{Enter,Exit}Scope`, I don't
see a reason not to expose `Dart_{Enter,Exit}Isolate`.

Difference to original CL:

  Do use STL synchronization primitives (as the ones in runtime/bin
  are not always available in shared libraries)


[0] Issue https://github.com/dart-lang/sdk/issues/51261

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

TEST=ffi{,_2}/dl_api_exit_enter_isolate_test

Change-Id: Id817e8d4edb3db35f029248d62388cbd0682001d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294980
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-04-13 09:20:17 +00:00
Ben Konyi 33e54edb53 [ VM ] Add force_gc parameter to Dart_ReportSurvivingAllocations
Also in this change:
 - Add heap_size to Dart_HeapSamplingCreateCallback
 - Remove heap_size from Dart_HeapSamplingReportCallback

TEST=Existing dart_api_impl_tests updated

Change-Id: Iaa8d340de94d95f93c94f4a3d29d6d889dad49de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294800
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-12 17:28:13 +00:00
Ryan Macnak 783d0ef90a Revert "[vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}"
This reverts commit a2512819f8.

Reason for revert: FFI tests fail to link on Windows, fail to load on product-mode Android

Original change's description:
> [vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}
>
> For applications that want to have arbitrary number of isolates call
> into native code that may be blocking, we expose the API functions that
> allows those native threads to exit an isolate before running
> long/blocking code.
>
> Without the ability to exit/re-enter isolate, one may experience
> deadlocks as we have a fixed limit on the number of concurrently
> executing isolates atm.
>
> In the longer term we may find a way to do this automatically
> with low overhead, see [0]. But since those API functions are quite
> stable and we already expose e.g. `Dart_{Enter,Exit}Scope`, I don't
> see a reason not to expose `Dart_{Enter,Exit}Isolate`.
>
> [0] Issue https://github.com/dart-lang/sdk/issues/51261
>
> Issue https://github.com/dart-lang/sdk/issues/51254
>
> TEST=ffi{,_2}/dl_api_exit_enter_isolate_test
>
> Change-Id: I91c772ca962fddb87919663fea07939a498fa205
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292722
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I05ad5b9ce24754a68693160e470f8eb71a812c75
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294860
Auto-Submit: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-04-12 16:39:19 +00:00
Martin Kustermann a2512819f8 [vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}
For applications that want to have arbitrary number of isolates call
into native code that may be blocking, we expose the API functions that
allows those native threads to exit an isolate before running
long/blocking code.

Without the ability to exit/re-enter isolate, one may experience
deadlocks as we have a fixed limit on the number of concurrently
executing isolates atm.

In the longer term we may find a way to do this automatically
with low overhead, see [0]. But since those API functions are quite
stable and we already expose e.g. `Dart_{Enter,Exit}Scope`, I don't
see a reason not to expose `Dart_{Enter,Exit}Isolate`.

[0] Issue https://github.com/dart-lang/sdk/issues/51261

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

TEST=ffi{,_2}/dl_api_exit_enter_isolate_test

Change-Id: I91c772ca962fddb87919663fea07939a498fa205
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292722
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-12 13:22:23 +00:00
Martin Kustermann 042c3f6c76 [vm] Cleanup unused metric accessors in VM
Only a few of the metrics are accessed via Dart C API, so we can remove
the rest from the C API surface.

The VM metrics seem to be unused entirely.

TEST=ci

Change-Id: I03be78ed2f223aa6fba80f663fb12c8ef9a66cb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291762
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-03-29 19:58:33 +00:00
Martin Kustermann 02947b5aff [vm] Remove Dart_SetGCEventCallback() API
The only user of this API is no longer using it (see cl/519087228).

It's possible we'd re-introduce such an API in the future,
in which case we may want to:

 - make it more clear what the GC times mean (are concurrent threads for
   mark/sweep or parallel threads for paralell marking included,
   is time in wallclock or cpu time, ...)

 - include information more useful for users, such as maximum
   synchronous pause times

TEST=ci

Change-Id: Idec6f1fdc406956889dd858f280dfe84bed0d10f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291260
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-03-29 08:06:08 +00:00
Ben Konyi 689042093d [ VM ] Re-work heap sampling profiler APIs to make use of WeakTable
TEST=updated dart_api_impl_test tests

Change-Id: Ibb6789286a88c96151a466617054d703cceed61e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290160
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-24 14:00:09 +00:00
Daco Harkes 14e4a52657 [vm] Fix Dart_CObject_Type breaking change
https://dart-review.googlesource.com/c/sdk/+/257925 added a new entry
in the middle of the `Dart_CObject_Type` enum, which changed the
value of the entries below. However, this enum is part of
`dart_api_dl.h` and versioned by `dart_version.h`.

New entries to `Dart_CObject_Type` should be added at the end of the
enum to avoid making breaking changes to the type.

TEST=tests/ffi/vmspecific_handle_dynamically_linked_test.dart

Bug: https://github.com/dart-lang/sdk/issues/51459

Change-Id: I367b54f62e59ddf925e255bb56c0f8660be7c227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284161
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-02-20 11:59:19 +00:00
Ryan Macnak c81b00938d [standalone] Fix memory leak in the tag handler.
TEST=asan
Bug: https://github.com/dart-lang/sdk/issues/37030
Bug: https://github.com/dart-lang/sdk/issues/51210
Change-Id: Ia62a4d7d1805c6ac4a311ef9952fff248e7b4693
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280284
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-02 21:35:47 +00:00
Josh Soref f7a2ea5e06 Spelling
Closes https://github.com/dart-lang/sdk/pull/50922

GitOrigin-RevId: 58fd7cfd5ef470a65a52ea28e0407244d853c917
Change-Id: I2e5a5ed991cb05270170a18b8f0169daa9eabdb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278537
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-24 18:00:25 +00:00
Josh Soref ba15a61271 Spelling build
Closes https://github.com/dart-lang/sdk/pull/50859

GitOrigin-RevId: 7b056018c2925745701bdecdd7da325d9458204d
Change-Id: Iff037d773713bf73efde6951599becfd7297b921
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277740
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-23 08:56:14 +00:00
Alexander Thomas b9b6511ca6 Spelling sdk
Closes https://github.com/dart-lang/sdk/pull/50918

Co-authored-by: Josh Soref <jsoref@gmail.com>
GitOrigin-RevId: 1fd275051c561b63d374fb47e76a22424c4a12a9
Change-Id: I97790d9c79ff659f2c1fa2d2d46d041fe67957cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278530
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-01-20 12:37:49 +00:00
Josh Soref 84e3c8b50f Spelling tests
Closes https://github.com/dart-lang/sdk/pull/50920

GitOrigin-RevId: fa87531bd0f52b69485c9d02ff9e44a4a29c6a91
Change-Id: I0ae8574a5b77087895e004079f221201bb550cf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278535
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-19 16:24:29 +00:00
Josh Soref 9e4dc755cb Spelling pkg
Closes https://github.com/dart-lang/sdk/pull/50921

GitOrigin-RevId: 6b1ca502b6722b0a987f33ace66f65cbd2c24e23
Change-Id: I74e4ff3c8e759c576036d6b791bd7734ebd215d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278536
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-19 10:06:29 +00:00
Ben Konyi 6f633c364a Reland "[ VM ] Add support for sampling old space allocations"
This reverts commit 0bd5a2b05e.

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

TEST=CQ

Change-Id: I4b643976a59adba8bd228a96ac75ae25ef8e206c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279120
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-01-16 16:28:43 +00:00
Tess Strickland 0bd5a2b05e Revert "[ VM ] Add support for sampling old space allocations"
This reverts commit 6e4c0c2196.

Reason for revert: Broke ASAN builds

See https://github.com/dart-lang/sdk/issues/51023

Original change's description:
> [ VM ] Add support for sampling old space allocations
>
> TEST=DartAPI_HeapSampling
>
> Change-Id: Idf26fca6ae59720557d73627f727b00229dd1e9c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273860
> 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: Id704f9070c430234b7cd78d8c2b67a5ed3e503fe
Cq-Include-Trybots: luci.dart.try:vm-kernel-asan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279100
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-01-16 11:42:45 +00:00
Ben Konyi 6e4c0c2196 [ VM ] Add support for sampling old space allocations
TEST=DartAPI_HeapSampling

Change-Id: Idf26fca6ae59720557d73627f727b00229dd1e9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273860
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-01-13 19:06:37 +00:00
Haidar cbe458703c [vm/api] Make CObject as_string const char* instead of const
Closes https://github.com/dart-lang/sdk/pull/50884

TEST=ci

GitOrigin-RevId: f898451bb21f1e49550698fcf08ec5dfc1036dce
Change-Id: I808d37afe3e953afd632e4ffc4ab4b152b468e4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278140
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-01-04 12:51:03 +00:00
Vyacheslav Egorov d02e1de5b1 [vm] Add Dart_SetDwarfStackTraceFootnoteCallback
This API allows embedder to append arbitrary footers to DWARF stack
traces. For example, embedder can append a link to a symbolizer
service, which could be used to symbolize the stack-trace.

TEST=manually tested, hard to create automatic tests because vm/cc tests  only support JIT, not AOT.

Bug: b/255741575
Change-Id: Id034b9b3194f7b91a8405574ea771c4a06fda2c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-12-15 13:45:10 +00:00
asiva 606a64a743 [3.0 alpha][VM/Runtime] - Flip flag to make strong null safety the default.
- Flip flag to make strong null safety the default
- Remove code that auto detects null safety mode from source files,
  it is necessary to specify --no-strong-null-safety to opt out.
- Retains sniffing of AOT/JIT snapshots and kernel files to determine
  null safety mode, the opt out has to be done when generating these
  file.

TEST=ci

Change-Id: If2c9608eedb7c46d9c3cd85e261ee9640e0d28eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261140
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-06 04:04:23 +00:00
Vyacheslav Egorov c704e11ee2 [vm/api] Introduce Dart_WriteHeapSnapshot API
Allows embedders to programmatically request heap snapshot from a
running isolate group instead of relying on a vm-service or hidden
internal Dart APIs

Additionally we allow to include snapshot writing functionality into
PRODUCT builds using DART_ENABLE_HEAP_SNAPSHOT_WRITER define.

TEST=vm/cc/DartAPI_WriteHeapSnapshot

Bug: b/259115846
Change-Id: Ic3ef76e5fb9adcf8f23a1959f5238742b64ecde2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273181
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-12-01 14:38:44 +00:00
Ben Konyi 8caeaf7a6c [ VM ] Add support for heap sampling profiler
This CL introduces new embedding APIs for supporting heap sample
profiling. A registered sampling callback is invoked approximately every
N bytes based on an exponential distribution, providing information
about the isolate group the allocation occurred in, the user visible
name of the allocated object type, a weak persistent handle to the
allocated object, and the size of the allocation.

Sampling is triggered using artificial TLAB boundaries to cause
allocations to be sampled to take the allocation slow path where the
registered callback can be invoked with the allocation information.

Only new space allocations are currently traced, with old space
allocation support to be added in a future CL.

TEST=Dart_HeapSampling

Change-Id: I22bcdeec6e823bc1ab44898d4c596fbed7169fa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264520
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-11-22 18:05:24 +00:00
blagoev 50e18b8160 [vm/ffi] Add Dart_IsNull in dart_api_dl.h
TEST=tests/ffi/vmspecific_handle_dynamically_linked_test.dart

Closes: https://github.com/dart-lang/sdk/pull/50466
Closes: https://github.com/dart-lang/sdk/issues/48331

GitOrigin-RevId: ce49a64788310a755cd9bb5c7ff6d281830bcc33
Change-Id: Ia8e23c57c76767d9e3db799b8fe6b172071582a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269742
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-11-15 10:32:16 +00:00
jhsware 24f12f4f94 Typo in \param doc name
Closes https://github.com/dart-lang/sdk/pull/50395

TEST=ci

GitOrigin-RevId: a6aae8cf90306a1e2a44ebdf9da269cf756515bc
Change-Id: Iec8137ffc21f5aaefdc5f5f878df5fc017e9891f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269601
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-11-14 13:06:59 +00:00
Ryan Macnak 30de5494d5 [vm] Rename Dart_NotifyDetach to Dart_NotifyDestroyed.
To reflect its expected usage.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/108601
Change-Id: I898e400d4a6c112130663a03354844cd82ed778c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264561
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-17 18:23:59 +00:00
Ryan Macnak 904c6fd6fa [vm] Add Dart_NotifyDetach.
TEST=ci
Change-Id: I86776f93f5b1aedb205a62822a25d7a4697f73cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262520
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-06 19:00:37 +00:00
Derek Xu 99546781f4 [VM] Factor out helper functions related to isolate IDs
Adds the helper functions HasIsolateId(), HasIsolateGroupId(),
GetFormattedIsolateId(), and GetFormattedIsolateGroupId() to
timeline.h

The Perfetto recorder that will be added in a future CL will make use of
these.

TEST=ci

Change-Id: I50e234d9c2cc551ae9fbad7e92fc6e019213e264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259220
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-09-19 19:46:01 +00:00
asiva 3cdeb58c98 [VM/Runtime] - Use 'const' qualifier for CObject typed data
Addresses https://github.com/dart-lang/sdk/issues/49827

TEST=ci

Change-Id: I525cc27d0bf01945d4f700f48355a3f17e297007
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256602
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-09-13 22:38:22 +00:00
Ryan Macnak 8c577c420c [vm] Add unmodifiable typed data as a type that can be sent with Dart_PostCObject.
Cf. 938a2c81d2

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/49810
Bug: https://github.com/dart-lang/sdk/issues/49825
Change-Id: I8d4a574f12458e88b589d5ee02c68b1f436fb964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257925
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-12 19:45:12 +00:00
Ryan Macnak 79afcf9c7d [vm] Add Dart_SetTimelineRecorderCallback.
TEST=ci
Bug: b/245563515
Change-Id: I5f8ada1854be9de5bf08f4492c3166826722dbf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258180
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-09-09 17:21:44 +00:00
Ryan Macnak 0f96506a45 [vm] Clarify that the Dart_MessageNotifyCallback mechanism notifies once per message.
TEST=docs only
Change-Id: I40561595ecc8075f2f50b7c3dcc32f081d8ac85b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256649
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-29 20:32:35 +00:00
Ryan Macnak 938a2c81d2 [vm] Add Dart_NewUnmodifiableExternalTypedDataWithFinalizer.
This foregoes the optimization of removing CheckWritable if the unmodifiable views are not used from Dart code.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/49784
Change-Id: I18f3c36437ef136daf875358278caca4e3e0faa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255816
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-23 16:36:10 +00:00
Chris Evans 7962f8a119 Updates to analyze_snapshot tool
- format fixes for readme and build descriptions
- added pretty print option for tool
- changed parsing of class_table to discover library objects
  - JSON output format changes
- defines to accurately mirror platform compatibility
- other small fixes
TEST=ci
Change-Id: I3f27f6fa48ce6111d94c5a88d57fa7bf7abc210c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252661
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2022-08-23 12:18:00 +00:00
Ryan Macnak c6a1eb1b61 [vm, gc] Very basic RAIL.
Related to https://github.com/dart-lang/sdk/issues/47574

TEST=ci
Change-Id: I2f07be6150b025a301e6e4d10935b606087cdf00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252462
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-27 16:40:38 +00:00
Aaron Clarke 4448741898 Updated Dart_Post docstring to mention Dart_PostCObject.
fixes https://github.com/dart-lang/sdk/issues/49524

TEST=n/a, documentation

Change-Id: Ia5154e9c2c1d6f6cce46e9bceb49f315cb840bc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252681
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-25 22:55:06 +00:00