Commit Graph

3593 Commits

Author SHA1 Message Date
Nate Biggs cf4d27487f [ddc] Add options to emit, read and diff delta dills for hot reload.
This will allow DartPad (which invokes DDC directly) to maintain delta dills across each reload.

Change-Id: I801208c6b8f50a0aa20b6f509aa3e32a827a9cdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405661
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-29 14:45:16 -08:00
Nicholas Shahan 8968e0e2d6 [ddc] Remove unsound null safety option from tests
Change-Id: I1da8a572fc3556b03141a312375fa91bb3a8f358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386084
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-01-28 09:24:00 -08:00
Nate Biggs 6c4028eab8 [ddc] Update ddc_module_loader.js to safely check for localStorage in page.
When running in an iframe without specific flags, DDC may not have access to `localStorage`. In this context, even trying to access `window.localStorage` can cause an exception in the iframe.

Wrapping the check in a try/catch allows us to safely check for access before using it.

Change-Id: I0c5d3d0ac34a550444c12b52f6519a9446ebfe9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405608
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2025-01-24 12:17:26 -08:00
Nicholas Shahan 4fce27b1f7 [tests] Fix formatting when writing diffs
* Normalize white space around source code strings before producing
  diffs by trimming and appending a single newline character.
* Write an empty line between the source code and diff text in
  generation files.
* Run dart format on all test files.

With these changes you should be able to run the hot reload suite with
`--diff write` and dart format the code multiple times without
introducing changes in the file.

Change-Id: Ifc0b1dd7032bd448f5f6568c5aa3c18dde076c71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405247
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-01-24 09:07:01 -08:00
MarkZ 6edbfd93ab [ddc] Updating representation of enums to support hot reload semantics.
Enums are now split between pre and post canonicalization members. A
separate operation during link-time is emitted for every const
enum field. These are required during link time since enhanced enums can have non-trivial type hierarchies.

Example for snippet:
```
enum E {
  e1(1), ...

  const E(this.i);
  final int i;
}

```

Used to emit enum fields as:
```
  dart.defineLazy(CT, {
    get C1() {
      return C[1] = dart.const(Object.setPrototypeOf({
        [_Enum__name]: "e1",
        [_Enum_index]: 0
        i: 1
      }, E.prototype));
    },
  }
```

Now emits them as:
```
// Declaration-time
  dart.defineLazy(CT, {
    get C1() {
      return C[1] = dart.const(Object.setPrototypeOf({
        [_Enum__name]: "e1",
      }, E.prototype));
    },
  }

// Link-time
    dart.extendEnum(dart.const(Object.setPrototypeOf({
      [_Enum__name]: "e1"
    }, E.prototype)), {
      i: 1,
      get index() {
        return E.values.indexOf(this);
      }
    });
```

Change-Id: Id5ce2ec117e59d8daa28df7fe6051e4a7e1a5bc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404723
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-01-23 14:10:59 -08:00
Srujan Gaddam 0037a5c554 [ddc] Add getSourceMap debugger API to dartDevEmbedder
This is used in bootstrappers to set a source map provider
within stack_trace_mapper.dart so that stack traces can be
mapped to their Dart equivalent.

Change-Id: If7dd7024cf8928f1b3a127599015107fcbafb2f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405245
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2025-01-22 12:53:39 -08:00
MarkZ b5232ac632 [ddc] Resolving link-time class members via the embedder.
Note: this may lead to memory leaks if all class declarations are persisted across hot reloads.

Fixes #59628

Change-Id: Iae82d6166602d6e4a005748e64e84b3bbbc81894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403389
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-01-14 11:06:10 -08:00
Nicholas Shahan dc37a77cf7 [ddc] Add rejection for removed const fields
Reject hot reload requests that remove fields from const classes. This
is consistent with the VM implementation.

Change-Id: I73ff62795abbca62565ee6efd9cb245485d010ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403321
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-01-10 14:46:39 -08:00
Nicholas Shahan f91050ca91 [ddc] Add visitor for hot reload deltas
Initially this visitor will reject reloads (by throwing an Exception).
Future changes will add the ability to record data about the delta to
guide the JavaScript compilation decisions.

- Rejects deltas that delete all const constructors from a class
  (making it non-const).
- Adds ability to test the visitor directly by compiling components
  from source via an in-memory compiler.
- Updates DDC frontend_server compiles to write errors to the output
  stream.

Change-Id: Ib318f42d28367416983266a214f97821a38a2913
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401600
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-01-10 10:20:42 -08:00
MarkZ c033dd24af [ddc] Updating tearoffs to be evaluated on access.
Tearoffs are now represented as a closure that resolves an underlying bound context and property on access. `_boundMethod` and RTI getters must also be evaluated late.

Additionally, we now both canonicalize static methods and tag them with their types at class-declaration time (though lazily) - so that late resolved closures have access to their types.

Some tests have been updated to expect simpler errors. DDC traditionally emits slightly different errors that might aid in debugging.

Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401321
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-01-08 13:40:33 -08:00
MarkZ 3b7eb266a3 [test] Fixing hot reload suite diff checking.
Should resolve flaky cross-platform diffs

Change-Id: Ic496829ea984d049f8fe984e614aaf4fb41c283c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402941
Commit-Queue: Mark Zhou <markzipan@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-03 11:46:26 -08:00
Nicholas Shahan 302315c000 [ddc] Bump language version to 3.6
Preparation for the bump to 3.7 and reformatting all the source code
in pkg/dev_compiler. This makes it obvious that the next bump will
only contain changes needed for 3.7.

Change-Id: I997358aea4fcf3d899490611353df8b067bde929
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401387
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-12-18 13:48:08 -08:00
Kevin Moore 0512babe76 pkg/js: mark discontinued/deprecated
Towards https://github.com/dart-lang/sdk/issues/59716

Change-Id: Iaea45a8fccf5c3e2fb52ef34420ddbcd5b92a13f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401201
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-12-16 16:58:37 -08:00
Nate Biggs 46bd9f351a [ddc] Handle optional/defaulted parameters when created scoped parameter renames for sync* transform.
This was missed in the original implementation of the sync* transformer because prior to my recent change, ScopedIds couldn't end up within a DestructuredVariable.

Change-Id: I2733ce1e01edb50659634347204bac1769269615
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401080
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-12-16 10:01:23 -08:00
Nate Biggs 2f46eaaf0c [ddc] Fix async rewrite ignoring new ScopedId variables.
The async rewriter was ignoring these variables since they were only used for non-user variables that didn't need to be captured. Now that we use these ScopedIds for user variables we need to capture some of them. "userDefined" specifies if the variable should be captured.

Change-Id: I2dbb86e1834982b59883a3d107612ee8f8e2284a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400662
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-12-13 11:10:26 -08:00
Nate Biggs 5c1510de6b [ddc] Rename TemporaryId to ScopedId.
Change-Id: I7bcf2484769dc187b3d3e14286fde2c9023a73c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400661
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-12-13 11:10:26 -08:00
Nate Biggs 8791205c4b [ddc] Remove print from expression compiler.
Change-Id: I14d1428310b3075ed43c492ead2bd20f734ff974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400480
Auto-Submit: Nate Biggs <natebiggs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2024-12-12 16:41:03 -08:00
Nate Biggs 2616eb2aed [ddc] Use TemporaryId when emitting all kernel VariableDeclaration references.
Some CFE lowerings (e.g. pattern lowerings) result in nested scopes containing VariableDeclarations with the same 'name'. The current DDC transform translates these to the exact same name in JS leading to incorrect semantics.

The `TemporaryId` mechanism automatically renames any variables with the same name that would shadow each other. So we re-use that here to ensure the variables all have a unique name if the CFE hasn't already given them one. If the name is already okay (i.e. not shadowing something else), the name in JS will appear unchanged.

Side note: In a future change perhaps we should rename `TemporaryId`. The general mechanism it implements is more useful than its original intended use.

Fixes: #59613
Change-Id: I708c72528d5df19af48dde01163d375a5588baae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398504
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-12-12 08:56:11 -08:00
Jessy Yameogo ed8e22ff10 fixed bug, 'dartDeveloperLibrary()._extensions.keys' is not a function
Change-Id: I95a59575e3dfebf4e44008d171226994bb63ccba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399784
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Jessy Yameogo <yjessy@google.com>
2024-12-10 20:24:54 +00:00
Nicholas Shahan 47e3ad7f1f [ddc] Add rejection to hot reload test suite
Allows tests to define generation files that are expected to be
rejected as invalid for hot reload.

Tests generation files now support the extension `.reject.dart` to
signal a rejection is expected. A corresponding rejection error
message should be added to the map in the config.json file.

- Add new rejection logic to the file discovery and config file
  parsing.
- Add new reload receipts that are output by the runtime utils when
  running hot reload tests. These receipts are used to verify that
  each file generation was visited (not necessarily accepted) at
  runtime.

Change-Id: Ifee698f0d6502ecfceba2d5c733a2c88fb5daf7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394564
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2024-11-28 00:34:31 +00:00
MarkZ ebf9df9cb1 [ddc] Avoid overriding LegacyJavaScriptObject type rules across link phases.
This prevents libraries from accidentally clobbering LegacyJavaScriptObject rules when linking.

Change-Id: Ia7465013633a34907ca6ab9d1d5bfcdf99ffa13c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395161
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-11-27 00:35:50 +00:00
MarkZ bacbbf83c1 [ddc] Adding RTI subtype cache clearing.
This is required when a hot reload causes changes to the subtype hierarchy.

This change also adds RTI operations for clearing subtype caches and deleting type rules.

The DDC Embedder also now accesses the RTI library to clear subtype caches on hot reload.

See: #57049

Change-Id: I50a43ce342f23060bc28a3654c2da37c362492b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394040
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-11-26 19:33:37 +00:00
Nate Biggs d621ed9782 [ddc] Fix handling of continues in switch statements with labeled continues.
Tested with test case outlined in bug below. This should be tested via Lasse's tests when he lands them.

For slightly more context we compile code like this:
do {
  switch (y) {
    case 1:
      continue L1;
    L1:
    case 2:
      continue;
  }
} while (x);

into something like this:
do {
  while (true) {
    var labelState = y;
    switch (labelState) {
      case 1:
        labelState = 2;
      case 2:
        continue; // <-- This now only continues the while (true).
    }
  }
} while (x);

Bug: https://github.com/dart-lang/sdk/issues/59593
Change-Id: I9b343fd918e48cb44b65e90eab39d70fca4758d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397105
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-11-22 22:18:41 +00:00
Nicholas Shahan f33192437e [ddc] Cleanup remaining platform cases
- Move platform specific code into various suite runners.
- Move shared DDC code into common superclass.

Change-Id: Ie67e3cad814be8aad0438294a8f566869199eee2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393485
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-11-21 19:25:32 +00:00
Nicholas Shahan b9e7cb6b10 [ddc] Move D8 implementation to D8SuiteRunner
Merge setup, generate bootstrap and run test logic into a single method.

Change-Id: I5e0045c5e84b5a1966bff79bd37b759fe4b789bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393440
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2024-11-20 23:39:58 +00:00
Srujan Gaddam a7e4d59d2d [ddc] Fix passing module format to ExpressionCompiler
The DDC library bundle format is a combination of the DDC
format and canary, so therefore check that's the case, and if
so, pass the library bundle format.

Change-Id: I067d2b020e75b703a30fbe7d5f8dc2d31cd4878c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396420
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-11-20 20:29:57 +00:00
Nicholas Shahan b3ee8901eb [ddc] Add DDC specific suite runner
Add new subclass for DDC specific behavior and move
`compileGeneration()` implementation there.

Change-Id: Id668b3550e80e1e1802ca64a0d0107b48f14aad9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393220
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-11-20 19:27:59 +00:00
Nicholas Shahan 14734d5767 [ddc] Add VM specific hot reload suite runner
Add a subclass to override common methods with VM specific
implementations. DDC implementations will be added in future changes.
Then these implementations will diverge more to support the VM
rejecting edits at "runtime" vs DDC at compile time.

Change-Id: I314b78e10d1f4d82da8af71e3fec3b3ef9f83aaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393181
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-11-20 01:05:08 +00:00
Nicholas Shahan 039f8c9b64 [ddc] Alert when all hot reload tests were skipped
Add message to output when no tests were run because no tests
were found to match the filter.

Change-Id: I6dd4abd744dee9514efb02c554764e896365824d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395049
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-11-19 23:50:53 +00:00
Nicholas Shahan 0df07b65b7 [ddc] Refactor hot reload suite
Break body of main method into instance method helpers on a suite
runner class. In upcoming refactor changes this will become an
abstract base class that runtime specific subclasses will inherit
from or provide their own custom implementation for compiling,
accepting/rejecting edits, and running the tests.

Change-Id: I81541c48e97f22f034a4529a96d2af53546362ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393080
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-11-19 23:19:51 +00:00
MarkZ 7d7d9ab943 [ddc] Extending static fields to perform type checks on first access.
Type changes across hot reloads need to be performed even if the underlying value has already been initialized.
To avoid extraneous type checks, getters replace themselves with a direct access on their value store on first access.

Also updates our builder to support get/set as property descriptor functions.

Adds some extra conditions that will be cleaned up when pragma support is added (#57049).

Change-Id: I44f4a9e1a6fd8a49aca5e629fb21348170a9d80f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393041
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-11-19 23:17:05 +00:00
Nate Biggs 9468f60aac [dart2js, ddc] Fix nested exception handling.
In the flattened control flow state machine generated for dart2js and ddc async functions, there is a single error state variable per function. However, functions can have nested error handling that may try to access stacked errors separately. When we enter a nested try/catch we should avoid clobbering the outer exception as the outer handler may need it later.

To fix this we maintain a stack of errors that we 'push' to when we enter a new try/catch and which we 'pop' from at the end of executing that try/catch.

Fixes: https://github.com/dart-lang/sdk/issues/57046
Change-Id: Ib96a44ab4152f6f9e444f2ee959ec9aa252800f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395580
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-11-15 23:20:00 +00:00
Jens Johansen a9469269d7 [kernel] BinaryReader takes Uint8List, not List<int>
In AOT this makes reading faster:

Output from `out/ReleaseX64/dart pkg/front_end/tool/benchmarker.dart --iterations=10 --snapshot=pkg/front_end/test/kernel_binary_bench.aot.1 --snapshot=pkg/front_end/test/kernel_binary_bench.aot.2 --arguments="--warmups=10" --arguments="--iterations=5" --arguments="AstFromBinaryEager" --arguments="out/ReleaseX64/vm_platform_strong.dill"`:

```
msec task-clock:u: -8.6925% +/- 0.5737% (-167.09 +/- 11.03)
page-faults:u: 0.1410% +/- 0.0051% (243.00 +/- 8.71)
cycles:u: -10.2918% +/- 0.6161% (-732576747.50 +/- 43853449.16)
instructions:u: -14.4988% +/- 0.0004% (-1636799813.90 +/- 39902.18)
branch-misses:u: -3.4891% +/- 2.1142% (-1166085.00 +/- 706582.35)
seconds time elapsed: -8.7005% +/- 0.5634% (-0.17 +/- 0.01)
seconds user: -9.9752% +/- 1.5104% (-0.17 +/- 0.03)
```

Stats running manually (run as e.g. `out/ReleaseX64/dart-sdk/bin/dartaotruntime pkg/front_end/test/kernel_binary_bench.aot.1 --warmups=10 --iterations=5 AstFromBinaryEager out/ReleaseX64/vm_platform_strong.dill`):

```
AstFromBinaryEagerCold: -12.5174% +/- 3.10688%
AstFromBinaryEagerWarmup: -8.33675% +/- 2.62433%
AstFromBinaryEager: -10.3432% +/- 3.68375%
```

I don't expect there to be much of a change (if any) in JIT as the actual type was in practise always Uint8List anyway.

TEST=Existing tests.

Change-Id: I86b16ed207343848dee2e376f42598c223bbc48f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393740
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-11-08 08:23:42 +00:00
asiva 8b2b6b2440 Reland ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
This reverts commit 74c5aa3a7a.

Reason for revert: Fix golem breakage by not changing the script dart_precompiled_runtime2

TEST=ci

Original change's description:
> Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
>
> This reverts commit f81a402aa1.
>
> Reason for revert: golem benchmarks are failing to run
>
> TEST=ci
>
> Original change's description:
> > "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
> >
> > This reverts commit 75e6a748f7.
> >
> > TEST=ci
> >

Change-Id: I9efe40643c59bc617f6fb484b89b038deaffbb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393941
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-11-08 04:36:23 +00:00
Srujan Gaddam 22833d51da [ddc, test_runner] Add stackTrace debugger helper to dartDevEmbedder and clean up test_runner
Adds a stackTrace helper that returns a stringified StackTrace for
an arbitrary error. Removes importLibrary references in test_runner
now that we have that and removes some calls that didn't do anything
(addAsyncCallback, removeAsyncCallback, and startRootIsolate).

addAsyncCallback and removeAsyncCallback are also removed from the
runtime. Calling these were removed in https://github.com/dart-lang/sdk/commit/8bd3690ab06c3eda2f4996ca60b94fdcc9f76105
so this is just finishing up the clean-up.

Change-Id: I9dacc2b3fd3e27468061d6e59a3207eecdb7cac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393800
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-11-07 03:40:54 +00:00
Srujan Gaddam e94de78d2b [ddc] Remove statements from the Fun returned by buildFunctionWithImports
This list of statements is intended to support additional
statements that need to be emitted to handle imports/exports.
For the incremental case, no non-import statements exist
and can be safely omitted from the body. We should be
intentional about including these if needed later to avoid
accidentally including unnecessary statements.

Change-Id: I726bb9e980d43c1edd1d0bda2d9be897586638ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393163
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-11-06 20:42:13 +00:00
Siva Annamalai 74c5aa3a7a Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
This reverts commit f81a402aa1.

Reason for revert: golem benchmarks are failing to run

TEST=ci

Original change's description:
> "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
>
> This reverts commit 75e6a748f7.
>
> TEST=ci
>
> Original change's description:
> > Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > This reverts commit 1b331d05c2.
> >
> > Reason for revert: golem builds are failing
> >
> > Original change's description:
> > > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> > >
> > > TEST=ci
> > >
>
> Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Iec494940412aa31dbefdc5280e35ae99e8cecb26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393764
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-11-06 05:37:46 +00:00
asiva f81a402aa1 "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime

This reverts commit 75e6a748f7.

TEST=ci

Original change's description:
> Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> This reverts commit 1b331d05c2.
>
> Reason for revert: golem builds are failing
>
> Original change's description:
> > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> >
> > TEST=ci
> >

Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-06 03:10:31 +00:00
Srujan Gaddam 1d4c570dc5 Skip SDK library-level expression evaluation tests
These are no longer handled with the new module format,
so skip them when that's enabled. This is the last piece
to get expression evaluation tests working again with the
new format.

Change-Id: I92933363ea4e275f7a3f1c9cd62e24b0f7987f49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393162
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-11-05 23:51:42 +00:00
Siva Annamalai 75e6a748f7 Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
This reverts commit 1b331d05c2.

Reason for revert: golem builds are failing

Original change's description:
> [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
>
> TEST=ci
>
> Change-Id: I96ed52994e0d955300c18026032e68003504666d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Change-Id: I5dc14973f4ee4e577b2c996839d5e497c97fb440
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393761
Commit-Queue: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-05 21:58:09 +00:00
asiva 1b331d05c2 [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
TEST=ci

Change-Id: I96ed52994e0d955300c18026032e68003504666d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-11-05 20:39:15 +00:00
Nicholas Shahan 5b6e6865b0 [ddc] Add test abstractions to hot reload suite
Provides a representation for all information needed to perform the
diff checks and run the tests. Uses classes as more structured
representation to ease an upcoming refactor where the entire suite
is not defined in the main method.

Only read and iterate and parse the file names a single time and collect
all needed information at this time.

Fixes `--debug` command line flag that was accidentally broken in
https://dart-review.googlesource.com/c/sdk/+/391686.

Change-Id: Ifb6005d85d79e1edb66473b3963cb800dc5e8569
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392404
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-11-02 00:03:42 +00:00
Srujan Gaddam 65ce9ed581 Add debugger runtime APIs and add/modify tests
- Exposes a minimum set of APIs that are needed by DWDS
a single class Debugger.
- Renames some APIs and modifies the signature to better
align with what's happening and what DWDS actually uses.
Similarly, modifies the internal APIs to handle the new format.
- Modifies expression evaluation test suite to handle the
new module format correctly.
- Modifies LibraryBundleCompiler to emit the right export name.
- Adds/adapts existing tests for the runtime debugger APIs.

With this, all tests within pkg/dev_compiler/test/expression_compiler
pass with the new module format with the exception of two tests within
expression_compiler_e2e_ddc_null_safe_test, which will be fixed
in a future CL.

Change-Id: I296496441ea421ecb57bed3b2e90b92365fef510
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391308
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-11-01 22:09:30 +00:00
Nicholas Shahan 7d00c54b23 [ddc] Enforce unnecessary_breaks lint
Ignore violations in the js_ast sub-directory to avoid unnecessary diffs
with the original package.

Change-Id: Iac8c942e5e2446b8433e2073b546c28e42a8f5cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392700
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-10-30 21:10:38 +00:00
MarkZ 679271edd2 [ddc] Porting hot restart tests to the hot reload framework.
The old hot restart tests only tested DDC-internal state changes, not 'true' hot restart. The 'dart.hotRestart' runtime call is due to be deprecated.

Change-Id: I34e32342bca6fabc886d8283e32ae510f8d49874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389400
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-10-28 23:11:43 +00:00
MarkZ d53711d88b [ddc] Reconciling d8 and Chrome timing differences in hot reload suite.
Appending a script to the DOM in Chrome causes microtasks to fire. This change makes the `hotRestart` pathway async and inserts an async callback at the hot restart boundary for d8.

Change-Id: Ib05e9e496b6313d861fb5cb691a5894beed62a6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389224
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-10-28 23:11:43 +00:00
MarkZ 933d630e42 [ddc] Cleaning up unused fields and functions
Removes:
* Unused SDK-specific field emission logic
* after-class-def items, which used to hold lazily emitted classes
* deferred supertypes/classes, which are no longer needed after the new class representation

Change-Id: Ibdaa8d32aecc42c25749cc6a2290ce0bfd4662f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391488
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-10-28 18:17:00 +00:00
MarkZ a5f734592c [ddc] Updating representation for virtual and lazy fields.
This restructures all fields as accessor/value-store pairs, providing a level of indirection required for hot reload.

Major updates include:
- All fields (top-level, lazy, virtual, etc.) now have a value store (represented as a private top-level symbol). The value store is initialized on first access for the initializer.
- Lazy value stores are prefixed with '_#v_' to indicate that they are not replaced on a hot reload.
- `declareClass` and `declareTopLevelProperties` are introduced to append classes/members to libraries. These functions extend the 'original' entity/class with fields introduced by a properties object, ignoring the special lazy value stores mentioned above.
- `defineLazy` is replaced with the above operations.
- Virtual/instance fields are still initialized by inside their constructor on first load (so their getter forwards to its value store). On hot reload, however, uninitialized fields are lazily initialized.
- Final fields now use a sentinel value to check for late initialization errors during the initialization loop.
- The JS AST is extended to support class properties.

Change-Id: I5cc3548477d83897273f3b993b304a804754ec0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386971
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-10-28 18:17:00 +00:00
Nicholas Shahan 2202f10aa4 [ddc] Refactor options for hot reload tests
Centralizes the parsing into a single location to simplify upcoming
refactors of rest of the library.

Change-Id: I7847ccbace72897a65d119bbcf76a178144db407
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391686
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-10-25 22:59:19 +00:00
asiva da14b16ef3 [Web/DDC] - Convert the kernel_worker and dartdevc snapshots to an AOT snapshot
Converts kernel_worker.dart.snapshot and dartdevc.dart.snapshot to
 AOT snapshots. Fixes tests and paths in the code accordingly.

TESTS=ci

Change-Id: Ib99b2a3343e23252c3a6b5295b0d20f0f486aede
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381388
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-10-22 17:39:27 +00:00