-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[dart2asm] Improve/fix TFA record field dynamic call metadata #51363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As far as I understand, currently dart2wasm introduces synthetic classes for records, but doesn't lower any of the record types, record field access, record literals and record constants. So, in a kernel program those synthetic classes are just separate entities, unrelated to how record fields are accessed. As a result, we cannot expect from TFA to magically move inferred information about dynamic accesses to record fields into real fields of those synthetic classes. As we're going along the path of converting records to classes, it would be much cleaner to do the full lowering of records into classes before TFA. That transformation should replace all record types, record field access, record literals and record constants, in addition to just adding record classes. This will ensure that program is consistent and dynamic access to a record field is just a dynamic access to real field of a synthetic class. |
Correct.
These synthetic classes are added as
I'm working on this, but the transformation is not entirely trivial, because of loops in |
In records implementation (https://dart-review.googlesource.com/c/sdk/+/280461) we currently need to consider every record shape class field as dynamically used: (in
dispatch_table.dart
)This is because TFA never considers a record class field as dynamically used. For example, for the record
(1, 2, a: 'hi')
we generate this class:For members
$1
,$2
, anda
, TFA generatesProcedureAttributesMetadata
s, butgetterCalledDynamically
of those metadata are alwaysfalse
.I don't understand TFA in detail so I'm not sure if this is a bug and/or can be improved, but it's worth investigating.
The text was updated successfully, but these errors were encountered: