Commit Graph

61 Commits

Author SHA1 Message Date
Johnni Winther 8e2d140fa5 [cfe][InternalNodes] Implement InternalVariable directly
This updates the InternalVariable hierarchy to be based on a sealed base class InternalVariable with no connection to IVariable. IVariable is removed and unused properties of InternalVariable are removed.

TEST=existing

Change-Id: Iacfbe9ab21d1c9aab043712099cd1ee6e4cee174
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510825
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-06-11 02:43:16 -07:00
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
Parker Lougheed 95b8f52f9f [modular_aot] Fix swapped opcodes in comparison simplification
Updates the simplification of moving constat operands of comparisons to the right to correctly use the strictly swapped operand rather than the negated operand.

Also change the `flipOperands` function to a `swapped` getter to avoid confusion and be clearer that it returns a new value, rather than changing the current one. This better aligns with the Effective Dart guidelines for when to use a getter and how to name them.

TEST=pkg/cfg/testcases/simplification.dart

Change-Id: Id2c19b7cfcbc1586413251b2b9d6d54abcf590c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509840
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-06-08 05:34:33 -07:00
Alexander Markov 42ebe08081 [modular_aot] Fix simplification of string interpolation
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I6404c761f9849a50ee25c0387557c20c7b4d632c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508700
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-03 12:12:19 -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
Chloe Stefantsova 849c282e06 [cfe] Add more checks to verification of new variables
* Check that all variables are assigned a context.
* Check that the variable appears exactly once in its enclosing
contexts.
* Check that the variables can be found in their contexts.

Part of https://github.com/dart-lang/sdk/issues/61572

Change-Id: I3ed837c538a4b9933d556cc1f9643422b75a5aa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507120
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-05-29 03:52:14 -07:00
Johnni Winther 02046380d1 [cfe][Contexts][InternalNodes] Add internal nodes for FunctionNode, FunctionExpression and FunctionDeclaration
This adds internal nodes for FunctionNode, FunctionExpression and FunctionDeclaration which require InternalVariable rather than Variable. This is in preparation for using the new variable model by default.

Change-Id: I3c29954bcaae555c20b37e6a3ba1e70d959f1559
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506941
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-05-29 02:41:29 -07:00
Johnni Winther 6b693e00bc [kernel][Contexts] Add VariableDeclaration
This adds a VariableDeclaration node which is used in ForStatement instead of VariableStatement.

This is a step towards removing the initializer from Variable. Long term, VariableDeclaration will own the initializer expression for variables and function parameters will have a defaultValue property instead of using the initializer property for the default value.

TEST=existing

Change-Id: I4a663eeb6006a0f9f098fb2b3e3b502d2ae583b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505681
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2026-05-27 00:41:34 -07:00
Johnni Winther 80c9d57250 [kernel][Contexts] Rename VariableDeclaration to Variable
This is a step towards split variables from their declarations as part of encoding variables and their usage more precisely.

TEST=existing

Change-Id: I4a0eeb2947bdebce3667afda4e6cfbfdf5d7de18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504201
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
2026-05-21 01:51:10 -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 fd3ec3b96b [modular_aot] Make NaN handling in doubleToIntBits/intBitsToDouble platform independent
Fixes https://github.com/dart-lang/sdk/issues/63400

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I45d4603212b1c8205ea8b0f76ea6b5e24bc06f2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504683
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-20 12:46:04 -07:00
Chloe Stefantsova 10dd51ee4c [cfe] Verify new variables have contexts
Part of https://github.com/dart-lang/sdk/issues/61572

Change-Id: I01295904c8fd5f76574e8979eb40e4cd174f9e09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504202
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2026-05-19 04:29:29 -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
Johnni Winther e30cd0322c [cfe][Contexts] Split VariableDeclaration and VariableStatement
This separates VariableDeclaration from Statement. VariableDeclaration no longer implements Statement and variable declared in a block or in a for-statement are now wrapped by a VariableStatement.

Currently there are two VariableStatement implementations; LegacyVariableStatement for variables in the current model, called LegacyVariable, and VariableInitialization for variables used in the new, still experimental, encoding that supports scope computation.

This CL is a step towards realigning the AST nodes to the new model in which each kind of variable has its own distinct subclass. (LocalVariable, PositionalParameter, NamedParameter, SyntheticVariable, etc.)

Note that it is not the intent to use VariableStatement in ForStatement going forward but that will be handled in a follow-up.

TEST=existing.

Change-Id: I5b309cd62c9b138f95b74fb054686edffa49a393
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502681
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-05-18 05:49:28 -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 da1f06f239 [vm,compiler] Fix loop computation in case of try blocks
If catch block is included into the loop, we should also include
the whole try body as there are implicit control flow edges between
each block in a try body and corresponding catch block.

If try body is not included, analysis of loop invariant loads
could miss conflicting stores and may conclude that certain loads are
loop invariant although they are not.

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

Change-Id: I9d6b73e24554ee3bfbcc722fa59634ea90b00abb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501560
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-08 06:37:30 -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 a585ead993 [modular_aot] Take FunctionNode of getters and setters into account
In addition to parameter variables, FunctionNode contains asyncMarker
(for example, getter can be sync*).

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I513425f9ffc4daa1cd48a5f8c8df594dea0c33d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498760
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-28 05:46:04 -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
Alexander Markov 946bb79832 [modular_aot] Support undefined value of local variables
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ic785f47da63511023de09167dd2787337a46f8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498200
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-27 07:40:35 -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 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
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 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 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
Paul Berry 4f333aa8d3 Bump cfg and native_compiler packages to language version 3.12.
This CL is part of an effort to bump the SDK requirement to `3.12.0-0`
for all the packages in `pkg` that are not published to `pub`, so that
we can get better testing of the "private named parameters" feature.

(Packages that *are* published to `pub` can't be safely bumped yet,
because SDK 3.12 hasn't been released, and I don't want to block those
packages' ability to publish useful updates to customers.)

This change covers the following packages, which are owned by
alexmarkov, sra, and vegorov:
- pkg/cfg
- pkg/native_compiler

Changes to `pubspec.yaml` files were made manually.

Change-Id: I39c86badeeeeae558bbf079e6a1df6686a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484225
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
2026-03-13 14:34:54 -07:00
Alexander Markov d97566551b [vm,modular_aot] Boxing/unboxing of int and double values
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I9fe47364bf772ccedf21f95aa5b16b92b0215b3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486240
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-03-09 11:34:09 -07:00
Alexander Markov 8a6955a272 [modular_aot] Optional and named parameters
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ib8a4cbb7312110b7daa82ca40555b452b0599549
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/485200
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-03-05 15:51:29 -08:00
Alexander Markov 0ec57dd561 [vm,modular_aot] Initial code generation for static field loads and stores
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I07aa7cabf8fe78c0f98c17b98ae85bdc903b99c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482920
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-02-24 08:54:39 -08:00
Alexander Markov dc2d8a06b9 [vm,modular_aot] Lowering of type parameters
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I06098a379ba3f04b5e13bad11acc0dcc391fb30c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482364
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-02-24 06:16:51 -08:00
Alexander Markov 7eb7da6890 [vm,modular_aot] Initial code generation for interface calls
Also:
* Support arguments descriptors.
* Fix order of ClosureCall inputs in local function invocations.
* Fix order of passing arguments in all Dart calls.
* Fix handling of fields in InstanceSerializationCluster.
* Do not compile abstract methods and fields.
* Do not generate initializer functions for fields with trivial
  initializers.
* Initialize Code::code_source_map to an empty CodeSourceMap
  (in order to avoid failed assertions).

TEST=tools/test.py -n vm-modaot-mac-debug-arm64 language

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I40ff1b8234c32c41e08f3288a23e4abc173efcfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480020
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-02-23 08:03:48 -08:00
Alexander Markov 3a9dbc9efa Initial code generation for instance field loads and stores
Also:
* Support receiving parameters on the stack.
* Computation of stack frame size.
* Mach-O symbols for functions and stubs.

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ic89ce5dbcad27c34d18790f2b526f1d33dfd6693
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478161
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-02-05 11:40:00 -08:00
Alexander Markov 151bc79032 Object allocation
TEST=tools/test.py -n vm-modaot-mac-debug-arm64 language
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ie569c19ef37e27f7f711dfc3d62db818691f28fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476600
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-02-03 13:09:02 -08:00
Alexander Markov c31486d066 Register allocation
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I556743b982ad415c233cdaf1857dc56a6216e927
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475403
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-01-26 07:46:52 -08:00
Alexander Markov 8845d06967 Constant type arguments
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I8ace9004b5ef706bec4b6583329c62825fbdb739
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475402
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-01-26 07:29:50 -08:00
Alexander Markov d87a52ec30 Initial implementation of lowering and codegen block order
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I36726b572940b0a6ca9e31c072c06c4d91cf1282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471923
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-01-12 08:25:06 -08:00
Alexander Markov e314cccd3b [cfg] Support more operations in CFG IR and AST-to-CFG translation
Add support for the following AST nodes:

TypeLiteral, ListLiteral, MapLiteral, InstanceTearOff, NullCheck,
StringConcatenation, FunctionExpression (preliminary),
FunctionDeclaration (preliminary), FunctionInvocation,
LocalFunctionInvocation, Not, LogicalExpression.

Add the following CFG IR instructions:

ClosureCall, NullCheck, TypeLiteral, AllocateClosure,
AllocateListLiteral, AllocateMapLiteral, StringInterpolation,
UnaryBoolOp.

Also add the following back-end-specific CFG IR instructions:

AllocateList, SetListElement.

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I6de65ef14c454745ed618e17640a216912fe05c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471865
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-01-12 07:31:28 -08:00
Alexander Markov cb2b871706 [cfg] Fix handling of unreachable AST in TryCatch and field initializers
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I189d7d3704c29b1350df23bca174990608b052ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467880
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-12-15 07:17:46 -08:00
Alexander Markov 153262871d Support more function kinds and nodes in AST-to-IR translation
Add support for getters, setters, constructors, implicit field getters,
implicit field setters, field initializers.

Support all kinds of constructor initializers, super and
constructor invocations.

Add IR instructions for field loads and stores and object allocation.

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ia83a3e8183958c384c2a177565abcc2b5cb0ef5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467121
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-11 06:19:33 -08:00
Alexander Markov 04d1eaa299 Control flow optimizations
Add a pass to remove redundancies in the control flow such as empty
basic blocks, useless branches and gotos.

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ie82fd2e09a0ba3e133abc65819a45e0fc3d3812a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467120
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-10 05:51:49 -08:00
Alexander Markov 45ec012c66 Constant propagation
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I105cf5914cad3db83f3d8097ddf793be454e43d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465741
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-04 08:26:41 -08:00
Alexander Markov 9f72ed9417 Dominator-based value numbering
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Iec078ced4da549456ccaa7f3f6bd23926e5e4e6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465701
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-04 06:46:30 -08:00