Missing from this implementation:
- Closure/dynamic calls with differing signatures
- Overrides with extra optional parameters
- Records with same shape defined in different dynamic modules
- Avoiding running TFA on dynamic module.
- Recompilation of only updateable functions from main module.
- Persist wasm def types from main module.
Testing is currently done locally via the dynamic_modules package test suite:
dart pkg/dynamic_modules/test/runner/main.dart --runtime=dart2wasm
Immediately after this lands we can introduce a new step to one of the wasm test matrix configurations that runs the above test suite (the VM has a similar configuration).
Change-Id: I3386d84be11b773842d45f4268a62a54c47e352b
Tested: Tested via new tests in dynamic_modules package. Tests run locally but will add to existing config.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397721
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This moves the creation of class builders for anonymous mixin application to after the creation of the normal class builders.
A ClassDeclaration interface is added to support class builders from different fragments. This is also a step towards creating class builders fully through fragments.
TEST=existing
Change-Id: Ia6b4a17648bdc89b89fd3cfdfe39d24d347b6341
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407420
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This is a reland of commit 103ffd6041
Parent CL adds "aarch64" as a `uname -m` possibility for ARM64.
TEST=manual testing
Original change's description:
> [pkg/vm] Handle cross compilation in dart_precompiled_runtime2.
>
> When cross compiling, use qemu-<arch> to run dartaotruntime for
> the target architecture.
>
> TEST=manual testing with native X64 and cross-compiling ARM64 on X64.
>
> Change-Id: I6ce4e2cfa3108108fe05c7a1fcd2c400a8a47492
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404600
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>
Change-Id: I4407f64e804fbc19d05440ed961a67b5e1c2c047
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405761
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This is a reland of commit 11a338000b
Adds "aarch64" as a `uname -m` possibility for ARM64.
TEST=manual testing
Original change's description:
> [pkg/vm] Handle cross compilation in the precompiler2 script.
>
> When cross compiling, gen_snapshot for the host architecture is in
> ${BUILD_DIR}/clang_<arch>/gen_snapshot.
>
> TEST=manual testing with native X64 and cross-compiling ARM64 on X64.
>
> Change-Id: I9f6af045675612651c659683081aca3e65acad1b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404421
> Reviewed-by: Slava Egorov <vegorov@google.com>
Change-Id: I4fb4812dfa96ba582ca3bedbfd68d58ce2a4ab5b
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405780
Reviewed-by: Slava Egorov <vegorov@google.com>
For entry-point pragma annotations, most of the time they are
used with either no argument or with an argument that evaluates
to either
* false to denote the annotation should not take effect, or
* null or true to denote the annotation should take effect.
However, the user can also specify that only part of the operations
on a member should be accessed from native code by using a string
argument that is either 'call', 'set', or 'get'.
The entry point verification in Invoke/InvokeGetter/InvokeSetter
assumes that for getters and setters, the only valid string argument
is 'get' or 'set', respectively. This is because those methods are
called via `Dart_GetField`[0] and `Dart_SetField`, respectively, as if
they were the getter or setter of a defined field.
However, the precompiler previously assumed that the string
argument 'call' was the only string argument that meant the link
to a function's code object should be saved. Similarly, it assumed the
string argument 'get' for functions meant that their implicit closure
function should be saved, which ends up including getters. Furthermore,
it did not do anything with setters annotated with the string argument
'set'. This means that the code link would not be saved for getters or
setters that were annotated with the string argument expected by the
entry point verifier.
This CL aligns the precompiler to match the expectations of other
parts of the codebase. It also changes TFA to report an error
if a getter or setter is marked with the string argument 'call'.
[0] `Dart_Invoke` can be called with the name of a getter that
returns a closure, but doing so is semantically equivalent to
calling `Dart_GetField` followed by `Dart_InvokeClosure`.
TEST=vm/dart/entrypoint_verification_test
Fixes: https://github.com/dart-lang/sdk/issues/59920
Change-Id: Ia2768bbaf9058bb14a1cdfb331eb85fa082a0e90
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-product-x64-try,vm-aot-mac-product-arm64-try,vm-aot-obfuscate-linux-release-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404823
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Revert changes to precompiler2 and dart_precompiled_runtime.
Reason for revert: Golem is broken because host_arch helper does not handle aarch64 as a possibility (which is what we get from uname on these machines).
Reverted changes: /q/submissionid:404600
Change-Id: I88cbaba2a369d6deeca0866ef28dc220ca4bf4d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405641
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Revert changes to precompiler2 and dart_precompiled_runtime.
Reason for revert: Golem is broken because host_arch helper does not handle aarch64 as a possibility (which is what we get from uname on these machines).
Reverted changes: /q/submissionid:404600
Change-Id: I4a78ed1e4853de1c12b3341da15c0f068bf2839a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405640
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
When cross compiling, use qemu-<arch> to run dartaotruntime for
the target architecture.
TEST=manual testing with native X64 and cross-compiling ARM64 on X64.
Change-Id: I6ce4e2cfa3108108fe05c7a1fcd2c400a8a47492
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404600
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
When cross compiling, gen_snapshot for the host architecture is in
${BUILD_DIR}/clang_<arch>/gen_snapshot.
TEST=manual testing with native X64 and cross-compiling ARM64 on X64.
Change-Id: I9f6af045675612651c659683081aca3e65acad1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404421
Reviewed-by: Slava Egorov <vegorov@google.com>
Similar to propagating `int` and `String` constants and literals,
propagate `double` constants and literals when they're not nan or
plus/minus zero.
Tested: updated existing test file with more cases
Change-Id: I1324a6804418710516c40c0744f0c5f417b92e83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
When comparing a value against a literal or constant:
if (x == literal) { ... }
if (x == constant) { ... }
Allow propagating the value if the LHS type is `int` or `String`, as
those types don't have identity.
Previously we would propagate the values if the RHS is a literal (not
constant). Constants would only be propagated if the LHS type does not
override `operator ==`. Because `int` and `String` don't have identity,
they can be propagated when they're constants even though they override
`operator ==`.
Tested: Added new TFA transformer test.
Change-Id: I3c150ffae39bfbc06992f666ffec7bab1d1c52d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403987
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@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>
Consider the following situation: member M1 is overridden by another
member M2; M2 is overridden in a dynamic module.
Members which can be overridden in a dynamic module (such as M2)
should be specified as 'can-be-overridden' in the dynamic interface.
Members which are overridden implicitly/transitively (such as M1)
are not required to be mentioned in the dynamic interface.
However, when determining possible targets for a call with
interface target M1, compiler should treat it as potentially
overridden in a dynamic module.
This change adds such handling to the VM/AOT. Dynamic interface
annotator now marks members such as M1 with
'dyn-module:can-be-overridden-implicitly' pragma, and
VM/AOT takes both can-be-overridden and can-be-overridden-implicitly
into account.
This change also simplifies handling of implicitly extenable classes
in the VM/AOT - now VM handles both extendable and implicitly-extendable
pragmas (from dynamic interface annotator) instead of recalculating
implicitly extendable classes on its own.
TEST=pkg/vm/test/transformations/dynamic_interface_annotator_test.dart
TEST=dynamic_modules_suite/implicitly_extendable
Fixes https://github.com/dart-lang/sdk/issues/59880
Change-Id: Id4570cc86303f8e45a061d696e9bca0d0b2b4b81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403951
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Cloned static members of mixins are not used (dead code) and usually
tree shaken in AOT mode. However, if static member is annotated with
@pragma('vm:entry-point'), its clone in the mixin application is
also retained. If such mixin application is not used, tree shaker
drops its supertypes which removes the link from mixin application to
the original mixin. As a result, gen_snapshot crashes when trying
to access original mixin in order to print qualified name of the member.
The first part of the fix is to avoid cloning static members into
mixin applications, which would allow tree shaker to remove unused
mixin applications entirely. This change also reduces size of
the non-AOT kernel binaries.
However, instance members of mixins are cloned
and they could be annotated with entry point pragmas too.
The second part of the fix is to clear isEliminatedMixin flag
in tree shaker when dropping supertypes.
TEST=pkg/front_end/testcases/general/mixin_with_static_member.dart
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_flutter160030.dart
Fixes https://github.com/flutter/flutter/issues/160030
Change-Id: I1b36c4a7f64a4530c8b4799ec785f1077ce65de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403963
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
All supertypes of classes marked as "dyn-module:extendable" are technically also extendable in dynamic modules since subtyping is transitive.
Also skip marking 'final' classes as dynamic module extendable.
Change-Id: I124eae56b78b98aba8712158fda87bbc8e652ed3
Tested: Ran tests for dynamic interface annotator.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403960
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Previously, TFA was building a summary for the comparison
'v == null' assuming type of 'v' is Null on the true branch.
As a result, after joining data flow Null contaminates value of 'v'
further down:
v0 = ...
t1 = IsNull(v0) // Condition
t2 = Null // On true branch
t3 = NarrowNotNull(v0) // On false branch
v1 = Join(t2, t3) // This value is nullable even if v0 was not.
...
use(v1)
This change adds a condition to the Null value so it is evaluated to
Empty type if original value turns out to be non-nullable:
t1 = IsNull(v0)
t2 = Move(Null) {t1} // Empty if t1 is false.
t3 = NarrowNotNull(v0)
v1 = Join(t2, t3)
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_59845.dart
Fixes https://github.com/dart-lang/sdk/issues/59845
Change-Id: I0f78e31f9eaf6507cc78e393de2fc12a9cf29f4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403200
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
In this CL methods StructuralParameterType.forAlphaRenaming,
StructuralParameterType.forAlphaRenamingFromTypeParameter,
TypeParameterType.forAlphaRenaming, and
TypeParameterType.forAlphaRenamingFromStructuralParameter are removed,
and their call sites are replaced with invocations of other
constructors of StructuralParameterType and TypeParameterType. The
reason for this change is call sites having more information for
correct computing of type nullabilities.
In addition to the primary update, the following related changes are
made in this CL.
* Method StructuralParameterType.computeDefaultNullabilityForLibrary
is renamed into StructuralParameterType.computeDefaultNullability,
and TypeParameterType.computeDefaultNullabilityForLibrary is renamed
into TypeParameterType.computeDefaultNullability. The parameter
`library` is removed from both methods, since it's no longer needed.
* The static methods named `computeNullabilityFromBound` are removed
from `StructuralParameterType` and `TypeParameterType` and
re-introduced as instance members in classes `StructuralParameter`
and `TestParameter` respectively
TEST=existing
Change-Id: I26cccf17ccc9bda1e8b750196f427325b544a7ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This change simplifies working with `@Native`-annotated functions by allowing the native type to be omitted when it can be inferred from the Dart function's signature. While this was previously supported for `@Native` fields, it now applies to functions as well.
Before this change, you needed to specify the native type explicitly:
```
@Native<Void Function(Pointer)>()
external void free(Pointer p);
```
After this change, the native type can now be omitted if it's clear from the Dart signature:
```
@Native()
external void free(Pointer p);
```
TEST=tests/ffi/native_assets/*
CoreLibraryReviewExempt: VM only
Closes: https://github.com/dart-lang/sdk/issues/54810
Change-Id: Ied5407fcd2f49d85284cb7817f0c8cad2a73626b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400840
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Previously catch blocks were hanging off the function entry blocks being effectively an alternative entry-point into the function. Now catch blocks are hanging off the try-entry blocks.
Previously all the variables that are used in the catch block and beyond were declared as parameters to catch block. Now only those that have their definitions not dominating catch entry will become parameters (for example, if a variable is assigned in the try-block, it becomes a parameter to catch block).
During OSR, if OSR target entry point is inside some try-blocks, then all of corresponding try-entry/catch-blocks are pulled up to the OSR entry forming a chain that ends with a jump to the OSR target entry.
TEST=vm/dart/trycatch*, ci
Change-Id: Iae20c6548d5d65c63be6d7a53c1b0d2adac7ac31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356311
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
ExtensionTypeMemberDescriptor.memberReference and
ExtensionMemberDescriptor.memberReference are now nullable.
TFA-based tree shaker can now set them to null when extension type
member is not used and removed but corresponding lowered tear-off is
still used and retained.
Front-end never sets them to null and requires non-null memberReferences
when consuming kernel.
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_flutter155624.dart
Fixes https://github.com/flutter/flutter/issues/155624
Change-Id: I71f98c02f4659ff72a8c1d7fc6c578e8b8e26d82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401382
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Previously, TFA-based tree shaker did not retain libraries if they have
extensions and extension types which are still used.
As a result, kernel files were incomplete and certain tools, such as
Flutter const finder failed to read kernel files after tree shaking.
This change fixes tree shaker to retain libraries when they have used
extensions and extension types.
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_flutter160137.dart
Fixes https://github.com/flutter/flutter/issues/160137
Change-Id: Iac6f3a13323d053dfab2230367dcafa2550484db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401481
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Use the TFA direct-call metadata to directly call a closure in function
invocations.
Closes#55231.
Tested: existing tests cover the new code paths, but I also added a new
test.
Change-Id: Ib5f26b10efd77570e256196b4bfb07e6bef800c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397260
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Depfiles escape backslashes with backslashes to be able to encode
spaces in paths. And they have backslashes on windows and forward
slashes on the other platforms.
Change the test to only check for the directory and file names, not
the path separators.
TEST=pkg/vm/test/kernel_front_end_test.dart
Change-Id: I15927d036fa07fe0a03a6d2340a241453f777794
Cq-Include-Trybots: luci.dart.try:pkg-win-release-try,pkg-win-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398901
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This reverts commit af2bea8162.
Reason for revert: Caused unexpected performance regressions.
Original change's description:
> [dart2wasm] Make int, double, bool box fields immutable
>
> Make the `value` fields of `BoxedInt`, `BoxedDouble` and `BoxedBool`
> `final`, to generate immutable Wasm fields for them.
>
> Immutable fields can potentially generate better code, as loads from the
> same object will always generate the same value.
>
> To allow making the `value` fields `final`, add a constructor.
>
> To allow adding a constructor, "implement` base classes instead of
> extending them. With `extends` the front-end wants us to call the
> superclass constructors, even though they don't have any constructors.
>
> Implementing `bool` (instead of extending) causes issues in TFA as it
> currently assumes bool literals are compiled as the `bool` class. Update
> TFA to treat bool literals the same way as `int` and `double` literals.
>
> Tested: existing tests
> Change-Id: I3282e188d784fa7a22421edc79ed47f9d85faf19
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393320
> Commit-Queue: Ömer Ağacan <omersa@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
Change-Id: I8bb49bcc4bd9cd01f3e8a692d7ba1bef889ab555
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393840
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Ömer Ağacan <omersa@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
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>
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>
Make the `value` fields of `BoxedInt`, `BoxedDouble` and `BoxedBool`
`final`, to generate immutable Wasm fields for them.
Immutable fields can potentially generate better code, as loads from the
same object will always generate the same value.
To allow making the `value` fields `final`, add a constructor.
To allow adding a constructor, "implement` base classes instead of
extending them. With `extends` the front-end wants us to call the
superclass constructors, even though they don't have any constructors.
Implementing `bool` (instead of extending) causes issues in TFA as it
currently assumes bool literals are compiled as the `bool` class. Update
TFA to treat bool literals the same way as `int` and `double` literals.
Tested: existing tests
Change-Id: I3282e188d784fa7a22421edc79ed47f9d85faf19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393320
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
There is no need to restrict the recording to annotations.
It also opens up more interesting use cases, for example recording instances of `const StringAsset('id').load()` if the class `StringAsset` has the `RecordUse` annotation.
Also includes a small refactoring in a separate commit.
TESTED=pkg/vm/testcases/transformations/record_use/instance_not_annotation.dart
Change-Id: I262995760a8ba8bc14c9cf01e5eb1b47f1278282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>