Commit graph

688 commits

Author SHA1 Message Date
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
Anis Alibegić 40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
Alexander Aprelev abeaa03148 [vm/heap/metrics] Remove deprecated isolate-based vm heap statistic messages.
Fixes https://dartbug.com/49211
TEST=ci

Change-Id: Icddbebccf84f226b2ac89acb9153353d84658079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248680
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-16 15:27:49 +00:00
Ahmed Ashour 85700570f6 Fix typos
Fixes #49241

TEST=ci

Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 11:08:28 +00:00
Alexander Aprelev 1fddb10107 [vm/heap/metrics] Make sure heap-related metric are reported for the isolate group, rather than isolate.
TEST=ci

Change-Id: Ie0514f05c0a024ce37f10d56dd29b3fa921133d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247504
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-08 18:01:02 +00:00
Ryan Macnak 4c7840d330 [dart:io] Publish implementations of the VM file callbacks.
TEST=ci
Change-Id: I481b6fe3e7eae02ff7f2c94fa2f60bef0a972b3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241685
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-19 23:27:17 +00:00
Ryan Macnak da89828077 [vm] Remove hooks for the embedder to provide a task runner in lieu of the VM's thread pool.
This reverts commit dc3cf83bb6.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/44228
Change-Id: Ia8da6424fd4ebc67e0a2a50e37b1930b4aea5628
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231042
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-18 20:34:57 +00:00
Chris Evans 23b1f38981 Fixes for reland for analyze_snapshot program
1. Disable copying of executable for SDK binary signing
2. Fixes for ASAN memory leak in executable

TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart

This is a reland of 5d7d8a377d

Original change's description:
> Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
>
> This is a reland of 8d1eedca64
>
> Disable builds for Fuchsia
>
> TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
> Original change's description:
> > Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
> >
> > This is a reland of 19e5749308
> >
> > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> >
> > Original change's description:
> > > [vm] Add analyze_snapshot tool for AOT snapshot inspection
> > >
> > > Current skeleton to allow for instrumentation snapshots that can be
> > > built alongside Dart compilation artifacts and easily referenced for
> > > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
> > >
> > > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> > >
> > > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> > > Reviewed-by: Slava Egorov <vegorov@google.com>
> > > Commit-Queue: Slava Egorov <vegorov@google.com>
> >
> > Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Commit-Queue: Slava Egorov <vegorov@google.com>
>
> Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Chris Evans <cmevans@google.com>

Change-Id: I1e6e57dda56f1710cc3a52e35d4067910930a701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234500
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Chris Evans <cmevans@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2022-03-09 14:17:44 +00:00
Alexander Thomas 0c0cd6341d Revert "Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"""
This reverts commit 5d7d8a377d.

Reason for revert: this CL unintentionally included analyze_snapshot in the Dart SDK distribution which is a release blocker.

Original change's description:
> Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
>
> This is a reland of 8d1eedca64
>
> Disable builds for Fuchsia
>
> TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
> Original change's description:
> > Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
> >
> > This is a reland of 19e5749308
> >
> > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> >
> > Original change's description:
> > > [vm] Add analyze_snapshot tool for AOT snapshot inspection
> > >
> > > Current skeleton to allow for instrumentation snapshots that can be
> > > built alongside Dart compilation artifacts and easily referenced for
> > > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
> > >
> > > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> > >
> > > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> > > Reviewed-by: Slava Egorov <vegorov@google.com>
> > > Commit-Queue: Slava Egorov <vegorov@google.com>
> >
> > Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Commit-Queue: Slava Egorov <vegorov@google.com>
>
> Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Chris Evans <cmevans@google.com>

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

Change-Id: Ie5b0b6d2f8f792a3bed9134d7d10fb4d34d9a58d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234284
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-02-24 16:56:23 +00:00
Alexander Markov 211da364be [vm] Experimental ability to spawn isolate from kernel blob in memory
TEST=runtime/tests/vm/dart/spawn_uri_from_kernel_blob_test.dart

Change-Id: Ieb327f0350d5d8ea1d344c64aa3dd217125da5fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232682
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-23 16:55:52 +00:00
Chris Evans 5d7d8a377d Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
This is a reland of 8d1eedca64

Disable builds for Fuchsia

TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart
Original change's description:
> Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
>
> This is a reland of 19e5749308
>
> TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
>
> Original change's description:
> > [vm] Add analyze_snapshot tool for AOT snapshot inspection
> >
> > Current skeleton to allow for instrumentation snapshots that can be
> > built alongside Dart compilation artifacts and easily referenced for
> > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
> >
> > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> >
> > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Commit-Queue: Slava Egorov <vegorov@google.com>
>
> Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2022-02-23 12:04:32 +00:00
Alexander Aprelev b29bb7763b [vm/doc] Add a note to CObjectNativePointer class.
Addresses https://github.com/dart-lang/sdk/issues/48379

TEST=not needed, only documentation update

Change-Id: I2d82c6533ef64cd9ff62428e20a2e66013a35e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233642
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-02-21 21:54:11 +00:00
Liam Appelbe 3a3738c6fb Revert "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection""
This reverts commit 8d1eedca64.

Reason for revert: Broke the Fuchsia bot: https://github.com/dart-lang/sdk/issues/47950#issuecomment-1040648129

Original change's description:
> Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
>
> This is a reland of 19e5749308
>
> TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
>
> Original change's description:
> > [vm] Add analyze_snapshot tool for AOT snapshot inspection
> >
> > Current skeleton to allow for instrumentation snapshots that can be
> > built alongside Dart compilation artifacts and easily referenced for
> > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
> >
> > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
> >
> > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Commit-Queue: Slava Egorov <vegorov@google.com>
>
> Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

TBR=vegorov@google.com,cmevans@google.com

Change-Id: I1aa0404fa8af9bd31a5c1efbbe7f60d9da2b5b9d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233160
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2022-02-15 18:45:39 +00:00
Chris Evans 8d1eedca64 Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
This is a reland of 19e5749308

TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart

Original change's description:
> [vm] Add analyze_snapshot tool for AOT snapshot inspection
>
> Current skeleton to allow for instrumentation snapshots that can be
> built alongside Dart compilation artifacts and easily referenced for
> specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
>
> TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
>
> Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-02-15 10:50:10 +00:00
Ryan Macnak 4088cd083d [vm] Add missing Dart_ThreadStartCallback.
For symmetry with Dart_ThreadExitCallback. Can be used by an embedder to change thread priority or attach native resources to the thread.

TEST=ci
Change-Id: Ic8eaba7204d0be42db26523b62cbfac3ecb7151f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227661
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-19 23:14:36 +00:00
Ryan Macnak a5554dc945 [vm] Remove disused Dart_HintFreed.
Uses of this API were replaced with explicit disposal.

TEST=ci
Change-Id: Id6c391c74d77e6a6c6b5b70e446a8abe92294b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228081
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-18 21:46:55 +00:00
Ryan Macnak c9e3868afb [vm] Remove dead Dart_IsolateUnhandledExceptionCallback.
TEST=ci
Change-Id: I3446cac336330c3fcc1b09729c5a0b03eae4a4ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227660
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-12 00:03:24 +00:00
Alexander Aprelev eb4eade02a [vm/gen_snapshot] Avoid redundant compilation when generating kernel snapshot.
Fixes https://github.com/dart-lang/sdk/issues/39580
TEST=ci

Change-Id: I98e7201350433754c9ff1746e1d6e24b7107099e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225740
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-01-05 17:51:26 +00:00
Ben Konyi 3657251778 Revert "[vm] Add analyze_snapshot tool for AOT snapshot inspection"
This reverts commit 19e5749308.

Reason for revert: Multiple configurations failing (https://github.com/dart-lang/sdk/issues/47950)

Original change's description:
> [vm] Add analyze_snapshot tool for AOT snapshot inspection
>
> Current skeleton to allow for instrumentation snapshots that can be
> built alongside Dart compilation artifacts and easily referenced for
> specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine
>
> TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart
>
> Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

TBR=vegorov@google.com,cmevans@google.com

Change-Id: Iaaeeeba04ac3283d2df3db8155389db2b358b60a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224601
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-12-16 18:32:20 +00:00
Chris Evans 19e5749308 [vm] Add analyze_snapshot tool for AOT snapshot inspection
Current skeleton to allow for instrumentation snapshots that can be
built alongside Dart compilation artifacts and easily referenced for
specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine

TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart

Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2021-12-16 15:21:14 +00:00
Liam Appelbe ac7bca37a8 [vm] Add an isolate group flag for branch coverage.
Branch coverage can't be enabled by a simple global flag, because this
causes problems when functions in an app-jit snapshot that didn't have
the flag enabled are compiled by a VM that has the flag enabled. In
particular, the coverage array will see a different set of token
positions, causing some important asserts to fail.

Change-Id: I35227252b5d271f20b01de99466c06708ec83ed8
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223360
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2021-12-14 22:53:36 +00:00
Daco Harkes 1ade4ab96f [vm] runtime/include fix documentation
Makes runtime/include/** respect -Wdocumentation.

Closes: https://github.com/dart-lang/sdk/issues/47730

TEST=manually verified in Xcode we have no more warnings.

Change-Id: Id48f56bce2b3a3602e24f7187f45a2b32aafb9fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220762
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-11-19 09:43:38 +00:00
Daco Harkes 292b54e121 [vm] runtime/include specify void parameters
Makes runtime/include/** respect -Wstrict-prototypes.

Closes: https://github.com/dart-lang/sdk/issues/47729

TEST=ci (FFI has tests that build against the API).
TEST=manually verified in Xcode we have no more warnings.

Change-Id: I035640ae93e942946f5171dd30776b072a235990
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220761
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-11-19 09:43:38 +00:00
Ryan Macnak dc3cf83bb6 [vm] Allow the embedder to provide a task runner in lieu of the VM's thread pool.
This allows the embedder to control the degree of parallelism and thread priorities.

TEST=engine
Bug: https://github.com/dart-lang/sdk/issues/44228
Change-Id: I4e8430749fcfbcbfc221c3733ee27ccbe6bcc1ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215941
Reviewed-by: Kaushik Iska <kaushikiska@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-11-18 00:54:20 +00:00
asiva 3edd0832d6 [VM/Runtime] - Remove unused Dart C API function
Remove Dart_SetNativeServiceStreamCallback which is not in use by
any embedder.

TEST=cq

Change-Id: Ic6ecadb80d94b14cd2f89b5297d65c3ab7de75e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220131
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-11-16 16:59:13 +00:00
asiva bbff4d9589 [VM/Runtime] - Add Dart C API function to toggle timeline categories.
Add Dart C API Function Dart_EnableTimelineCategory that enables
toggling of timeline categories at runtime.

https://github.com/dart-lang/sdk/issues/47601

TEST=Dart C API tests added

Change-Id: Ib38c8ab0a8d43c9180e9cb9ade107f8bad5f5e63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219943
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-11-11 01:25:04 +00:00
Siva Annamalai 68b6665e42 Revert "[VM/Runtime] - Add Dart C API function to toggle timeline categories."
This reverts commit 8e90a9ec86.

Reason for revert: Breaks PRODUCT builds

Original change's description:
> [VM/Runtime] - Add Dart C API function to toggle timeline categories.
>
> Add Dart C API Function Dart_EnableTimelineCategory that enables
> toggling of timeline categories at runtime.
>
> https://github.com/dart-lang/sdk/issues/47601
>
> TEST=Dart C API tests added
>
> Change-Id: I679e755d69d1375552e3a02e887ac00f828553d0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219860
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: Ib8198d1466d23fefac415088b5566a4e22ba2e91
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219941
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-11-10 23:33:15 +00:00
asiva 8e90a9ec86 [VM/Runtime] - Add Dart C API function to toggle timeline categories.
Add Dart C API Function Dart_EnableTimelineCategory that enables
toggling of timeline categories at runtime.

https://github.com/dart-lang/sdk/issues/47601

TEST=Dart C API tests added

Change-Id: I679e755d69d1375552e3a02e887ac00f828553d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219860
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-11-10 22:25:14 +00:00
Ryan Macnak 985824de50 [vm] Ask the OS to release the memory for the clustered portion of the snapshot.
This region is mostly unused after loading, but it may be accessed again if
 - Isolate.spawn is invoke with isolate groups disabled
 - A secondary snapshot produced by splitting is loaded
 - An external typed data in the snapshot is accessed (usually a kernel file)
 - Likely other cases

Even if these cases did not exist, the region is often part of a shared library and so unable to be released independently.

madvise(DONT_NEED) on this region will cause the OS to release the memory in this region but keep the address space reservation and mapping. If it is touched again, it will be brought back in from the file. If it is not backed by a file, such as malloc memory, it will be brought back in as zeros and the program will likely fail.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/44019
Bug: https://github.com/flutter/flutter/issues/92120
Change-Id: I315a049b0f7d440e181d0a5e87fa6770a2fd4f79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216580
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-10-25 17:30:50 +00:00
Daco Harkes 862e473c2e [vm] Native API DL: dllexport on Windows
`DART_EXTERN` in `dart_api_dl.h` was missing `__declspec(dllexport)` on
Windows, causing `Dart_InitializeApiDL` to not be visible.

Using `DART_EXPORT` instead doesn't work because the definitions added
by `DART_API_ALL_DL_SYMBOLS` do not support having a 'used' attribute.

Instead, define a `DART_EXPORT_DL` for these which is identical but
without the 'used' attribute.

Note that the precompiler `DART_SHARED_LIB` macro must be defined for
`__declspec(dllexport)` to be part of `DART_EXPORT`/`DART_EXPORT_DL`.

Also fixes `#define DART_EXTERN_C` to be `extern` in C. Without this,
the linker will see duplicate symbols for things `DART_EXPORT`ed when
the `dart_api_dl.h` is included in C files.

TEST=SDK build on all OSes

Change-Id: I0af1d46d22409599203d9be310d54bd16c6a5b59
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,dart-sdk-win-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215550
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-10-06 07:42:44 +00:00
Ryan Macnak 5c79501a64 [vm] Remove Dart_GetImportsOfScheme.
Dead since bda70c8489.

TEST=build
Change-Id: I0aed3d9d30a2b01f57f5d6a6bd02105fa89e3095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213405
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-14 21:18:37 +00:00
Clement Skau 7d467e8933 [vm] Adds args_n to FFI resolver.
This makes it more closely mirror the Dart_NativeEntryResolver,
and acts as an extra sanity check that signatures (roughly)
align between the FfiNative decl. and the native function.

TEST=Updated runtime/vm/dart_api_impl_test.cc

Change-Id: I40799dc583ec14db14dc453afed4e2d1eb06fced
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212566
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-09-13 07:57:00 +00:00
Vyacheslav Egorov bda70c8489 [vm] Remove support for dart-ext: imports
Per breaking change #45451 we are removing support for dart-ext:
style native extensions from the Dart VM.

This CL removes the associated VM code, tests and samples. It also ports
a single test which used dart-ext: import to use FFI instead.

TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/45451
Change-Id: Iae984bce32baf29a950b5de1323939006a217b94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212050
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-02 14:14:35 +00:00
asiva 06a471ce86 [VM/Runtime] - Return error instead of a FATAL error when failing to
communicate with the kernel isolate while accepting compilation results
during a hot reload.

TEST=reload bot tests.

Change-Id: I55f983cc8461c89e91bf1bef84f39dcda61e8142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210942
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-27 20:49:39 +00:00
asiva bc387837c4 [VM/Runtime] Reland : Fix 'File' object leak in async file open operation
The 'File' object created in the async file open method is leaked
if the operation is not completed when the isolate shuts down
with an unhandled exception.
This change adds a finalizable state for the 'File' object so that
the message deletion that happens when ports are closed could run
the callback to clean up the 'File' object.


TEST=new tests added

Change-Id: I64c18a7905261b0fc7bf9f220086791478232d0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211340
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-27 17:45:17 +00:00
William Hesse 637e14006c Revert "[VM/Runtime] Fix 'File' object leak in async file open operation"
This reverts commit b67f45f955.

Reason for revert: This seems to cause a crash on ARMv7 aot compiled code.

Original change's description:
> [VM/Runtime] Fix 'File' object leak in async file open operation
>
> The 'File' object created in the async file open method is leaked
> if the operation is not completed when the isolate shuts down
> with an unhandled exception.
> This change adds a finalizable state for the 'File' object so that
> the message deletion that happens when ports are closed could run
> the callback to clean up the 'File' object.
>
> TEST=new tests added
>
> Change-Id: I4a3cb28370d27306c795c1914aeb5c18a1d85e2b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210761
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=aam@google.com,rmacnak@google.com,asiva@google.com

Change-Id: Ie91aadd318ef19a0bb4d7f769c9e876e76d719d8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211021
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2021-08-24 12:49:23 +00:00
asiva b67f45f955 [VM/Runtime] Fix 'File' object leak in async file open operation
The 'File' object created in the async file open method is leaked
if the operation is not completed when the isolate shuts down
with an unhandled exception.
This change adds a finalizable state for the 'File' object so that
the message deletion that happens when ports are closed could run
the callback to clean up the 'File' object.

TEST=new tests added

Change-Id: I4a3cb28370d27306c795c1914aeb5c18a1d85e2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210761
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-23 20:57:48 +00:00
asiva e3058884b0 [VM/Runtime] - Remove API Dart_GlobalTimelineSetRecordedStreams which is
not used anywhere

Enabling of the timeline streams is done using command line flags
during initialization and no embedder uses this API function
(It was added when Mojo was supported).

TEST=ci

Change-Id: Ide9205b9ecd703e2ccdab7a85e8a79c48d98f180
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209850
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-11 22:33:43 +00:00
Ryan Macnak a302550068 [vm] Fix the native port deserializer to interpret as_typed_data.length as counting elements instead of bytes.
This brings the native port deserializer into agreement with the native port serializer and the interpretation of TypedData::length_.

TEST=ci
Change-Id: I52eb28af7292fc15b0ad4779dc4d4e723f6e128b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208283
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-04 18:23:28 +00:00
asiva 34724ec715 [VM/Runtime] Expose OS::GetCurrentMonotonicTicks as Dart_TimelineGetTicks
Add Dart_TimelineGetTicks and Dart_TImelineGetTicksFrequency to the
dart_api.h per the request made in
https://github.com/dart-lang/sdk/issues/46665

TEST=added new unit test in dart_api_impl_test.cc

Change-Id: Ib37ec2088d2e61f56e61026e431c3777608cd9a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207900
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2021-07-23 15:19:30 +00:00