We've decided to rename enum shorthands to dot shorthands. It describes the entire feature better. It's not only for enum values. We'll update the experiment name before the implementation goes in, that way our users can use a flag that matches the actual feature name.
Additionally, roll co19 to b14b0802e696a60c79b00d0f052e26fb986f0faf so we can avoid an infra failure with co19 using what's now an unknown feature flag (enum-shorthands).
2025-02-06 sgrekhov22@gmail.comFixesdart-lang/co19#3067. Rename the static access shorthand feature experiment flag (dart-lang/co19#3068)
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try
Bug: https://github.com/dart-lang/sdk/issues/57037
Change-Id: I031e3bce8166145b24dbb77acf259d78e6e00f0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407603
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
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>
All callbacks flow via the single runtime entry, so we add a check
there.
TEST=tests/ffi/function_callbacks_leaf_test.dart
(The transition verification in
https://dart-review.googlesource.com/c/sdk/+/407021
doesn't catch the error. The callbacks already transitioned before
reaching the generated code in that CL.)
Closes: https://github.com/dart-lang/sdk/issues/60021
Change-Id: Ia6bf8af186c9c8c5a66cffa537d80421467330d4
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407023
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
I removed one clearly dead multitest piece, but otherwise didn't try
to clean things up. There's definitely something weird about the dynamic
field tests, but I don't even know what they should be doing, so left
them alone.
Change-Id: Ic80c2b26d640da0aafeededaa981ed8c2fecc93a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406920
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Make `Zone.createTimer`, `Zone.createPeriodicTimer` and `Zone.scheduleMicrotask`
not call register on the same zone.
These are low-level functions that should not build on top
of other low-level functions.
Instead the function is registered in the `Timer` constructors and
top-level `scheduleMicrotask` code, and the root zone's `createTimer`
and `scheduleMicrotask` just make sure that the callback will run
in its original zone, and that uncaught errors are handled in the
correct zone.
Avoids a double-registration that timers did.
Significant clean-up.
- The private `_Zone`, `_ZoneSpecification` and `_ZoneDelegate`
subclasses are not necessary now that their superclasses are `final`.
- Stopped using type aliases instead of function types
and old-style function arguments.
- Renamed some parameters to not be, fx, `f`.
Avoided some closure allocations for microtasks by putting the zone
into the queue entry, instead of wrapping the callback in a closure calling `zone.run`.
This is a potentially visible change if any code uses the zone functions
directly and expect them to invoke `Zone.register*`.
(Suspiciously no test failed with this change. May need to add some.)
Fixes#59913.
CoreLibraryReviewExempt: Have had all +1s, just not at the same time.
Bug: https://dartbug.com/59913
Change-Id: Ie3c87f5f22aedcbe30ab04718df98e1c0f0659c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405020
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Adds shared libraries for embedding Dart VM and new API (runtime/engine/include/dart_engine.h).
TEST=tests/standalone/embedder_samples_test.dart
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-appjit-linux-product-x64-try,vm-appjit-linux-release-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-product-arm-try,vm-ffi-android-product-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-gcc-linux-try,vm-linux-debug-ia32-try,vm-linux-debug-simriscv32-try,vm-linux-debug-simriscv64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-arm64-try,vm-linux-release-ia32-try,vm-linux-release-simarm-try,vm-linux-release-x64-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-msvc-windows-try,vm-reload-linux-debug-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-reload-rollback-linux-release-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try,vm-win-release-x64-try
Change-Id: Ia4e4d1b871ddef515cfb2f4639bdaa9fe3676936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402860
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The async state machine uses a single state in the heap to store the current exception and stacktrace when within a catch block in case they need to be rethrown. When catch blocks are nested this state can be overwritten.
With this new change, before entering a new catch we store the current value of the exception/stacktrace in a local that we can restore after exiting the associated catch blocks. A wasm catch can represent multiple Dart catch blocks so we only need to store the state per wasm catch.
Fixes: https://github.com/dart-lang/sdk/issues/59981
Change-Id: I738084fdecdf5aceac65c5d3698e40b791175171
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
* 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>
* We outline throwing code to never-inlined function
* We inline index/range checking code using fast unsigned compares
* We omit details in `--minify` mode
The support for omitting details in `--minify` means that the
signature shaking pass will remove all parameters of the slow
paths in `--minify` mode, making them functions with no arguments
that just throw a constant as an exception.
Together these changes result in smaller code for common data
structures that do index/range checks. Which can have positive
effects downstream (e.g. less to inline for wasm runtimes).
This leads to around this (in -O2)
FluteComplex.Compile.Size.wasm.opt -0.514 %
FluteComplex.Compile.Size.wasm.opt.gz -1.664 %
Hello.Compile.Size.wasm -2.298 %
Hello.Compile.Size.wasm.opt.gz -4.864 %
It also leads to (in -O2) around 10% perf improvement on
`TypedDataPoly.*` benchmarks.
Issue https://github.com/dart-lang/sdk/issues/54395
Change-Id: Icd1cdf28a061f7763bd4bac7cfd5eaeea150c469
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404301
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
In dart2wasm, when a comparison like `x == "hello"` is true, we can't
assume that the class of `x` is the same as the class of `"hello"`:
- If `x` is received from JS, it will be `JSStringImpl`.
- If it's a substring of a `TwoByteString`, it will be `TwoByteString`.
- Otherwise it will be `OneByteString`.
Update `Target` with the new method
```
bool get canInferStringClassAfterEqualityComparison => true;
```
to allow TFA to *not* infer classes of string values after comparisons.
Override the method to return `false` in dart2wasm's `Target`
implementation.
Fixes#59901.
Tested: web/wasm/issue_59901_test
Change-Id: I1a6c8deaf27c54240dd4e821dbd8160914502ad7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404562
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Remove uses of async_minitest and multitests.
Removed two files that were checking dynamic behavior that no longer exists (compile-time errors reported at runtime).
Rewrote and/or added to enum_const_test.dart and _deferred_in_isoltae_test.dart.
Otherwise mainly removing multitest `//# ok:...` comments, or `//# 01: ...error...` that only existed because the test failed in dart2js, along with anything else that tried to special-case dart2js (which no longer supports isolates at all).
Some sporadic general clean-up like removing library names.
Change-Id: I99b55f05710347343286e86b37ce02f1006868dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402700
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
The root cause is that an `asyncEnd()` doesn't get executed which
will make the test not print `unittest-suite-success` which will
make the test controller keep waiting indefinitly until the test
times out.
=> This is true on all browsers, not just Chrome
Though commandline JS engines don't have this problem as they will
simply exit once there's no longer work and event loop is empty.
=> Here the test runner will recognize the missing
`unittest-suite-success` and report the tests as failing.
Issue https://github.com/dart-lang/sdk/issues/55182
Change-Id: Id217e9bd715d99f9927e7e18b03385aa2880b27f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404107
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
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>
Some scopes that are capturable by closures are not getting marked as such. Instead the parent scope (e.g. the enclosing member) is being treated as the captured scope that owns all the variable declarations down to the closure. The scopes are then being shared across different closures and variables with the same name are able to be overwritten.
This bug occurs for any block that isn't a loop or function (i.e. raw blocks, if blocks, try blocks). Loops are correctly handled as defining a scope and therefore those already work correctly.
Note: This may cause some small code size increase. There may now be extra assignements reseting capture boxes in more scopes.
Bug: https://github.com/dart-lang/sdk/issues/59843
Change-Id: Ic5009188795daabc1544f703fbeca01c0f1951d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403263
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
If the switch's expression has type 'dynamic' and all the case expressions have the same type, we compare them using '=='. This requires a cast to ensure all the types match for the dispatch to the '==' function. However, we don't check that the type of the switch expression matches the type of the case expressions. So the cast fails if they don't match.
This adds a guard to ensure the types match before running through the case expressions. If the guard fails, we either jump to the default case or if there isn't one, we skip the switch entirely.
Fixes: https://github.com/dart-lang/sdk/issues/59782
Change-Id: I12e81f98d1c2046ee47e8ca4371642fd40620636
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402460
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The `ffi_test_functions` shared library needs to access functions from
`dart_api.h` and `dart_native_api.h`, which are only available in
the Dart executable.
UNIX shared libraries can have undefined symbols, which are resolved at
runtime and can be found in the loading executable. Windows DLLs cannot
have undefined symbols, but they can be dynamically linked to an
executable (in this case `dart.exe`). This requires the DLL to be able
to find the executable at runtime.
A better solution is to include implementations for the Dart APIs in the
DLL itself, that use `GetModuleHandle(NULL)` to get a handle to the
executable and `GetProcAddress` to get the address of the function.
This is what `dart_api_win.c` does.
Fixes https://github.com/dart-lang/sdk/issues/40579
Fixes https://github.com/dart-lang/sdk/issues/59677
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-win-release-ia32-try,vm-win-debug-x64c-try,vm-win-debug-x64-try,vm-win-debug-arm64-try,vm-msvc-windows-try,vm-aot-win-debug-x64c-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,dart-sdk-win-try,dart-sdk-win-arm64-try
Change-Id: I7f971a8ce21e03d18ed2967e74998f925c9236b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400582
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
HArrayFlagsSet is compiled to a JavaScript statement, but the codegen predicate testing for when a condition subgraph can be compiled to an expression accepts HArrayFlagsSet because it tests for an instruction that has control flow (mostly jumps and checks).
Test for `isJsStatement()` instead.
Bug: #59790
Change-Id: Iafc21aa25490cb93503bb2be1f11dec2f71b5054
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403204
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
The struct type for closures requires the context value be a struct. If the tearoff is on an unboxed value, it first has to be boxed before being used to create the closure struct.
The new test currently fails at runtime (or via assertions at compile time) with this error:
"BoxedInt.abs tear-off" failed: struct.new[2] expected type (ref struct), found local.get of type i64
Change-Id: Ie861bc12a34b21f8b3415edadf55ce3d59f97580
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402560
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>