The Dart2JS team has agreed that this mode of compilation is no longer worth investing in at this time and its existence adds some overhead to other feature work so it is worth fully removing. In the future we may revisit this mode of compilation. Below is some more context for any future exploration in this space.
What didn't work with modular analysis:
- current modular analysis was computing impacts, which were dense (50% of the size of kernel)
- using it moved work to a modular phase, and cut Phase1 in half however end-to-end time was not better
- data overhead was very high
- it made it much harder to maintain invariants throughout the pipeline: the data is tightly coupled with the kernel AST, making it hard to make late modifications to the AST.
How to potentially make it better:
- make the data much more sparse
- make the data more independent from the kernel AST so that transformations are not breaking
- reduce the critical path in a more substantial way.
Note: We retain and ignore the commandline flags used for modular analysis in order to avoid breaking build pipelines that were passing them. We may remove these at a later date.
Change-Id: If574ce2358280ab5fedd89c62665328601e72e22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333360
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
While doing a previous CL, noticed that we don't actually report
the corresponding error.
Change-Id: I77ae11de6f6e84b3625b13db803e846966c806d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333641
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
No functional changes, just moves the snippets tests and a few others off the old marker functions to the new TestCode class for consistency.
With this change, there are approximately 15 remaining instances of "withoutMarkers" to remove (inc. the declaration).
Change-Id: I7f11992bb9ce47740adf6972ed097cabbd011607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333520
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This CL removes static fields for storing the `@Native`'s function
addresses. Instead, the function addresses are stored in the object
pool for all archs except for ia32. ia32 has no AOT and no AppJit
snapshots, so the addresses are directly embedded in the code.
This CL removes the closure wrapping for `@Native`s. Instead of
`pointer.asFunctionInternal()()` where `asFunction` returns a closure
which contains the trampoline, the function is compiled to a body
which contains the trampoline `Native()`. This is possible for
`@Native`s because the dylib and symbol names are known statically.
Doing the compilation in kernel_to_il instead of a CFE transform
enables supporting static linking later. (The alternative would have
been to transform in the cfe to a `@pragma('vm:cachable-idempotent')`
instead of constructing the IL in kernel_to_il.
To enable running resolution in ia32 in kernel_to_il.cc, the
resolution function has been made available via
`runtime/lib/ffi_dynamic_library.h`.
Because the new calls are simply static calls, the TFA can figure
out const arguments flowing to these calls. This leads to constant
locations in the parameters to FfiCalls. So, this CL also introduces
logic to move constants into `NativeLocation`s.
TEST=runtime/vm/compiler/backend/il_test.cc
TEST=tests/ffi/function_*_native_(leaf_)test.dart
TEST=pkg/vm/testcases/transformations/ffi/ffinative_compound_return.dart
Closes: https://github.com/dart-lang/sdk/issues/47625
Closes: https://github.com/dart-lang/sdk/issues/51618
Change-Id: Ic5d017005dedcedea40c455c4d24dbe774f91603
CoreLibraryReviewExempt: Internal FFI implementation changes
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_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-obfuscate-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-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-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-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-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-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/+/284300
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Baby steps w/ context locator. Some TODOs show how this will thread through the driver into the library analyzer.
Change-Id: I95f3047929c2bea6e7d5c1c9dc217c40ca9e4eef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333302
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This extracts the code that finds "examples/api" paths in code from the navigation code so that it can be re-used by LSP's DocumentLink request.
This allows the links to be more visible in the editor (they are underlined and clearly clickable like hyperlinks, whereas definition required you to hover and hold Ctrl before you'd seen an underline in VS Code).
Example: https://github.com/Dart-Code/Dart-Code/assets/1078012/be9db467-dbc9-4206-9dd5-f8ca72d95596
There may be an argument for making this more general (so that links other than example/api could be detected) but for now the goal was to make these existing links more obvious.
Fixes https://github.com/Dart-Code/Dart-Code/issues/4186
Change-Id: Id00425175b24394e565e13406ea4bac5691d2c72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333082
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The implementation of `~/` is a bit more complicated than other
operators as it needs to handle some special cases, so we currently
don't generate inline code for it.
This causes generating indirect calls to `~/` in some cases even when
the static Dart type of the arguments are `int`s, see [1] for details.
Update the intrinsic matcher to specially handle this operator by
calling `_BoxedInt._truncDiv`, which is then inlined.
This leads to huge performance wins in [2] as typed data `length`
getters currently compiled to indirect calls to `~/`.
[1]: https://github.com/dart-lang/sdk/issues/53921
[2]: https://dart-review.googlesource.com/c/sdk/+/328920
Change-Id: I92d89db76af38b1f843e25a841074f00ff2ef30a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333381
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Now that some basic support has landed internally, this will help to keep language versions more consistent for targets using macros, which will make SDK rolls easier.
Change-Id: Ifb9bb3def161edb3974cfc68271daad8a12707b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333200
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Lays the stage to acquire options from files during error verification.
Change-Id: I3b715a93e99fc3bc6f33f736e8b38c06b8c1cd4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333126
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Sharing the visibility tracker this way prevents shadowed elements from
being suggested and improves performance.
Most of these changes can be reverted once the local reference
contributor has been removed.
Change-Id: Ib156ae56455e8d85a31163f9e59ce4dd93f5920b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333124
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Copies of context building bits for context creation refactoring work.
Change-Id: I2ee8d7e03a33bb6f450c190ad59459bbf87cef62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333122
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
The changes calls to getInterfaceTypeAsInstanceOfClass (et al.) to
getTypeAsInstanceOf to ensure that we take extension types into account.
Change-Id: I7d732cdae8494002b44561cb02c49d58dd0ba67b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332920
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Also adds READMEs to some test sub-directories.
Change-Id: Ibf48654bcb43d7d52bd3bc0d2ab6afabc1ea3df6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333100
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Previously we only added the type args in constructor invocations, this changes to any named type without explicit type args.
Fixes https://github.com/Dart-Code/Dart-Code/issues/4712
Change-Id: I11a6a96bf34c7e4acff93607a922401d2f0eed83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332960
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Build one package with three elf_test_runner components: one for each of the binaries that the test harness invokes on the target. (Though currently only tests that use "dart" are setup.)
Create includable CML shards for the capabilites required by the AOT and JIT VMs.
Fold test_runner's fuchsia_cfv2.dart back into fuchsia.dart.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: I7bd8d43d184cbcb11903c7aed77ce31fb30cb894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332451
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zijie He <zijiehe@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
A simple (if provisional) implementation of an analysis options map.
🚧 Datastructure, API and implementation all subject to change.
Change-Id: I94d311d17df3f60b6e36437d37df84ce5091e0fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332369
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Refactor libraries so that JSCM will only use `JSStringImpl` class for
strings.
The goal is to disentangle the native string classes and `JSStringImpl`
and start testing `JSStringImpl` in isolation.
Changes:
- `dart:_string` is no longer available in JSCM.
- Make `int.toString` external to allow patching it differently in JSCM
and normal modes.
`toString` implementations are in `boxed_int_to_string.dart` patch
files.
- `int.parse` now uses JS `parseInt`. However `parseInt` is not
compatible with Dart's `int.parse` so this will cause some more test
failures in JSCM for now.
- Any dependencies to `dart:_string` from JSCM `dart:convert` are
removed. The library implementation now uses JS `TextDecoder` for
UTF-8 decoding.
Note: `TextDecoder` is not available on d8, so text decoding tests
will fail on d8.
JSON encoding and decoding in `dart:convert` will be updated in a
follow-up CL.
- Compiler (translator, constant generator, code generator etc.) is
updated to allocate the `JSStringImpl`s in JSCM.
Initially this will make some JSCM test fail as `int` parsing is not
quite right, those will be fixed in follow-up CLs.
Co-authored-by: Joshua Litt <joshualitt@google.com>
Change-Id: I366e06f44cdc369d28fe47b24015234260304399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This adds the functionality to ClassMember that enables us to
fully compute the ExtensionTypeAccessTarget.
Change-Id: I62dd5e24f664c2edd70c2fe794f66595cc017173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332427
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Previously, if field promotion failed both because the language
version was less than 3.2, *and* for some other reason(s), the
analyzer and CFE only reported the other reason(s). The rationale was
that this was better than reporting just that the language version was
less than 3.2, because if a user upgraded their language version to
3.2 in an attempt to get field promotion to work, and *then* found out
that the property in question was unpromotable for some other reason,
that could be quite frustrating.
With this change, if field promotion fails both because the language
version is less than 3.2 and for some other reason, the analyzer and
CFE report *all* the reasons.
Change-Id: Ib5d3a4621273c1e80d66b66b456119f9053e18b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332485
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
In a follow up, we will remove the transform from `@Native` to
`_asFunctionInternal`. However, we need to ensure that we keep
emitting `_nativeEffect` for struct return values classes if
`@Native`s are the only place instances are created.
The follow up CL will change the expect files.
TEST=pkg/vm/test/transformations/ffi_test
Bug: https://github.com/dart-lang/sdk/issues/47625
Change-Id: I1685683f48f1d16d6d10606f541f13e17d8583fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332800
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
The old FfiNatives have been deprecated for a while.
TEST=Only comments updated.
Change-Id: Ideb6e904841e5162d30df479e83b463b94682afe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332780
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Expressions missing offsets were:
- LogicalExpression
- ConditionalExpression
- Not
- BlockExpression
- Instantiation
- TypedefTearOff*
* I'm not sure how TypedefTearOff is actually being used, I don't see reference to it in the VM runtime. Unless the CFE lowers it before the VM gets it.
I also added a test on `binary.md` that ensures all expressions include a file offset in their serialized format. This can be expanded to statements if offsets are added to the remaining statement nodes without offsets.
TEST=Added binary_md_git_test.dart to ensure all expressions contain offset data going forward.
Change-Id: Ieaf80545f388b209f76be44db86ef07e80c8ad66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331540
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This reverts commit 29979649bd.
Reason for revert: makes `promiseToFuture` not exported from `dart:html`, see b/295129286
Original change's description:
> [analyzer] simplify the libraries.dart file
>
> Cleanup and re-landing of https://dart-review.googlesource.com/c/sdk/+/317803.
>
> Change-Id: I9fd679fdb111895ce662ecbe6d0fc5844909c3bc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332441
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>
Change-Id: Id93b4a1d4bdea706ae10cfb089319514a0238a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332683
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
This uses the allowed_experiments.json to opt package:web and
dart:js_interop in to the inline-class experiment (the extension
types feature) for early access and development.
Change-Id: Ieb828b654f2320b147a3c48bbb4a142da1c18380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332421
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
The only constructor invocation of `NonConstantValue` is in the deserializer. Which means we're never creating any of these objects to serialize.
Also remove unused `handleClosureCall` method in `pkg/compiler/lib/src/inferrer/builder.dart`
Change-Id: I04e492bc4824795dd8fc109ee7464be56b27cb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332500
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>