| commit | 3a6e1c2554d385687606e6665e1a907c6b4efe8c | [log] [tgz] |
|---|---|---|
| author | Alexander Markov <alexmarkov@google.com> | Tue Feb 06 21:50:24 2024 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Feb 06 21:50:24 2024 +0000 |
| tree | c9f82afe06f178cccfaeca34d41083faa3ee6a22 | |
| parent | b36df2bc3480c24f005c5edec5cbc3815c4726b0 [diff] |
[vm/aot/tfa] Avoid duplicate invocations when approximation is created When the number of different invocations with the same selector is too large (due to different arguments), TFA creates an approximate invocation which uses raw (static) types of parameters. A new approximate invocation was not queried in the cache and but could match an existing invocation. This causes a problem as _DependencyTracker keeps invocations as a Set<_Invocation>, so duplicate approximate invocation may overwrite an existing invocation in the dependency tracker, effectively breaking the dependency chain and preventing invalidation, which could cause incorrect analysis results and incorrect tree shaking. This change fixes this bug by adding a lookup of the approximate invocation in the cache, so duplicate invocation is not created. Also, TFA heuristic thresholds are extracted to a separate class to make TFA more configurable and allow writing unit tests with approximations. TEST=pkg/vm/testcases/transformations/type_flow/transformer/duplicate_approximate_invocation.dart TEST=manually verified repro from b/322387862 without workaround. Bug: b/322387862. Change-Id: I1ff899f925d539b45f764d709e77c5800884ab4e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349940 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
Dart is:
Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.
Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.