Commit 1b6f89d
[vm, tfa] Fix tree-shaking of late final fields with initializers
TFA tree shaker removes initializers of fields which cannot be accessed
but retained due to an entry point pragma / dynamic interface.
For late final fields with initializers that changes semantics as
late final fields without initializers have an implicit setter.
Such setter is not accounted in the kernel AST
(Field.setterReference == null and Field.hasSetter == false) and
it doesn't get an assigned selector id, which causes a crash in
dispatch table generator.
The change fixes this bug by retaining initializers for late final
fields. The initializer code is still replaced with
throw "Attempt to execute code removed by Dart AOT compiler (TFA)".
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_b404559785.dart
Bug: b/404559785
Change-Id: Id998a715ea75a4768414997ce66bcdd1d4f19189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416720
Commit-Queue: Alexander Markov <[email protected]>
Reviewed-by: Slava Egorov <[email protected]>
Reviewed-by: Sigmund Cherem <[email protected]>1 parent 42bdd60 commit 1b6f89d
File tree
4 files changed
+51
-4
lines changed- pkg/vm
- lib/transformations/type_flow
- testcases/transformations/type_flow/transformer
- test
4 files changed
+51
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2303 | 2303 | | |
2304 | 2304 | | |
2305 | 2305 | | |
2306 | | - | |
2307 | | - | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
2308 | 2314 | | |
2309 | 2315 | | |
2310 | 2316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments