Commit Graph

3593 Commits

Author SHA1 Message Date
MarkZ cd20b29917 [reload_test] Resolving d8 timer problems in the reload suite.
d8 tests weren't executing code after a hot restart due to several factors:
1) subsequent calls to `main` after a hot restart weren't being added to an event loop.
2) periodic timers, which use `setInterval` weren't updated to check for the hot restart generation.
3) d8's simulated timers run synchronously, which interacts poorly with our async implementation. Periodic timers never cede to the async task that handles changing hot restart generation, so they would run forever whenever an error was thrown.

Changes:
* Added a helper to d8.js that cancels all timers.
* d8 now cancels all timers if an async main registers an error (via a handler on main).
* `setInterval` is now implemented.
* The embedder now accepts a publicly modifiable config object. `capturedMainHandler` and `mainErrorCallback` can be set via this object.

Change-Id: I523752ea69e8fd1f1ec0f6f585a484b670534cfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421680
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-04-18 15:08:48 -07:00
MarkZ 23cefd8aa9 [ddc] Adding support for hot reloaded super getters.
This removes the 'bind' and 'bindCall' methods in our runtime in favor of extending 'tearoff' to support their behavior. Also introduces 'superTearoff' for invoking torn off super members late.

Change-Id: I52ab797558a225c57cc2c6197c7b1bfa7f05a3c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416763
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2025-04-04 11:17:56 -07:00
Srujan Gaddam 9bc0d51467 [ddc] Compute js_util method regexes only once
sra@ noticed that we're recreating this RegExp every time
and we could just compute it once and store it in a static
field instead.

Change-Id: Iab2875d12295f0dc084aa1f0fb5e649b28c73c3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420165
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-04-03 13:34:17 -07:00
Lasse R.H. Nielsen a824ee3206 Include or remove stray pubspec.yaml files.
There were `pubspec.yaml` files in `tools/` that were not
included in the global package config.
That means that their imports were irrelevant, which could
be misleading. And if any tool would look at the
`pubspec.yaml` file, it might be inconsistent with
the actual package resolution.

Makes every `pubspec.yaml` file either be included by the
`tools/generate_package_config.dart` script, or deletes them
if they seem to be stale and unused.
(Compare vs. `git ls-files '**/pubspec.yaml'`.)

Excepted `tools/dart2js/sourceMapViewer/pubspec.yaml`.
The entire directory might be stale. The dependencies of
that pubspec are not SDK dependencies otherwise,
the pubspec has no SDK min-version, which is now a requirement,
and the README refers to a *packages directory*.
Keeping as-is and filing issue to have owners take a look.

Added `lib/` directory to `tools/` to avoid `tools/bots/`
being inside the package URI root of the `tools/` package,
which would cause its `../../pkg/...` import to fail.

Makes every `pubspec.yaml` file use a `^...` SDK constraint instead
of the longer `>= ... < ...` format.

Tested: No new tests, goal is to keep running the same way
Change-Id: I688e463fe985fc4de43550a1f4c7ff350536cffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414020
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-03-31 08:30:33 -07:00
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -07:00
Ömer Ağacan e319a6ce80 [ddc] Fix batch mode argument parsing on Windows
This bug was introduced with
https://dart-review.googlesource.com/c/sdk/+/415280.

Fixes #60346.

Change-Id: I677145bcbf30b2c56eb061998be8ffd56f392dcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416700
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-03-19 11:02:59 -07:00
MarkZ e958560965 [ddc] Adding error messages for illegal enum conversions after a hot reload.
Fixes: #60102, #60104
Change-Id: I5b89edffc3aa753d0882c2b9fd6aefd9bfef7175
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416080
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-03-19 10:36:59 -07:00
Johnni Winther 06d938046f [kernel] Remove NonNullableByDefaultCompiledMode
and TargetFlags.soundNullSafety

TEST=existing

Change-Id: I5e28d3d187b0f84fa23130c042fd3c55b89c687c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413460
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-03-19 01:37:07 -07:00
Mayank Patke 549639dc6c [dart2js, ddc] Remove LEGACY support from rti.
- Remove support for `JS_GET_FLAG('LEGACY')` from backends
- Remove `kindStar` Rtis
- Remove `Recipe.wrapStar`

Bug: #60327
Change-Id: I2ec9b0afc9f3cd99fc6167600e6d908c9771af1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416101
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-03-18 19:09:54 -07:00
Mayank Patke 6a2e567859 [dart2js, ddc] Remove PRINT_LEGACY_STARS.
Bug: #60327
Change-Id: I32a9f078e4c2ae5fc3b79b4f549a4357a08818d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416043
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-03-18 19:09:54 -07:00
Mayank Patke 13b5b8ab37 [dart2js, ddc] Remove support for SNS checks.
Bug: #60327
Change-Id: I38f04fea4e51dcd0fd43dc93ecc7007a0a816f29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416120
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-03-18 19:09:54 -07:00
Mayank Patke 1f8ab5f53b [dart2js, ddc] Remove LEGACY_TYPE_REF.
Bug: #60327
Change-Id: I30017acd7087227e646b230078066208fb27e398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416060
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-03-18 19:09:54 -07:00
Ömer Ağacan f4b41f0902 [dart2wasm] Fix handling of --define/-D
When parsing `--define` or `-D` arguments don't split the the value by
commas.

This is consistent with how dart2js handles `-D`, but inconsistent with
how VM handles it.

Example:

    void main() {
      print(const String.fromEnvironment("FOO"));
    }

When compiled with `dart compile js -DFOO="a, b"` and run, dart2js
prints

    a, b

VM prints (when compiled to exe)

    a

Between these two, I think dart2js' behavior is more common, so we
follow dart2js.

Also update compile_benchmark to avoid splitting a single argument "a b"
into "a" and "b" when parsing the arguments and then splicing them back
before calling `dart2wasm`.

Also update the test runner and ddc batch mode argument parser to handle
splitting quoted arguments in `// dart2jsOption = ...` and the same
options for ddc and dart2wasm, by moving dart2js's `splitLine` to a new
library and reusing it in the test runner and ddc.

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

See also https://github.com/dart-lang/sdk/issues/60341 for relevant
future work.

Change-Id: Idbdf69072fa212c8e4a390990577eb5a57b49e8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415280
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-03-18 04:11:41 -07:00
MarkZ ba90daf304 Reland "[ddc] Overhauling tearoff equality and identity."
This new update adds fixes + tests for cross-module super mixins. Super getters can refer to mixins compiled in other modules, so we need to expose all mixin names to make them accessible from their enclosing library.

This is a reland of commit e4c4d0f839

Original change's description:
> [ddc] Overhauling tearoff equality and identity.
>
> Hot reload requires DDC to update how its tearoffs are represented. Tearoffs obey the following conventions:
> * Instance tearoffs are never identical
> * Tearoffs with the same object target and name have the same hash code (even if they resolve to different functions across hot reloads)
> * Two separate tearoffs of the same member are equal
>
> To support this, tearoff equality must not depend on the bound object and method but a composite of the bound object, torn off member name, and the exact class/object from which the member was torn off.
>
> Notable changes:
> * Methods' immediately bound targets are emitted with member signatures. This is required to determine the bound targets for instance and dynamic tearoffs. Bound targets are identified by `libraryUri:class` strings.
> * `applyMixin` passes in a 'true' bound target. This is because mixin applications' members are considered children of their 'on' class (not the mixed in class) wrt equality/hashCode.
> * `bind` is modified to pass in its 'true' bound object to support mixins' super getters.
> * `tearoff` and `staticTearoff` are modified to accept a bound target string (only required for static tearoffs, as they are bound at tearoff-creation-time).
> * Static tearoffs avoid using their bound object for hashcode and equality, as these libraries may be wrapped in proxy objects.
> * Tearoff equality and hashCode are updated to consider bound object, bound name, and its bound method's immediate target.
> * 'noSuchMethod' and 'toString' methods are always accessed through their extension property during signature lookups.
>
>
> Change-Id: Ica5501b6860c605db50aa945bafb6802a7317511
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406723
> Reviewed-by: Nate Biggs <natebiggs@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Mark Zhou <markzipan@google.com>

Change-Id: I645992030f9106c158426412387ddecafc78e3f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415102
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-03-17 10:34:48 -07:00
Devon Carew 3c973fb292 [lints] address diagnostics related to strict_top_level_inference
Change-Id: I228058202855900f0adba73c1ab04d35180a6e5d
Tested: this is an analyzer diagnostic only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414900
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-03-17 08:27:57 -07:00
Sigurd Meldgaard 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Lasse R.H. Nielsen 7fd5108794 Remove .packages from .gitignore files.
The `.packages` file is no longer a special Dart file,
so any existing file lying around is garbage to be cleaned up.
We shouldn't be hiding it.

Change-Id: I269099bd66e392d630d5b23f4617a705a66a0800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414101
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-14 07:08:55 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00
Nicholas Shahan e36ac5fe1c [ddc] Additional null safety cleanup
* Remove accessing nullability through a library node since they no
  longer differ depending on the language version.
* Cleanup old comments related to legacy types.
* Cleanup dead code in nullable inference of `.toString()` calls.

Change-Id: I099180e7bab4f0f1ea7cf23a6c0fc015ab0413b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415160
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-03-13 13:32:22 -07:00
Siva Annamalai 4c077feda9 Reland "[sdk] Remove some redundant kernel-worker JIT snapshot generation code."
This reverts commit 91a653b4e5.

Reason for revert: The cbuild failure was apparently a flaky test

Original change's description:
> Revert "[sdk] Remove some redundant kernel-worker JIT snapshot generation code."
>
> This reverts commit 0e556f6960.
>
> Reason for revert: cbuild failure on some ads test
>
> Original change's description:
> > [sdk] Remove some redundant kernel-worker JIT snapshot generation code.
> >
> > Change-Id: Ic092633dd6f5eb0dcfdef70472221ddc7951bbbf
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412783
> > Reviewed-by: Srujan Gaddam <srujzs@google.com>
> > Commit-Queue: Siva Annamalai <asiva@google.com>
> > Reviewed-by: Nicholas Shahan <nshahan@google.com>
>
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: I7dd273001bf9c016f014c111ba8fe9197c75e52e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414383
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Auto-Submit: Siva Annamalai <asiva@google.com>
> Reviewed-by: Srujan Gaddam <srujzs@google.com>

Change-Id: I364af1f8dabd6e3ea121a4db58af54fb2eed4ad7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414880
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2025-03-12 16:26:09 -07:00
Nicholas Shahan 58ba6006a6 Revert "[ddc] Overhauling tearoff equality and identity."
This reverts commit e4c4d0f839.

Reason for revert: Breaks are blocking roll into flutter
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8720592021329723649/+/u/run_test.dart_for_web_canvaskit_tests_shard_and_subshard_0/stdout

Original change's description:
> [ddc] Overhauling tearoff equality and identity.
>
> Hot reload requires DDC to update how its tearoffs are represented. Tearoffs obey the following conventions:
> * Instance tearoffs are never identical
> * Tearoffs with the same object target and name have the same hash code (even if they resolve to different functions across hot reloads)
> * Two separate tearoffs of the same member are equal
>
> To support this, tearoff equality must not depend on the bound object and method but a composite of the bound object, torn off member name, and the exact class/object from which the member was torn off.
>
> Notable changes:
> * Methods' immediately bound targets are emitted with member signatures. This is required to determine the bound targets for instance and dynamic tearoffs. Bound targets are identified by `libraryUri:class` strings.
> * `applyMixin` passes in a 'true' bound target. This is because mixin applications' members are considered children of their 'on' class (not the mixed in class) wrt equality/hashCode.
> * `bind` is modified to pass in its 'true' bound object to support mixins' super getters.
> * `tearoff` and `staticTearoff` are modified to accept a bound target string (only required for static tearoffs, as they are bound at tearoff-creation-time).
> * Static tearoffs avoid using their bound object for hashcode and equality, as these libraries may be wrapped in proxy objects.
> * Tearoff equality and hashCode are updated to consider bound object, bound name, and its bound method's immediate target.
> * 'noSuchMethod' and 'toString' methods are always accessed through their extension property during signature lookups.
>
>
> Change-Id: Ica5501b6860c605db50aa945bafb6802a7317511
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406723
> Reviewed-by: Nate Biggs <natebiggs@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Mark Zhou <markzipan@google.com>

Change-Id: Ic5694976260189f7215dfa3c2318e9a0656f0de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415100
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-03-12 12:46:38 -07:00
MarkZ 5d624dc584 [tests] Minor hot reload test suite cleanup.
Removing extraneous configs + reporting less for error summaries.

Change-Id: I874e1217f6ba80e230a031c005cc5039464c513d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414828
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-03-12 10:52:17 -07:00
MarkZ e4c4d0f839 [ddc] Overhauling tearoff equality and identity.
Hot reload requires DDC to update how its tearoffs are represented. Tearoffs obey the following conventions:
* Instance tearoffs are never identical
* Tearoffs with the same object target and name have the same hash code (even if they resolve to different functions across hot reloads)
* Two separate tearoffs of the same member are equal

To support this, tearoff equality must not depend on the bound object and method but a composite of the bound object, torn off member name, and the exact class/object from which the member was torn off.

Notable changes:
* Methods' immediately bound targets are emitted with member signatures. This is required to determine the bound targets for instance and dynamic tearoffs. Bound targets are identified by `libraryUri:class` strings.
* `applyMixin` passes in a 'true' bound target. This is because mixin applications' members are considered children of their 'on' class (not the mixed in class) wrt equality/hashCode.
* `bind` is modified to pass in its 'true' bound object to support mixins' super getters.
* `tearoff` and `staticTearoff` are modified to accept a bound target string (only required for static tearoffs, as they are bound at tearoff-creation-time).
* Static tearoffs avoid using their bound object for hashcode and equality, as these libraries may be wrapped in proxy objects.
* Tearoff equality and hashCode are updated to consider bound object, bound name, and its bound method's immediate target.
* 'noSuchMethod' and 'toString' methods are always accessed through their extension property during signature lookups.


Change-Id: Ica5501b6860c605db50aa945bafb6802a7317511
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406723
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-03-11 10:31:19 -07:00
Siva Annamalai 91a653b4e5 Revert "[sdk] Remove some redundant kernel-worker JIT snapshot generation code."
This reverts commit 0e556f6960.

Reason for revert: cbuild failure on some ads test

Original change's description:
> [sdk] Remove some redundant kernel-worker JIT snapshot generation code.
>
> Change-Id: Ic092633dd6f5eb0dcfdef70472221ddc7951bbbf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412783
> Reviewed-by: Srujan Gaddam <srujzs@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I7dd273001bf9c016f014c111ba8fe9197c75e52e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414383
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Siva Annamalai <asiva@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-03-09 11:51:06 -07:00
asiva 0e556f6960 [sdk] Remove some redundant kernel-worker JIT snapshot generation code.
Change-Id: Ic092633dd6f5eb0dcfdef70472221ddc7951bbbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412783
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-03-07 15:19:49 -08:00
Nicholas Shahan 03293b52f5 [dart2js/ddc] Cleanup sound flag from benchmark test
Updates test to match the updates to the actual invocations on golem:
https://chrome-internal-review.googlesource.com/c/golem/+/8082532
https://chrome-internal-review.googlesource.com/c/golem/+/8082531

Change-Id: I171560f42c70bf59568d6c96325899be2eceb754
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386082
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2025-03-07 15:10:02 -08:00
Srujan Gaddam fa4d761f07 [ddc] Align error message with VM when reload is rejected
https://github.com/flutter/flutter/blob/f3d0f5a2ca422b1d8cbfc1c4d67ae288ce22ee47/packages/flutter_tools/lib/src/run_hot.dart#L1669

The above is emitted when a reload is rejected at runtime in
the VM. Since we reject errors at compile-time, we should align
the error messages.

Change-Id: I6687d3efaf87d1dce1c7d21591039cbb5a447ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413543
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
2025-03-06 00:37:24 -08:00
Nicholas Shahan 9ccf69b90c [ddc] Delete unsound null safety from runtime
Change-Id: I5264641ed8df7b29d725f9cf47b8506593ed9611
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386083
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-03-05 10:14:08 -08:00
Nicholas Shahan 00c99925fc [ddc] Delete unsound null safety from the compiler
Change-Id: I7e8a8b954c706d421bce2e6671619123c6206122
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388746
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-03-05 10:14:08 -08:00
Johnni Winther 0060b0f665 [cfe] Remove nnbd mode
TEST=existing

Change-Id: I30bbadb74e81c7f4aaa444d1e2f6f5ffc2005d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412881
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-03-04 01:46:51 -08:00
Nicholas Shahan bc21f34991 [ddc] Break compiling with unsound null safety
Change-Id: Ib6f80fc38e355241f1214e7e457b712544645b37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386081
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-02-28 12:33:17 -08:00
Chloe Stefantsova d8c48032bb [cfe] Remove legacy raw types from CoreTypes
Change-Id: I9d920cc00ce22900429fd38b6c452483438f94d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397161
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-02-28 00:50:40 -08:00
Mayank Patke 0c55c7e573 Remove unsound web configurations from test matrix.
This CL also removes references to unsound .dill files from the test
matrix and other build scripts and disables some of the option handling
that would lead to requiring unsound .dill files.

Change-Id: I89f701f8f5e1168bf974b5b44bfbafd5a39954fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412401
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2025-02-26 15:57:55 -08:00
Jens Johansen 2fff7d83e8 [CFE/VM] Make IncrementalCompilerResult classHierarchy, coreTypes non-nullable; always use latest
This also fixes a potential leak on missing .accept call where using the
non-latest coreTypes in the VM causes us to hold on to old libraries.

Tested: CI
Change-Id: I3a4a25dab83de0d5113b9f08ec745ac181c24b9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411580
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-02-26 00:43:19 -08:00
Srujan Gaddam c957483693 [ddc] Initialize and link the necessary library in debugger APIs
Closes https://github.com/dart-lang/sdk/issues/60109

Both getClassMetadata and getClassesInLibrary can be called before
main is called. In order to support this, libraries should be
initialized so that these debugger APIs can inspect them. Similarly,
SDK libraries that are needed before any code can run should be
initialized. In order to support this, they are initialized on the
first initializeAndLinkLibrary call and reinitialized during a
hotRestart (since the libraries are recreated).

Tests are added to evaluate these methods before main is called.
The debugger test helpers are amended to:
- Support breakpoints within the bootstrap script. This is done by
caching the script and querying to see if it has the breakpoint if
the input sources do not.
- Refactor shared test expectation logic.
- Remove an unused method.

Change-Id: I5534d7008436a51243cf51dba01bb8ad06adca69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410602
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2025-02-20 14:15:06 -08:00
Nate Biggs 773cf6b1d5 [ddc] Fix issues with duplicate library name aliases.
The attached bug shows an issue users have been encountering where a constructor seems to be undefined. It turns out this is because DDC is trying to read the constructor from the wrong library.

This is happening because both 'package:dio' and a sister package 'package:dio_web_adapter' both contain a library with the same path: 'src/adapter.dart'. 'BrowserHttpClientAdapter' the class they are trying to reference is defined in 'package:dio/src/adapter.dart'. However, due to a naming collision, their import is referencing 'package:dio_web_adapter/src/adapter.dart'.

This naming collision happens because of the logic in '_jsLibraryAlias'. By truncating the start of the import URI (i.e. 'dio/' and 'dio_web_adapter/') the two libraries map to the same alias. This alias is then used to as the key in the AMD module export object and since both libraries are in the same module, only the second one gets exported.

This code may have been written with the assumption that libraries from different packages would always be in different modules (in which case the shortened paths shouldn't collide) but this is not the case. The fix is to use the full import URI including the package name.

In writing the attached modular test I discovered another issue that only affects es6 imports. The ScopedId resolver was not considering NameSpecifier as a declaration point for variables. This lead to a similar name collision since the import alias's name was also being derived from a truncated import URI. In the test, both 'f1/foo.dart' and 'f2/foo.dart' were being imported 'as foo'. Now one is 'as foo' and the other is 'as foo$'.

The first issue affects both AMD and es6 while the second issue only affects es6. The modular tests run with es6 so the new test fails if either of these fixes is not in place.

The new DDC module system is not affected by either issue since it doesn't use NameSpecifiers and it uses the full import URI as a string to register libraries rather than a shortened alias.

Tested on TGP and with a local Flutter application.

Bug: https://github.com/dart-lang/sdk/issues/56498
Change-Id: I5bdb945cfbe615874b40e2fc4ebba31b661cf3b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410260
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-02-18 13:08:50 -08:00
Nicholas Shahan 1ee0894631 [modular_test] Delete support for macro execution
Mostly a revert of https://dart-review.googlesource.com/c/sdk/+/361261.
A straight revert contained merge conflicts that I resolved manually but
I left some of the cleanup or refactoring in place.

Change-Id: I2add9f4951d7c6c2399d8c95f36b1483279eea44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409401
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-02-13 08:30:33 -08:00
Nicholas Shahan b12fedced2 [ddc] Add hot reload rejection for type parameters
Changing the number of type parameters on a class is not supported
in a hot reload.

Issue: https://github.com/dart-lang/sdk/issues/60101
Change-Id: I3e397f26ca80e655dcb3d2807ddefd59c89adddb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409381
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2025-02-12 12:05:54 -08:00
Nicholas Shahan 39c60997ec [ddc] Add initial hot reload metadata
* Demonstrates the ability to generate metadata when inspecting the
  last accepted and delta components.
* Attach the metadata to the component right before compiling with DDC.
* Use the metadata to avoid deoptimizations in the initial compile
  when they are only required to support a hot reload.
  * Deletion of all type rules for classes that extend Object in the
    initial compile. In the future this should be reduced further to
    only the classes that had a hierarchy change in a hot reload.
  * Type checks on the return value of getters used to represent
    fields.

Change-Id: I2812b564bc3f4d72f005d4bd11fa55ec0eb394ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404940
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-02-11 12:04:50 -08:00
Nate Biggs 4dd1522635 [ddc] Add tests for '--reload-delta-kernel' and '--reload-last-accepted-kernel' flags.
Change-Id: I643957dcd8cc6611108c9ff67a9610bb19475af4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408924
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-02-10 17:29:21 -08:00
Nicholas Shahan 16960a8638 [tests] Fix tests for changing type parameters
* Handle inconsistencies in the type of a notice in reload reports.
* Update expected error messages when the type parameters of a class
  change.
* Fail reload tests if rejection error was expected but the actual
  error is null.
* Cleanup unused imports in tests.
* Delete change_instance_format7 test because it was split into DDC
  and VM specific versions.

Change-Id: I3b4d6cb3126d7c1fad688c393677e053a005687f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408883
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-02-10 16:26:00 -08:00
Nicholas Shahan c040cd66e5 [ddc] Pass an empty array when running main
Match the behavior of the ddc module system when running the
applications main method when using the new library bundle format.

This passes an empty JavaScript array to the main method which is
good enough to get the benchmarks that use main method args to run.

The API should be updated in a way that allows you to actually pass
a JavaScript array of Strings when starting the program.

Issue: https://github.com/dart-lang/sdk/issues/35113
Change-Id: I1a9aeb1df7afa5948d7f23517b3ac913aaabb62c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408640
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-02-07 14:53:14 -08:00
Nate Biggs 89af2425f2 [ddc] Append hot restart instruction to hot reload rejection reasons.
By adding this message here, any entrypoint that makes use of this for hot reload (e.g. DartPad, Flutter tools/FE server) will all surface this same message. This probably easier than having each one try to detect errors and append its own message.

Change-Id: I5980d530b66da818e29403cc13407095d8b203dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408380
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-02-07 10:20:53 -08:00
Srujan Gaddam 8aa6b413eb [ddc] Update hot reload test suite to use recompile-restart
A new optional suffix to the file names is added: '.restart'.
This allows us to differentiate between hot reload generations
and hot restart generations. All files with the same generation
should either have the suffix or don't. If present, uses the
recompile-request instruction in the frontend server. If not,
uses the recompile instruction. Tests are renamed and a WIP
README is added to document this change.

Change-Id: I2691c5ec0b7336115a76dc0e0369213e74b6ea21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406183
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-02-05 14:51:21 -08:00
Johnni Winther 7c22f942aa [_fe_analyzer_shared] Remove macro tests and helpers
These are no longer used.

TEST=removed

Change-Id: Ibf5b2de9d1b550c21873b48111161366deb2ddc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407980
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
2025-02-05 03:59:31 -08:00
Johnni Winther c27cec63aa [cfe] Remove macro support
This removes the support running macros in the CFE.

The scanner and package:kernel still have support for the macro modifier. This will be removed in a follow-up.

The metadata expression parser is deliberately left in, since it might serve as the basis for a parser AST.

Change-Id: I06d91eb0fac2e7a71e6afde647b03be3814dbd5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406963
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
2025-02-03 07:13:51 -08:00
Johnni Winther 7b9c5d938b [ddc,frontend_server] Remove macro tests
Change-Id: I1227eaed501e0175859e3c7759d88a8b19e8f4d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406964
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-02-03 00:37:19 -08:00
Nate Biggs 5855d91ba8 [ddc] Correctly extend type parameters for factory constructors.
RtiTypeEnvironment currently does not support being extended. However it's used for factory constructors which themselves can have generic functions defined in their bodies. This means we have to allow the ability to extend RtiTypeEnvironments as well.

Bug: https://github.com/flutter/flutter/issues/160338
Change-Id: I9b4e79b44f503a4a987e0c38da86fdce81361e4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406344
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-30 08:07:30 -08:00
Nate Biggs 44dfe081b2 [ddc] Add a covariant parameter check for optional nonnullable parameters with null initializer on lowered constructor tearoffs.
Change-Id: I77379ee43173ddbbdee25083bd641968eeeb787f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-29 23:07:26 -08:00
MarkZ 0083128537 [tests] Using git diff over diff for stability in hot reload tests.
Change-Id: Icdbdf4c569fd8ab5de96560722ac62616185a751
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406224
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-01-29 16:17:13 -08:00