Commit Graph

4273 Commits

Author SHA1 Message Date
Tony 57b27a7b44 Refactor Dart runtime to replace DART_DYNAMIC_MODULES with DART_BYTECODE_INTERPRETER
- Updated conditional compilation flags throughout the runtime codebase to transition from DART_DYNAMIC_MODULES to DART_BYTECODE_INTERPRETER.
- Adjusted logic in various files including object_graph_copy.cc, object_reload.cc, profiler.cc, and others to ensure compatibility with the new interpreter model.
- Ensured that all references to dynamic modules are replaced with bytecode interpreter checks, maintaining functionality for interpreted code execution.
- Modified stack frame handling and service-related code to align with the new interpreter architecture.
- Updated tests and service implementations to reflect the changes in the runtime environment.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-25 01:58:41 +08:00
Tony 08139af589 Add compact AOT patching support and related APIs
- Introduced Dart_SetObfuscationMap to restore obfuscation maps before AOT precompilation.
- Added Dart_AotPatchInstallOptions structure for AOT patch installation options.
- Implemented Dart_AotPatchingEnabled to check if compact AOT patching is supported.
- Created Dart_SetAotPatchKeyCallback for AES key resolution during AOT patch installation.
- Developed Dart_InstallAotPatch for validating and installing encrypted AOT patches.
- Added Dart_FreeAotPatchPayload to free memory allocated for patch payloads.
- Updated runtime_args.gni to include dart_enable_aot_patching flag.
- Added tests for AOT patching functionality and ensured exported symbols include new APIs.
- Refactored existing code to accommodate new AOT patching features and improve error handling.
2026-06-24 03:00:14 +08:00
Jens Johansen b32e313620 [vm] Introduce --script_uri_override to support Platform.script in dart run -r
If a script uses `Platform.script` running it with as `dart
<script.dart>` and `dart run <script.dart>` would give the correct
script ("<script.dart>"), but running it with `dart run -r
<script.dart>` would report a dill file in the temp directory which is
not only surprising, but also breaking and for instance running the CFEs
strong_suite.dart via `dart run -r` didn't work.

This CL introduces --script_uri_override to the VM and makes the
resident compiler setup pass it so that when running `dart run -r
<script.dart>`, even though the vm is actually launched from a dill file
that resides in temp, `Platform.script` will actually return
`<script.dart>` - and running the CFEs strong_suite.dart via `dart run
-r` now actually works.

Tested: Added pkg/dartdev/test/commands/run_test.dart and manual testing.
Change-Id: Ia65c01834485fe06af63584baf0448dd5b9ffdb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510343
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-06-11 06:34:20 -07:00
Shikhar Soni 93ca44b048 [ffi] Add DynamicLibrary.openFromAssetId
Adds a new API `DynamicLibrary.openFromAssetId` to `dart:ffi` that
allows opening dynamically loaded libraries using their native asset IDs
instead of physical file paths.

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

TEST=./tools/test.py -n vm-aot-linux-debug-x64 'ffi/native_assets/asset_*'
Cq-Include-Trybots: dart/try:vm-aot-linux-debug-arm64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-debug-arm64-try,vm-aot-mac-debug-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-asan-mac-release-arm64-try,vm-asan-win-release-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-tsan-mac-release-arm64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-ubsan-mac-release-arm64-try,vm-ubsan-win-release-x64-try
R=vegorov@google.com
Change-Id: Ic617cb0906d1688d2d080dae7d1e08ee58b4c8d6

CoreLibraryReviewExempt: VM-only
Change-Id: Ic617cb0906d1688d2d080dae7d1e08ee58b4c8d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507180
Auto-Submit: Shikhar Soni <shikharsoni@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-06-10 09:49:30 -07:00
Ryan Macnak 1b3e9d510e Fix Fuchsia build.
Don't need to maintain testonly for the main Fuchsia tree anymore.

TEST=gn
Change-Id: I99c513dac5aa09ef47a6b6666c934ad63fe4a874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508823
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-06-02 16:47:34 -07:00
Ryan Macnak 546bf07f7d [vm] Remove transitions for removing VM isolate.
TEST=ci
Change-Id: I65c315e9efc3cd7b8b47d2c167681986278644da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502780
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-02 10:28:10 -07:00
Ryan Macnak ce32f4e1a7 [build] Put less into gen dir to avoid copying to test shards.
obj is filtered from the testing shard file sets but gen is not, and some tests depend on things in gen.

TEST=ci
Change-Id: I19bc763935c1cfd5077b2aeaf83e37f992ab785c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508281
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-06-01 15:25:58 -07:00
Ryan Macnak 7e5b075680 Reland "[standalone] Remove the fallback root certificates."
Leave in hooks for the google3 build.

TEST=ci
Change-Id: Ib5768d27fcdbf3d4963da3d8dd142bea5fae10ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506420
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-01 08:32:26 -07:00
Ryan Macnak fc750ac8e0 [build] Remove unsigned executable memory permissions from the AOT runtime on Mac.
Snapshots are now generally signed Mach-O dylibs loaded by dlopen, instead of ELF files mapped executable by the VM's loader.

TEST=ci
Change-Id: Id19877bed0bd0282b320f070904a848b0c076a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505200
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-01 07:21:29 -07:00
Ben Konyi 8d41c9b677 [dartdev] Synchronize environment variable modifications to fix getenv crash
Avoid a race condition between async setenv/unsetenv calls on the VM thread and concurrent getenv/environ reads on the main thread.

In glibc, setenv and getenv are not thread-safe against each other. VmInteropHandler.setEnvironmentVariable previously sent a message to the VM thread to call setenv/unsetenv asynchronously, while the main thread immediately proceeded to access Platform.environment or Platform.localeName (which calls getenv). This could cause a crash (SIGSEGV) in getenv.

This CL makes VmInteropHandler.setEnvironmentVariable synchronous by awaiting a reply from the VM thread before returning.

TEST=pkg/dartdev/test/environment_test.dart

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

Change-Id: Ic8211897ce26ffbdc142fa594cd397189a61f061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506800
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2026-05-29 10:26:54 -07:00
Ryan Macnak b0a82e98d5 [build, mac] Sign shared libraries and fix incremental build for changes to signing script or entitlement files.
TEST=ci
Change-Id: Ied90ee7b81a23de266d6f7dc5e642a820dac9248
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506341
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-27 06:34:31 -07:00
Ryan Macnak 84bd4ea759 [build] Remove dead tools.
TEST=ci
Change-Id: I535527098d08b3ecbf1ae731497750a43f478196
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506460
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-26 14:40:09 -07:00
Ryan Macnak d080a5defd [build] Remove dead configs.
TEST=ci
Change-Id: Ibfff85b97d607fffb8aae49bd56e688ba292ff6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506461
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-05-26 14:38:25 -07:00
Ryan Macnak 53733077b2 Revert "[standalone] Remove the fallback root certificates."
This reverts commit 039aef728a.

Reason for revert: b/515601247

Original change's description:
> [standalone] Remove the fallback root certificates.
>
> The discovery of the system root certificates is more robust after 2142d8e148.
>
> TEST=ci
> Change-Id: I8215cb92f98e620b82f21261c13e061a2b488b5d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433923
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TEST=ci
Change-Id: Ib07de221ff1160461d930f7165a7cd8179b4e3f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506100
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-26 07:49:52 -07:00
Ryan Macnak 039aef728a [standalone] Remove the fallback root certificates.
The discovery of the system root certificates is more robust after 2142d8e148.

TEST=ci
Change-Id: I8215cb92f98e620b82f21261c13e061a2b488b5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433923
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-19 11:20:48 -07:00
Ryan Macnak d36adbacaf [vm] Remove the VM isolate.
The former contents of the VM isolate are now included into each isolate group. This makes each isolate group's heap independent, and in particular allows each heap to be allocated to a separate pointer cage (not done in this CL).

The duplicated stubs that allowed PC relative calls are removed, since the originals can now be the target of PC relative calls.

The bootstrapping needing to load an AppJIT or AppAOT snapshot is reduced to allocating the oddballs. The code is entirely dropped in the AOT runtime, but the JIT runtime still has it to allow for flags to affect the compilation of the stub code. Further refactoring might be able to remove this for the JIT runtime too, with only gen_snapshot knowing how to bootstrap.

Class serialization no longer distinguishes predefined classes.

The page containing null is marked as never-evacuate. null, false and true must not move because the compiler relies on their low bits having certain patterns for some optimizations. (Previously, the entire VM isolate heap never moved.)

Compaction is disabled for IA32. Due to register pressure, some stub calls must not use a scratch register and embed the address of Code.

The page containing the call-through-safepoint stub is frozen when running with --write-protect-code and the stub is created at runtime (instead of loaded from an AppJIT or AppAOT snapshot). This stub must remain executable even during a safepoint, as a foreign call might during return during a safepoint and only block after the stub directs it to the runtime.

The snapshot symbols are renamed to kDartSnapshotData and kDartSnapshotText. There is no need to distinguish the VM isolate's snapshot, and snaphots are per isolate group not per isolate. Aliases with the old names are added to ease migration.

Some global flags that were automatically set based on the VM isolate's snapshot are now isolate group flags and automatically set by the isolate group's snapshot.

TEST=ci
Change-Id: Iee82016057d609112e9b021d178fc3d4d18b5044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500621
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-18 11:35:03 -07:00
James Robinson b5a613c378 [fuchsia] Use zx_port_cancel_key in Fuchsia event handling logic
This updates the IOHandle type in eventhandler_fuchsia to use
zx_port_cancel_key to cancel outstanding asynchronous waits instead of
the (older) zx_port_cancel. The cancel_key operation requires only the
key used to register the initial wait and not the originating handle.
This means that the IOHandle operation no longer has to store the
original handle or worry about its lifetime.

Tested: Patched locally in a test embedder using this logic
Change-Id: Iec0ec632a7dd438a34e482a12b5b298be56ce476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501840
Reviewed-by: Zijie He <zijiehe@google.com>
Auto-Submit: James Robinson <jamesr@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-13 12:47:06 -07:00
peeefour 1d80afe498 [vm/io] Range check Socket_SendMessage arguments
Closes https://github.com/dart-lang/sdk/pull/63365

GitOrigin-RevId: 344604dd1a17b73c6665026e7e75693fe0fa7ca7
Change-Id: I8f51d5735a56564f2181bcd1206c9cfdff80f077
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502960
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-05-13 03:40:04 -07:00
Alexander Markov 6195ea86bc [vm] Remove irregular type arguments parameter from factories
In the VM, factory constructors always had an extra "type arguments"
parameter, even if class is not generic. Factory constructor bodies
were using class type parameters instead of function type parameters.

This results in extra code when calling non-generic factories
which is slightly inefficient in terms of code size and performance.
Also, it creates an additional complexity throughout the system as
factories should be special cased in many places.

This change removes artificial "type arguments" parameter, treating
factory constructors basically as static methods. This matches
kernel AST representation.

TEST=ci

Change-Id: I957583cb2ce9a3c408699880a04036e06b01dd31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501762
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2026-05-12 06:11:15 -07:00
Alvin 7bc22cf877 [vm/io] Range check SynchronousSocket_WriteList arguments
Closes https://github.com/dart-lang/sdk/pull/63358

GitOrigin-RevId: 1a5eb0d7e11fca131a721cd0535954f96ac1dfaf
Change-Id: I670ebdd4fadef383872a9d719efa22d6479b812d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502441
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-12 00:32:52 -07:00
Slava Egorov d2903a568c [vm/io] Range check Filter_Process arguments
Add a check both in the native implementation and on the Dart side (to
avoid throwing uncatchable ApiError).

Simplify native implementation: Dart_ListGetAsBytes has fast path for
byte sized typed data lists, so there is no reason to inline the 
same fast path into the caller.

Reported by Kyounghwan Kim (@drg2533)

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

Bug: b/508627933
Change-Id: I14c0f5270f143ed2386200241b13313f6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500461
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-05-07 04:18:06 -07:00
Alexander Aprelev 25fcf6a551 [gardening] Add Platform::SetEnvironmentVariable to platform_fuchsia.cc
Follow-up to https://dart-review.googlesource.com/c/sdk/+/499300, fixes broken https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-fuchsia-release-arm64/6670.

TEST=ci

Change-Id: Ifeff3f5ea62280458067b711c8a11d854b3cdb49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500920
Auto-Submit: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2026-05-05 14:18:04 -07:00
Ben Konyi c5a57427d1 [ CLI ] Add support for modifying the environment from package:dartdev
This change makes it possible to set environment variables for the
current process from package:dartdev.

As a proof of concept, package:dartdev now sets `DART_ROOT` to the path
of the Dart SDK in the environment.

Related to https://github.com/dart-lang/sdk/issues/63210 and https://github.com/dart-lang/sdk/issues/62876

TEST=pkg/dartdev/test/environment_test.dart
Change-Id: If3a90279e99dadaba435ae3e43a752dcfda69227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499300
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-05-05 10:03:41 -07:00
Alexander Aprelev 5c3fb10fea [gardening] Fix fuchsia bot after broadcast InterfaceAddress changes.
Follow-up to https://dart.googlesource.com/sdk/+/6dd8ad53977bc864905248001a86375469415a32, broken bots https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/vm-fuchsia-release-arm64/6667

TEST=ci

Change-Id: I16e8544f66c8f97866cd32a03b383e76ef7c9548
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500840
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2026-05-05 09:53:54 -07:00
Ivan Ugryumov 6dd8ad5397 Add InterfaceAddress for broadcast address support
Closes https://github.com/dart-lang/sdk/pull/63088

GitOrigin-RevId: c72afbbbf2774fd4c3c3f83b69c30e86e4302abd
Change-Id: I2462f006dcbe2256b019c5b13674ca0d93838fc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492180
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-05 01:15:37 -07:00
netliomax25-code f2cbaf6ed1 missing MSG_CMSG_CLOEXEC flag in ReceiveMessage
Closes https://github.com/dart-lang/sdk/pull/63305

GitOrigin-RevId: 0bd3a9d0c65aa4eba705e1eb48256bb1b441dc37
Change-Id: I6e009f7f9d59a0f9c01efe4607921a73cbcb9662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500441
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-05-04 03:06:48 -07:00
Ben Konyi 0b68c62fc5 [Service] Add support for resident frontend server to package:dart_runtime_service_vm
TEST=Existing, ran locally.
Change-Id: Idc1f35eb3d4cf0c7251a64b02b801e8110cc323b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499000
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-04-30 17:04:19 -07:00
Ryan Macnak 87faabac13 [vm] Fix alignment for snapshots linked into the main binary.
TEST=ci
Change-Id: I819d035846191aeac441a574302b65674261cc9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497105
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-22 08:26:13 -07:00
Ryan Macnak e860a9b0fa [vm, ffi] Emit the FFI callback stub as a raw blob and place it in the Fuchsia package.
Any blob in the package can be loaded as an executable VMO.

TEST=child CL
Bug: https://dartbug.com/52579
Change-Id: I61f7a84453da4da4733c5a70d4d19f0a6652581b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496661
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-20 11:31:19 -07:00
Ryan Macnak df5cae97dc Revert "[vm, ffi] Remove special case for Fuchsia FFI callback thunks."
This reverts commit 61f45d66b2.
This reverts commit a0ab33ac52.
This reverts commit 68e2512ace.
This reverts commit fb732a570d.

TEST=ci
Bug: b/501539846
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try,vm-fuchsia-release-arm64-try,vm-ffi-mac-debug-simarm64_arm64-try,vm-ffi-mac-release-simarm64_arm64-try
Change-Id: I7f27bb15bf1fcb26fe8793a043b7530ed99a02a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495480
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-14 12:22:48 -07:00
Ben Konyi ae1b83869a [ Service ] Add support for DDS to package:dart_runtime_service_vm
The DartRuntimeService based VM service implementation now has support
for launching DDS instances and responding to _yieldControlToDDS RPC
invocations from DDS instances.

package:vm_service test suite is ~97% passing with this change.

TEST=Local testing.
Change-Id: I2f2f1b0926845134578f08d073ed7606f1fc4173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490320
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2026-04-10 12:04:28 -07:00
Ryan Macnak fb732a570d [vm, ffi] Remove special case for Fuchsia FFI callback thunks.
TEST=ci
Bug: https://dartbug.com/52579
Change-Id: I2c1ca144253bc0dbeda53321aa6fe462698095b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493502
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-08 16:43:02 -07:00
Ryan Macnak ed2bca33a3 Roll Clang from 637e9bc0f763 to 26697f4d07eb
TEST=ci
Change-Id: I3087eac61590edd0aa79e940146345d6370ff39f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493840
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-08 14:31:16 -07:00
Alexander Aprelev 8999b65531 [vm/cleanup] Remove unused start_callback, enable_vm_service, paused_for_messages.
TEST=ci

Change-Id: I101a355de9b0c2b36c8977c3af962a3e283a72d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493862
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2026-04-08 10:05:40 -07:00
Ryan Macnak 1dc1b015eb [dart:io, win] Don't delete the process list mutex during shutdown.
The exit callback might fire during or after dart:io shutdown.

TEST=ci (flaky)
Bug: https://github.com/dart-lang/sdk/issues/60499
Change-Id: I950ef4a6ba1d99a8eafb55cb051a60f0cb097e71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493485
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-08 08:33:32 -07:00
Ryan Macnak 55a2e4d548 [vm, mac] Replace deprecated readdir_r with readdir.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/63089
Change-Id: Ic689a4fb2e757b6f09e89946e9b37dc6d6bfc6e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492340
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-04-06 12:54:15 -07:00
Ryan Macnak e7f818b866 [vm, fuchsia] Always look for VmexResource.
TEST=ci
Bug: https://dartbug.com/52579
Change-Id: I856fb8ae5a5bc282471c1ecf3774fc49f7c5b57a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491926
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2026-03-31 19:59:09 -07:00
Alexander Markov b540d7e135 [vm] Fix parsing of DART_VM_OPTIONS environment variable
This change fixes the following problems when parsing DART_VM_OPTIONS
environment variable:

* Resize vm_options to accomodate for extra flags from
  DART_VM_OPTIONS.

* Prepend executable name to the argv to be compatible with
  implementation of Platform.executableArguments.

* Use strchr instead of strtok_r to avoid modifying value of
  DART_VM_OPTIONS environment variable in place.

TEST=pkg/dartdev/test/commands/compile_test.dart

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

Change-Id: I86e0ece20844888333b2a0765c82a5ad1fba54b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491001
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-03-26 19:52:00 -07:00
Ben Konyi e3ca6d824b [ Service ] Add expression evaluation support to dart_runtime_service_vm
Brings pass rate of package:vm_service tests to ~85%

TEST=Manual
Change-Id: I2335d98358362110add93c2acfe51c3fc1385237
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487560
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-03-16 11:14:52 -07:00
Alexander Aprelev 9bd916646a [infra] Roll clang to d0ddae678e3f634c988542dfbdde1dd0afe66344.
Update clang format, remove boringssl err.h from clang-tidy

TEST=ci
Change-Id: Ib73d89b292ee4dfa2249ec519071e7621bb92c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487885
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2026-03-13 12:34:40 -07:00
Ben Konyi a8aba7fab8 [ Service ] Add support for isolate-based RPCs to dart_runtime_service_vm
This change adds initial support for working with isolates in the Dart
Runtime Service and its backends.

The new `IsolateManager` base class tracks the set of active isolates
and their lifecycle events. The `VmIsolateManager` extends this class,
adding support specific to interacting with isolates within the Dart VM.

TEST=vm/cc/DartAPI_InvokeVMServiceMethod*_Exp

Change-Id: I3dfa298722c40dbdfdd58105cc78f31d058dd7a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486560
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2026-03-12 09:08:14 -07:00
Ben Konyi f7a049dfb4 [ Service ] Initial implementation of VM Service based on package:dart_runtime_service
This change includes an initial implementation of the new VM service
implementation based on `package:dart_runtime_service`, along with the
necessary plumbing to start it in place of the legacy VM service
implementation.

The entrypoint for the new VM service implementation is located in
dart_runtime_service_vm/bin/vm_service_entrypoint.dart, which is
compiled into AppJIT and AOT snapshots when the
`--include-experimental-vm-service` flag is provided to `build.py`. To run
the VM with the new VM service implementation, the
`--experimental-vm-service` flag must be provided.

Currently, the experimental VM service implementation supports:

  - User specified ports
  - Authentication code flags
  - Enabling the HTTP server via SIGQUIT
  - Some service protocol RPCs that don't require an isolate ID (e.g.,
    `getVM`)

See go/dart-runtime-services-unification for more details.

TEST=Manual

CoreLibraryReviewExempt: dart:_vmservice is private
Change-Id: I4a58cd1fa0a386313baa3d5c5345720231279123
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484820
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-03-10 13:27:01 -07:00
Ryan Macnak 38743dd774 [vm] Remove unused dependency on ICU i18n.
TEST=ci
Change-Id: I6a09ef8af516495d479b5969aa89c9b2ceb9dc6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486824
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-03-10 12:36:30 -07:00
Ryan Macnak a74e0132e8 [build] Generate DW_AT_variables for bin_to_assembly data outputs.
This lets bloaty attribute the data symbol to its source file, allowing the binary size visualization to nest it appropriately.

TEST=runtime/tools/binary_size
Change-Id: I683ad6729d2fe2e1730dd3be70c6cce15bdf0003
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486524
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-03-10 09:14:30 -07:00
Ryan Macnak 5e173fa736 [vm] Mark natives as unreachable in gen_snapshot.
This allows a great deal of linker GC resulting in a much smaller binary. The benefit multiplies for Flutter development because the Flutter tool downloads many variant copies of gen_snapshot.

out/ReleaseX64/exe.stripped/gen_snapshot -1.55M (-23.4%)

TEST=ci
Change-Id: I9f6e650f78ea52c9c6953320a669b71019403236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482965
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-02-24 10:08:30 -08:00
Ryan Macnak 293e84cd5c [vm] Use /Zc:preprocessor to get __VA_OPT__ under MSVC.
Needed by irregexp.

TEST=ci
Change-Id: Ie64ee2869ddbb5bad234aea9b49d140b96fed2be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481242
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-02-18 09:18:10 -08:00
Arbaaz Ahmed e2c278d03b [vm] Allow to skip crash handler installation in bin::Platform::Initialize.
Closes https://github.com/dart-lang/sdk/pull/62680

GitOrigin-RevId: cfb5a10ad92bf8a2b0f56486b8b69b626b9bef44
Change-Id: I853d91c1f3a8b1184455489653510e562c17ebaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480880
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-02-17 03:56:29 -08:00
Liam Appelbe 4679c040c6 [vm] Sync ffi callbacks can enter owned target isolate
Adds a new code path for NativeCallable.isolateLocal invocations. If
the current thread is not entered into any isolate, but owns the
target isolate, then it enters the target isolate, invokes, then exits
the isolate.

Fixes: https://github.com/dart-lang/sdk/issues/61623
TEST=tests/ffi/function_callbacks_isolate_ownership_test.dart
Change-Id: I401f185fadf7d2a55190dafd15387e1c418c67c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452380
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2026-02-05 01:29:23 -08:00
Ryan Macnak 1dc4277e5b [vm] Remove dead code.
TEST=ci
Change-Id: Ic162deea4a39869a158726616e5c8dc0ff058817
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475781
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-01-27 09:14:39 -08:00
Slava Egorov 25ffce7e36 [vm/win] Avoid unnecessary consoles for dartvm.exe
If dart.exe is not attached to the console then it should spawn
dartvm.exe detached to avoid creating an unnecessary console
window.

Fixes https://github.com/dart-lang/build/issues/4312

TEST=standalone/io/windows_no_unnecessary_console_test

Change-Id: I1de65accca5e28f3cfbe44a70f782525f0059bf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475000
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2026-01-22 08:17:43 -08:00