Commit Graph

91 Commits

Author SHA1 Message Date
Alexander Markov 28d7984e31 [modular_aot] Use primary constructors
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I7476ec7e66edd958c66e31dabcd6ab8d818594e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509640
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-08 10:32:03 -07:00
Alexander Markov 7df4ef0cf1 [modular_aot] Fix number of optional named parameters when reading function types from module snapshot
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Iaa38ca6c62f9899d2c3f0363c484dbe15e0a9859
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509523
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-06-08 07:36:51 -07:00
Alexander Markov ea1360fbaf [modular_aot] Fixes for code generation of TypeCast
* Use exact code pattern for calling TTS which is expected by
  the VM at runtime.
* Always set instantiator/function type arguments registers for TTS.
* List all registers potentially clobbered by TTS.

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I011bcfc8b755864271877cc36d365ba2b5f10648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509480
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-08 07:17:10 -07:00
Alexander Markov 3060ea57d7 [modular_aot] Handle parallel moves when the same source location is used multiple times
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Iffa54fdfd3b221ed5f25c49214aa920b2ae590ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509064
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-04 06:20:20 -07:00
Alexander Markov 8b77454b37 [modular_aot] Fix LiveRange.findRegisterUseAfter
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I6a599d32001d6df31e61b8ea5c68569792cc82bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508704
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-06-03 12:10:01 -07:00
Alexander Markov 021068bb3d [modular_aot] Serialization of UndefinedConstant in module snapshots
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I94509fe61830174eecaec6ccfaeb13c6d20c4c27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508707
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-03 11:32:19 -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
Alexander Markov b6015976c9 [modular_aot] Fix splitting of a live range which has a split tail already
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I9d78195dcfd6f70f793c98710106fa5f1f8834c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508280
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-02 05:42:48 -07:00
Alexander Markov 5dd8edc9ff [modular_aot] Support enclosing function type arguments
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I89fb302bc3f7b1e6e28ac80dddb756c6b2447c8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505421
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-01 09:56:02 -07:00
Alexander Markov d7d723327f [modular_aot] Serialization of type parameter declarations in module snapshots
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ia5646ec6e2133a2232ffbbdb4926d94296bcd690
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505522
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-22 10:10:19 -07:00
Alexander Markov c5391da658 [modular_aot] Flatten/expand vectors of instance type arguments
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Id4e4e45385f8d79e97e351e4b8a6ed9ba0d99701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505061
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-20 14:20:57 -07:00
Alexander Markov 1aa61dabf7 [modular_aot] Fix accesses to certain fields of Dart objects
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I4c14828fec7487b2d97643d8089fb2d4a18e754e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505020
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-20 11:43:22 -07:00
Alexander Markov c0902a81a0 [modular_aot] Code generation for NullCheck
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I0a3ba9dae62514ed9330366e9e4e33b38f44e4c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504760
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-20 11:42:54 -07:00
Tess Strickland 52cfd29cbb [vm,dynamic_modules] Add RecordCoverage instruction.
The RecordCoverage instruction has an A/E encoding. The A argument
is the type of coverage being recorded, whereas the E argument is
the logical index into the coverage array for updating whether that
source position has been hit.

Also adds new metadata to the bytecode component for the coverage
arrays associated with bytecode containing RecordCoverage instructions
and a new runtime entry for lazily allocate the coverage array for
an interpreted function when needed.

The type of coverage is encoded in the RecordCoverage instruction,
despite being redundant with the information in the coverage array, so that checking whether that type of coverage is currently enabled at
runtime doesn't require either accessing the coverage array (which may
be lazily allocated), forcing allocation of the coverage array just to
discover that type of coverage is currently disabled, or reading the
serialized bytecode component to avoid that forced allocation.

------

Other changes:

Source reporting now treats unexecuted interpreted functions when
not forcing compilation as if they were uncompiled native functions,
so that the source report from running the same code gives the same
result whether using the interpreter or the native compiler.

Bytecode closures are no longer skipped in source reports. Previously
any closure without a context scope was skipped, but bytecode closures
don't have those.

TEST=vm/cc/SourceReport_Coverage

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: I7557e5dd4c98331c7ca2f5c867dd5f6d03e9d756
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501520
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-05-19 04:27:39 -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
Alexander Markov ca9c12f1b6 [modular_aot] Support more cases of parallel moves and double immediates
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I8b167ea819d4247ca748f5200b5509e99a68d56e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503560
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-18 10:10:21 -07:00
Alexander Markov a99020a90b [modular_aot] Revise canBeSmi predicate
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I423814f5ca1ebe57cdcd980a0844e9feaf7e57e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503900
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-18 08:12:02 -07:00
Alexander Markov 45503a1a3e [modular_aot] Instance method closurization
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I5e8993936b55c7cb8b581c64fd7ce8a38c9f9ee8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503682
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-18 08:03:55 -07:00
Alexander Markov ccbcd76265 [modular_aot] Records
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ie6ba4148ca9193b5b28de3d90efa7bb55427ef53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498660
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-18 08:03:32 -07:00
Alexander Markov e09282c8f2 [modular_aot] Closures, part 2
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Id8029dddd75b5f771ddf8197190d18aea9efd192
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503080
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-13 05:58:22 -07:00
Alexander Markov a04ca7e2fa [modular_aot] Write barrier wrapper stub
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I9d3909dffead10d3b820c89ad176ff0c119164c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501680
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-08 07:30:22 -07:00
Alexander Markov 7d21d6dcf5 [modular_aot] Fix empty Map literals
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I6488e1e13c7a250f8c61e378ce302d58e60d7db3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501261
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-08 07:23:13 -07:00
Alexander Markov 76ffb5053c [modular_aot] Instantiation of type arguments
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I019ebc77c9e3f8d1748797fe76b17ccce82a0d5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501260
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-08 07:22:17 -07:00
Alexander Markov aec3f9f9b0 [modular_aot] Fix matching names of optional parameters
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I0f3d51190718f0551504f11faf5fa991e534ddbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500600
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-08 07:15:08 -07:00
Alexander Markov 3ea6ec325b [modular_aot] Code generation for unary int -, ~, toDouble
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I7050f3c751647a969d1f4b25529bb263ccde4826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500581
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-08 07:14:06 -07:00
Alexander Markov c067ade460 [modular_aot] Code generation for comparisons (except FP and identical)
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I2a48c47e2e04b095960fb45164fe89c97cb2452c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500483
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-08 07:00:00 -07:00
Alexander Markov 27a5d75c2f [modular_aot] Code generation for UnaryBoolOp
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ia3913b94b6aa357b352d10572342fab3b55b4825
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500482
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-06 09:48:04 -07:00
Alexander Markov 6251367ab1 [modular_aot] Compile closure functions and support captured variables
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ibbb4b4ed73c89f458e2b08898a96f4f1979965eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492663
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-06 09:47:58 -07:00
Alexander Markov 470f6e9fad [modular_aot] Regalloc fixes
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Idceb800084ace76b880f170683686b532ac4df67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499941
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-04 08:16:18 -07:00
Jens Johansen ec5e71ead4 [CFE] Rename additionalDills to additionalDillModules; don't use it to load platform
* Rename additionalDills to additionalDillModules to indicate that it
   is used to load a "module", not any old dill file.
 * Where additionalDills was used to provide the platform use sdkSummary
   instead.
 * Remove unused constructor in KernelCompilationResults.

Tested: Existing tests.
Change-Id: I5f73f61db73b2bc932c211fb0b2e66ec2f5c50c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495981
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-05-01 00:57:31 -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
Alexander Markov dff95e77a4 [modular_aot] Avoid generating code for instance members of mixins
After mixin transformation, original members of mixins should not be
called. Only their clones in the mixin application classes can be
called.

By removing their bodies we can reduce code size and avoid any
complexity related to super-invocations of abstract members.

Change-Id: I0ae1bbac6e4c82356841fdc870bfd8ca1bac8fb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497102
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-22 06:30:33 -07:00
Alexander Markov bd698307ac [modular_aot] Define type arguments field in the built-in classes
Issue: https://github.com/dart-lang/sdk/issues/61635

Change-Id: I4a6093afc01a2c68143e6e7d29d7661e17854a0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497080
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-22 06:22:01 -07:00
Alexander Markov 11d732e537 [modular_aot] Translate async/async*/sync*/await/yield/yield* to CFG IR
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ib5a7bc509e0382ceea53365b9ca3543a76a7cce1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496660
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-22 06:19:44 -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
Alexander Markov 7bf09be8f3 [modular_aot] Bugfixes and improvements in regalloc
TEST=pkg/native_compiler/testcases/register_allocator_test.dart

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I22d88a6962290bd8aab0d4d3239d652e69242fbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495522
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-21 08:45:52 -07:00
Alexander Markov 4f960f11b1 [modular_aot] Initial implementation of late local variables
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I8414ff832a569c106728fc583ece6248f73c91e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494942
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-16 07:18:48 -07:00
Alexander Markov 015b06f0f5 [modular_aot] Fix register eviction to ignore AnyLocation uses
TEST=pkg/native_compiler/testcases/register_allocator_test.dart

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ibffdadfbf5faf4856f8cd2c5520acdb6853cb47f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495520
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-16 07:17:04 -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
Alexander Markov 51d1c8923a Reland "[vm,dart2bytecode,modular_aot] Variable-length closure objects"
This is a reland of commit 88496ba1c3

Fixes on top of the original change:

* Closure layout is changed to avoid gap between fixed fields and
  variable-length elements on compressed pointers architecture.
  This gap was causing crashes in the GC when scanning closure
  objects.

* pkg/vm_snapshot_analysis/test/instruction_sizes_test is fixed
  on arm64 by decreasing threshold for detecting size changes.

Original change's description:
> [vm,dart2bytecode,modular_aot] Variable-length closure objects
>
> Extend closure objects with variable number of elements to capture.
> This is needed to support capturing multiple independent contexts
> after capturing is computed in the front-end.
>
> The following fixed Closure fields are moved into variable-length
> elements:
>  - delayed type arguments;
>  - instantiator type arguments;
>  - function type arguments;
>  - context.
>
> Number of elements and presence/indices of various type arguments
> are encoded into the new length_and_flags field in the Closure.
>
> Most closure objects don't need any of the type arguments so this
> change will reduce average Closure object size.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61572
Issue: https://github.com/dart-lang/sdk/issues/61635

Change-Id: I8685e632e2d0832766ecdc470f3cf9a6b880de48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494243
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-10 06:15:22 -07:00
Alexander Markov 0dfaa16dc7 Revert "[vm,dart2bytecode,modular_aot] Variable-length closure objects"
This reverts commit 88496ba1c3.

Reason for revert: crashes on arm64c

Original change's description:
> [vm,dart2bytecode,modular_aot] Variable-length closure objects
>
> Extend closure objects with variable number of elements to capture.
> This is needed to support capturing multiple independent contexts
> after capturing is computed in the front-end.
>
> The following fixed Closure fields are moved into variable-length
> elements:
>  - delayed type arguments;
>  - instantiator type arguments;
>  - function type arguments;
>  - context.
>
> Number of elements and presence/indices of various type arguments
> are encoded into the new length_and_flags field in the Closure.
>
> Most closure objects don't need any of the type arguments so this
> change will reduce average Closure object size.
>
> TEST=ci
> Issue: https://github.com/dart-lang/sdk/issues/61572
> Issue: https://github.com/dart-lang/sdk/issues/61635
>
> Change-Id: I7ca5cec0fd8725c432a01d51781fb14e803997dd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489482
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>

Issue: https://github.com/dart-lang/sdk/issues/61572
Issue: https://github.com/dart-lang/sdk/issues/61635
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I94c88f8922f6ea49251e942ba791fee714911e25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494261
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-09 14:12:09 -07:00
Alexander Markov 88496ba1c3 [vm,dart2bytecode,modular_aot] Variable-length closure objects
Extend closure objects with variable number of elements to capture.
This is needed to support capturing multiple independent contexts
after capturing is computed in the front-end.

The following fixed Closure fields are moved into variable-length
elements:
 - delayed type arguments;
 - instantiator type arguments;
 - function type arguments;
 - context.

Number of elements and presence/indices of various type arguments
are encoded into the new length_and_flags field in the Closure.

Most closure objects don't need any of the type arguments so this
change will reduce average Closure object size.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61572
Issue: https://github.com/dart-lang/sdk/issues/61635

Change-Id: I7ca5cec0fd8725c432a01d51781fb14e803997dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489482
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2026-04-09 12:22:21 -07:00
Alexander Markov 5789ef3f58 [modular_aot] Revise code generation for TypeTest
* Fix operand register.
* Correct Smi fast path.
* Implement slow path via runtime call.

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I12cac0db8465a057ce426e33dcbd8c9beb1823a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493460
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-08 07:52:06 -07:00
Alexander Markov da81aaa165 [modular_aot] Code generation for type literals
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Icbb7ff58d07e20b7119726d2a551157f844f25ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493102
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-08 07:44:08 -07:00
Alexander Markov 5653511163 [modular_aot] Serialization of type parameter types in the modular snapshots
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I1d0de6222681741acd6a25b06c0b4b3f12ca8534
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493101
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-08 07:44:03 -07:00
Alexander Markov b205d4c074 [modular_aot] Initial code generation for int shifts
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I59fbd4695aed381e834b03d617fee5dd9d371ec3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492920
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-08 06:50:29 -07:00
Ryan Macnak 4ed176799e [vm] Move direct roots from IsolateGroup to ObjectStore.
TEST=ci
Change-Id: I8ac97b83c427ab83dec2d7418a55893d2b5342ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491980
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-01 09:56:13 -07:00
Alexander Markov 7ea3545d2c [modular_aot] Fix receiving of optional and named parameters when type arguments are passed
ArgumentsDescriptor.count does not include type arguments argument,
so receiving optional and named parameters should account for that
both when comparing count to a number of arguments and when
computing offset of an argument.

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I58c7f38e834453bdf15a5026051fa4f0375eae15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488561
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-03-18 14:53:17 -07:00
Alexander Markov d611d205e3 [modular_aot] Initial code generation for TypeCast, TypeTest
Also:
* Revise code generation for cycles in parallel moves using temporary
  register.
* Support splitting of live intervals both at even and odd positions.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I900edc275b59daf93604668eada1421dd125b217
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487982
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-03-18 14:53:09 -07:00