Commit Graph

22923 Commits

Author SHA1 Message Date
Alexander Aprelev 5a98fe5564 [vm/isolates] Avoid leaving isolate as part of native message handling.
Letting isolate go seems to be problematic. If this native messaging api is used during runtime call, then original isolate might end up on a different worker os thread causing remembered frame pointer(remembered as part of entering runtime call) to become invalid due to different stack bounds of this new thread. Invalid frame pointer causes immediate assertion failures during stack walk done for GC purposes or for exception handling.

TEST=ci, https://dart-review.git.corp.google.com/c/sdk/+/486522/comments/ee54d99f_a5c2a9d4

Change-Id: If69076bb9e107502dfef819de73829d9682bb134
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2026-05-06 14:42:04 -07:00
Ryan Macnak 5bb366bb9f [gardening] Remove lib/async/future_test from isolate stress test.
Bug: https://github.com/dart-lang/sdk/issues/63333
Cq-Include-Trybots: luci.dart.try:iso-stress-linux-arm64-try,iso-stress-linux-x64-try
Change-Id: I9521563be52a902db0720b98c345d7502324d8b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501200
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-06 13:13:46 -07:00
Alexander Markov 69b84908a5 [vm,arm] Fix for crash in Subtype6TestCache on 32-bit arm
On 32-bit arm, when generating subtype test cache stub,
[delayed_type_args_reg] could be the same as [TypeTestABI::kInstanceReg]
(due to lack of registers).

As a result, when loading delayed type arguments from an instantiated
generic closure, [TypeTestABI::kInstanceReg] is eagerly overwritten,
which results in garbage delayed type arguments.

With the linear probe cache this would cause repeated cache misses.
With the hash-based cache this would cause a crash.

Bug: b/507666702
Change-Id: I1093f9277d874154a121ef644ecd7aa76320f789
TEST=runtime/tests/vm/dart/regress_b_507666702_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500842
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-06 06:41:04 -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
Alexander Aprelev 00cda4d60f [ffi/isolate_group] Move IsolateGroupBound callbacks from isolate to isolate group.
This allows creation of isolategroup-bound callbacks when isolate is not available. For example, to support proposed Isolate::onEvent/Isolate::handleEvent api https://github.com/dart-lang/language/blob/main/working/333%20-%20shared%20memory%20multithreading/shared_native_memory.md#additional-isolate-apis.

BUG=https://github.com/dart-lang/sdk/issues/63291
TEST=isolate_group_bound_callback_test

CoreLibraryReviewExempt: vm ffi-specific comments changes
Change-Id: I9a757a39ba8e152db64f59a66d337ca672103277
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499661
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2026-05-05 08:37:06 -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
Kallen Tu 8bfb683892 Enable 'primary-constructors' feature flag.
This CL enables the primary constructors feature by default in Dart 3.13.

The primary constructors feature is a brevity feature. There are no new semantics, but it allows us to express declarations in a less verbose way.

This feature allows one constructor and a set of instance variables to be specified in the header of a declaration.

Currently a declaration with a constructor and some fields is written as:

```dart
// Current syntax.
class Point {
  int x;
  int y;
  Point(this.x, this.y);
}
```

With a primary constructor, we would write the above as:

```
class Point(var int x, var int y);
```

If a primary constructor needs an initializer list or a body, they can be
specified inside the class using the `this` body syntax:

```dart
class Point(var int x, var int y) {
  this : assert(x >= 0) {
    print('Point created at $x, $y');
  }
}
```

As part of this feature, you can also use the `new` and `factory` keywords to
declare constructors in the class body without repeating the class name:
```dart
class Point {
  int x, y;

  // Equivalent to Point(this.x, this.y)
  new(this.x, this.y);

  // Equivalent to Point.origin()
  new origin() : x = 0, y = 0;

  // Equivalent to factory Point.clone(Point other)
  factory clone(Point other) => Point(other.x, other.y);
}
```

To learn more about the feature, check out the feature specification located here: https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md

Tested: Has existing language, CFE, analyzer, analysis server tests.
Bug: https://github.com/dart-lang/sdk/issues/61524
Change-Id: I296f2fcd918b87bf2a1dd00256340759866c2423
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489241
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2026-05-04 15:09:49 -07:00
Ryan Macnak 97886e6dbf [vm, ffi] Remove special case for Fuchsia FFI callback thunks, take 2.
Require the embedder to place a blob containing the FFI callback stub at pkg/lib/ffi_callback_stub.bin. All blobs in the package can be loaded as executable VMOs.

Also reapply "Remove special case for simulator FFI callback thunks."

TEST=ci
Change-Id: I6ab4a73fc28fb750e45e67797b0bf9deee9d8b53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495840
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-04 10:45:15 -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
Tess Strickland 73a2c6c9a7 [vm] Fix EXPECT_STREQ output when the common prefix and suffix overlap.
Currently, the common prefix and suffix can end up being larger than one
of the two strings, if the other string has extra content that matches
the portion in the overlap. For example, in JSON output, there might be
a missing } in a run of consecutive }s when closing JSON outputs. (Or,
more likely thanks to our infrastructure for generating JSON outputs,
that the expected string has an extra }.) In this case, the returned
mismatches are empty, making it hard to discern what went wrong.

This CL fixes that by limiting the common suffix to be no larger than
the portion of the smaller string after the common prefix.

Also add handling in the case where the two strings are equal (here,
returning the escaped string in the prefix and leaving the other outputs
empty), though this shouldn't happen since this function is only called
when the null-terminated strings are not equal.

TEST=ci (manual testing on while working on CL 450381)

Change-Id: I52140f32bd44d7e31cf6ba97d862a89ac0568f02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499221
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2026-04-30 02:34:29 -07:00
Jens Johansen 4ee8852d77 [CFE/parser] Update 'end' on endLiteralString; Set offset of StringConcatenation to the start; rename 'token' to 'operatorToken' on endBinaryPatterns
* The 'end' token on endLiteralString is now the last token of the
   string, not the next unrelated token.
 * Set the offset of StringConcatenation to the start of the string,
   not the start of the next unrelated token.
 * The 'end' token on endBinaryPatterns is renamed to 'operatorToken'.

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

Tested: Existing
Change-Id: Iae788464008594c21e759570a626971d89688033
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498601
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-30 01:05:23 -07:00
Ryan Macnak 55f91b69a5 [vm] Remove unneeded HandleScope immediately after StackZone.
There's no point in unwinding the zone's scoped handle blocks just before deleting the entire zone.

TEST=ci
Change-Id: I364c717bffd16f727d6f2427a7b9693a83d74c13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-29 15:36:54 -07:00
Ryan Macnak e07f7eddd8 [vm] Remove dead regexp code.
TEST=ci
Change-Id: I976bcb7bf24f4a8134d5c1c5e20e8f98dc85cfbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499082
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-29 08:10:43 -07:00
Ryan Macnak 7012150dc7 [vm] Hoist allocation of sentinel et al.
These will be base objects even for kFullAOT and kFullJIT snapshots, so their allocation needs to be separated from the rest of Object::Init.

TEST=ci
Change-Id: I1ad03cf9900a925d3b084843206bba7f67c5daa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499083
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-29 08:06:40 -07:00
Ryan Macnak 59439606f1 [vm] Remove redundant class roots.
TEST=ci
Change-Id: I6da62827577c4cd4edb3514c3df56175073ac2a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499041
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-28 15:51:33 -07:00
Ryan Macnak e118f9cf00 [vm] Add flag to check core snapshots also match on OS and architecture.
For checking g3 roll in advance of hard requirement.

TEST=ci
Change-Id: Ia720c66941bf303af2a66e1afcb7d1c99f8e5d4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498981
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-28 11:05:30 -07:00
Alexander Markov 54e607854a [modular_aot] Code generation for async/async*/sync*/await/yield/yield*
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ie8da89e09bfad68c65980abc1df69f9273bd6d00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497400
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-28 05:45:31 -07:00
Kilian Schulte 9e8fdef17c Add annotation-based creation location tracking
Closes https://github.com/dart-lang/sdk/pull/63011

GitOrigin-RevId: 926534c2f5d3cd1e9629cf25f6b028ab34c00e64
Change-Id: I88460a060faabeae8f611e88f23b2eb5fc99f21a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491702
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-04-28 03:06:03 -07:00
Nate Biggs 3d2d6492c1 Add 'external-effect' pragma support to all the backends.
Call sites targeting a procedure annotated with `external-effect` will
not produce any code, including the argument which will not be
evaluated.

However, the single parameter will be treated as 'live' for the purposes
of any global analysis the backends do. This is useful for things like
protobuf shaking where a user may want to retain certain protobuf
messages without actually emitting the code that retains those messages.

Today this functionality is available internally in the vm and wasm SDK
libraries. dart2js has similar functionality represented via the
opaqueTrue and opaqueFalse booleans (which will cause conditional
branches to get shaken after analysis). This will replace dart2js's
opaque(True/False).

This also adds validation to the frontend to ensure a method annotated
with 'external-effect' is well-formed.

Change-Id: If1c4096673e655c58fe7638840a16125003e7809
Tested: Backend tests for codegen were added. A frontend test was added for the validation. A language test was added to confirm the behavior.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476020
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2026-04-27 09:42:38 -07:00
Sigmund Cherem 8c9f9af9e3 [vm] Make IsRedirectingFactory a JIT-only state bit
To support checking for dynamically-callable targets in dart dynamic
modules, we need to use a bit in the Function header in AOT. Currently
all 32 bits of `kind_tags_` are in use. To make space for that new bit,
we need to evict one of the current properties that is not needed by AOT.

Among them, `IsRedirectingFactory` made the top of the list. It has only
one use in non-AOT logic.

TEST=existing
Bug: b/448095881

Change-Id: I3112d8865523696ed8e906a6c59f53c23db3090a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498281
Auto-Submit: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-04-27 08:53:18 -07:00
Alexander Markov 8363860ee7 [vm,compiler] Fix handling of the argument of _simpleInstanceOf
The 2nd argument of _simpleInstanceOf call is always a
Constant (type). However, a Redefinition can be inserted in the middle.

So, instead of ArgumentAt(1)->AsConstant()->value() it is
more safe to use ArgumentValueAt(1)->BoundConstant() as
BindsToConstant/BoundConstant unwraps Redefinition(s) via
OriginalDefinition().

TEST=runtime/tests/vm/dart/regress_63211_test.dart
Fixes https://github.com/dart-lang/sdk/issues/63211

Change-Id: Ie4a473ebe2deee8562e6634a792f02b0dcefc918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497761
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-27 07:38:24 -07:00
Ryan Macnak e1d540f0d2 [vm] Fix missing deep immutability bit on strings written as ROData.
TEST=vm-isolate or core snapshots with code
Change-Id: Ic247ff6946556df953828fa60d189e6abdd90014
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497340
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-22 10:30:04 -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
Modestas Valauskas b74add4813 [vm/compiler] Specialize Int32x4 operators in AOT.
The five binary operators on Int32x4 (+, -, |, &, ^) were never added
to the recognized-method list as graph intrinsics, so calls to them
were left as runtime calls through external-name bodies. In JIT the
call specializer picked kInt32x4Cid from IC feedback and emitted a
native SimdOpInstr, but AOT has no IC feedback and therefore fell back
to boxed calls, making Int32x4List inner loops 10-70x slower than both
the JIT version and a hand-written scalar equivalent.

This CL wires the same specialization paths that already exist for
Float32x4.+,-,*,/:
  - recognize the five operators as graph intrinsics and mark them
    with `@pragma("vm:recognized", "graph-intrinsic")` plus an
    exact-result-type pragma;
  - add Build_Int32x4{Add,Sub,BitAnd,BitOr,BitXor} helpers that
    delegate to the existing BuildSimdOp;
  - extend SimdOpInstr::KindForOperator and CreateFromCall;
  - extend CallSpecializer::InlineSimdOp and TryInlineRecognizedMethod
    so the non-speculative null-check path used for Float32x4 operators
    in AOT also applies here.

Measured on macOS arm64 (M-series), `dart compile exe`:

  Issue 63217 orSimd      : 12.58 -> 0.32 us/iter  (39x)
  Issue 63217 andNotSimd  : 23.51 -> 0.34 us/iter  (69x)
  Issue 53662 mandelbrot  : 4038.5 -> 55.5 ms       (72x)

A new benchmark benchmarks/SimdInt32x4 exercises all five operators
with a scalar and a SIMD variant so the specialization stays covered
by the benchmark bots; it is registered in Omnibus and OmnibusDeferred.

Existing tests/lib/typed_data/simd_*_test.dart still pass in JIT and
AOT.

TEST=tests/lib/typed_data/int32x4_arithmetic_test; benchmarks/SimdInt32x4
Bug: https://github.com/dart-lang/sdk/issues/53662
Bug: https://github.com/dart-lang/sdk/issues/63217
Change-Id: I9b76ab4fff228ff1a5e3d3c86f4bfc059e66a49a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497000
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Modestas Valauskas <valauskasmodestas@gmail.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-22 00:01:52 -07:00
Ryan Macnak f4d7f070a4 [vm] Remove irregular canonical bits.
Some objects have their canonical bit set but don't have the deeply immutable bit set. It's simpler if they have this bit clear so there is only cluster need, and these objects are instances of VM-internal classes that don't really do canonicalization.

Also give the oddballs their header hash while doing the rest of their initialization. This makes it easier to use the as snapshot base objects when there is no finalize VM isolate step.

TEST=ci
Change-Id: I7bdf7dc59b04ae30f49c5c67c0dc4f69c2d2524f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497121
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-21 15:05:16 -07:00
Ryan Macnak cd26f5e1cc [vm] Add missing serialization clusters for VM isolate objects.
TEST=ci
Change-Id: I738cf1a189accd2e449728bb599b6b92b5797924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496800
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-21 10:13:04 -07:00
Slava Egorov 488f97eb76 [vm] Update ObjectSlots to handle _LinkedHashBase
Generalize code which computes slots map to handle class hierarchies
which include base classes with VM-described layout like
_LinkedHashBase.

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

TEST=vm/dart/heap_snapshot_regress_63180

Change-Id: I32ab0e258e735f745d45f25813177d0f6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496861
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-21 04:02:25 -07:00
Slava Egorov 5ae14a808c Revert "[vm] Enable misc-include-cleaner in runtime/.clang-tidy"
This reverts commit 8664b0f98b.

Reason for revert: this was enabled without fixing existing violations in the code base.

Original change's description:
> [vm] Enable misc-include-cleaner in runtime/.clang-tidy
>
> Closes https://github.com/dart-lang/sdk/pull/63188
>
> GitOrigin-RevId: 66c5321fc38ae18fd7d7a340e6e162abf330bed1
> Change-Id: I2a8849a3887fc8677a82c9434fe581159a848c7a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496160
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I9d6e6cdfc084bc78341676c5d08f9d103783a200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496900
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-04-21 03:02:18 -07:00
randomizedcoder 8664b0f98b [vm] Enable misc-include-cleaner in runtime/.clang-tidy
Closes https://github.com/dart-lang/sdk/pull/63188

GitOrigin-RevId: 66c5321fc38ae18fd7d7a340e6e162abf330bed1
Change-Id: I2a8849a3887fc8677a82c9434fe581159a848c7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496160
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2026-04-20 19:26:12 -07:00
randomizedcoder 1f198e7596 [vm] Remove unused assert.h, add direct stdint.h includes in runtime/include/
Closes https://github.com/dart-lang/sdk/pull/63187

GitOrigin-RevId: 217908e166dfd4eea959e9c81b81ef9dadb0556c
Change-Id: I1ea2f133cede7d9bd6baf077882e41b86546ea9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496180
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2026-04-20 18:48:31 -07:00
Ryan Macnak af43c1a3d4 [vm] Switch FAR_TMP to X7 for compatibility with Zicfilp.
When enabled, indirect calls and jumps must set X7 to a label value that matches the label in a so-called landing pad at the call target. This check does not apply if the indirect call is made through X1/RA, X5/RA2 or X7/T2, with the expectation that the compiler will limit use of these registers for logically direct calls like an AUPIC+JALR pair, or for software guarded branches like a bounds-checked jump table. We use FAR_TMP for logically direct jumps that exceed J-type range, and blocking it from register allocation limits the availablity of gadgets that set X7.

Compare x64's IBT and arm64's BTI.

TEST=ci
Change-Id: Ic00195eb3c04cc10379f9965e05ef84052e02933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494861
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-20 17:46:32 -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
Slava Egorov 53ac68e2dd [vm_service] Deprecate Stack.messages
Make VM always return empty array in the response.

Current implementation for this field comes with a bunch of complexity
because it locks message handler and then invokes Dart code which
makes it difficult to reason about various invariants. This code is 
furthermore demonstrated to cause deadlocks. Given that nobody uses 
it - it is simpler to remove this code altogether.

Fixes https://github.com/flutter/flutter/issues/185156

TEST=ci

Change-Id: I497210e0f1542860caa0d765d634f8ec6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496340
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-20 10:28:01 -07:00
Tess Strickland 4c89523e4f [vm] Rework printing of EXPECT_STREQ failures.
Currently, the failure message for EXPECT_STREQ just prints the
(escaped) expected and actual strings on failure, but if the
expected and actual strings are mostly the same, it can be difficult
to determine what the difference actually is.

Instead, do a bit of work to find the common prefix and suffix of
the expected and actual strings, so that the actual difference is
more apparent. If the lengths of the common prefix and suffix
combined is considered too short to separately print them, then
the output is the same as before.

TEST=ci (failure output change only, so tested with
         vm/cc/SourceReport_Coverage output on vm-dyn-linux-debug-x64)

Change-Id: Iecaacde6ebf6628643bdf1440c6d77d4ff6599af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495980
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2026-04-17 04:47:53 -07:00
Alexander Markov 1d901d209d [vm] Add more details to the assertion in ObjectSlots::ObjectSlots
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/63180
Change-Id: I8dc86589827b31ce5838ecb2b4b0d80d5111871a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495942
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-16 14:47:59 -07:00
Alexander Markov d778eb84ac [vm] Fix TSAN data race between concurrent marker and ObjectCopyBase
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/63181

Change-Id: Ia350a73de17f7090e344102f831187368dfedbc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496040
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-16 10:07:23 -07:00
Tess Strickland 0e89c5e496 [vm,dyn_modules] Fix Rectangle/MutableRectangle on vm-dyn-aot.
Also allows the --print-classes flag to be used in the AOT runtime if
dynamic modules are enabled and crashes with an appropriate error
message if class finalization fails when loading a member from bytecode.

TEST=co19/LibTest/math/Rectangle co19/LibTest/math/MutableRectangle

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try
Change-Id: I1921aa0189eb587cd4658c592a779be190af092e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495724
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2026-04-16 04:25:37 -07:00
Ryan Macnak 3e05df3856 [vm] Fix more cases of the profiler failing to identify the entry frame.
TEST=dart-fuzz
Bug: https://github.com/dart-lang/sdk/issues/63105
Change-Id: I081a719a1d91c0e003a45ce1249e7856aa46a530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495784
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-15 15:23:51 -07:00
Nourhan 734e12ac96 [vm/service]: Add VM memory mappings for Windows
Implement AddVMMappings for Windows using VirtualQuery and
GetMappedFileNameA, matching the existing Linux/Android implementation.

TEST=tested manually on Windows by opening some tool and looking at
values

Fixes: https://github.com/dart-lang/sdk/issues/46166
Change-Id: I2ad9229c1cc39ffedca7a2c0fc50d5e3da36953d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493020
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2026-04-15 09:44:59 -07:00
Ryan Macnak b9222a8b7d [vm] Fix MSVC build.
TEST=ci
Change-Id: I13a1485b792e8115e6fbae1064cc60c81959dc7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495780
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-15 09:37:41 -07:00
Ryan Macnak 1c023e852d [vm] Fix dynamic modules build.
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try,vm-ffi-dyn-mac-release-simarm64_arm64-try
Change-Id: I565f12d85f3f6be10c2bfdb32a23344fc5e36ed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495620
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-14 21:05:29 -07:00
Ryan Macnak d4d46a4b83 [vm] Avoid confusing which FP to use for the 3 kinds of profiler stack walks.
We can do a "native" stack walk starting from the interrupt context, a Dart stack walk starting from the exit frame, or a Dart stack walk starting from the interrupt context / simulator state / interpreter state.

Decide which kind of stack walk to do once instead both inside and outside CollectSample. Remove CollectSample, as we should not need SEH guards now that we have accurate stack bounds.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/63105
Change-Id: I8f46f2ab860220e0be373f02aa882ac096bb2fb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493969
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-14 17:22:31 -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
Ivan Inozemtsev 97685b7dbb Add missing smi tag shifts
TEST=ci

Bug: b/502506240
Change-Id: Icb81c2c0653ed7793194c2454aa3fc283e797323
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495380
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2026-04-14 09:43:24 -07:00
Tess Strickland f9160e5c0b [vm,dyn_modules] Fix dynamic calls from dynamic modules in the AOT runtime.
Dynamic modules may make dynamic calls to compiled methods that had no
dynamic calls in the original whole world compilation. If this happens,
then dynamically create an interpreted dynamic invocation forwarder that
then appropiately checks and delegates to the compiled function.

TEST=co19/LibTest

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try
Change-Id: I283ca501f50118606650cf434b8debe30a43f676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494520
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2026-04-14 04:26:01 -07:00
Ryan Macnak 813afcee43 [vm] Simulator support for Zicfilp.
TEST=ci
Change-Id: Ibf9adb39da37ebb350097e3830202940e138c7d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494860
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-13 14:00:21 -07:00
Slava Egorov fff4f2324d [vm] Remove _HashFieldBase
This class is structurally equivalent to _HashVMBase and the only reason
for it to exist for inability of normal Dart classes to extend
_HashVMBase - but this can worked around by properly configuring
_HashVMBase class in bootstrapping.

TEST=ci

Change-Id: I5ca401e274920d2b4739424c6b6595306a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494140
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-04-13 10:10:42 -07:00