jlcontreras
69b194e88f
[cfe] Implements ValueClassScanner
...
Change-Id: I36b839280513a75d92797d5999ecb567e6999a5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162180
Commit-Queue: Javier López-Contreras <jlcontreras@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
2020-09-09 14:10:08 +00:00
jlcontreras
173a958d37
[cfe] Implement addEqualsOperator in value class transformation
...
Change-Id: I07afadfe9d23f792edb61681e794faa4de6aebb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161506
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Javier López-Contreras <jlcontreras@google.com >
2020-09-08 18:30:55 +00:00
Clement Skau
90652bc314
[VM] Fixes nested sync* w. diff. types.
...
Makes the synthetic sync* iterator dynamic to allow the internal,
synthetic sync* code to handle nested iterators of differing types.
Bug: https://github.com/dart-lang/sdk/issues/42234
Change-Id: I309885b27555142cd7f8ab13a5637b35545f1d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160071
Reviewed-by: Martin Kustermann <kustermann@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-09-03 11:48:44 +00:00
jlcontreras
70fd140a9d
[cfe] Implements addConstructor of value class transformation
...
Change-Id: I991c82693a6a3a44061efa7703fa89bd94f858b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158280
Commit-Queue: Javier López-Contreras <jlcontreras@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
2020-08-31 13:24:38 +00:00
Clement Skau
4db081545e
Revert "[VM] Fixes yield* exception handling in sync*."
...
This reverts commit 358aee331b .
Reason for revert: Appears to break service/async_generator_breakpoint_test
Original change's description:
> [VM] Fixes yield* exception handling in sync*.
>
> This adds a mechanism similar to that used in async functions where
> exceptions are caught in the synthetic code and passed into the
> generated body to be rethrow'n.
> This ensures the exception is throw'n from the same place as the
> original yield*, as per the spec.
>
> Bug: https://github.com/dart-lang/sdk/issues/42466
> Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
> Commit-Queue: Clement Skau <cskau@google.com >
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
TBR=vegorov@google.com ,cskau@google.com
Change-Id: I9df83543d41d4260e91e4a7fb8df7c2762b92429
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/42466
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160101
Reviewed-by: Clement Skau <cskau@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-08-25 14:08:42 +00:00
Clement Skau
358aee331b
[VM] Fixes yield* exception handling in sync*.
...
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.
Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
Commit-Queue: Clement Skau <cskau@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2020-08-25 12:40:49 +00:00
Johnni Winther
f8e7e64fd6
[cfe] Handle constant constructor invocations in Widget factory constructors
...
The widget transformer would try to pass on the location injected
parameter in the factory constructor when calling constructors of its
own kind in constructor body. For instance
class Foo extends Widget {
factory Foo() => new Foo.internal();
Foo.internal();
}
would be transformed into
class Foo extends Widget {
factory Foo({Location loc}) => new Foo.internal(loc: loc);
Foo.internal({Location loc}) : super(loc);
}
This doesn't work if the constructor invocation is constant. For
instance:
class Foo extends Widget {
factory Foo() => const Foo.internal();
const Foo.internal();
}
which would be transformed into
class Foo extends Widget {
factory Foo({Location loc}) => const Foo.internal(loc: loc);
const Foo.internal({Location loc}) : super(loc);
}
Here the reading of the injected factory parameter [loc] is not a
valid constant, leading to a compile-time error during constant
evaluation.
To handle this, const constructor invocations within factories do
not pass on the location from the surrounding constructor but
uses their own. For instance:
class Foo extends Widget {
factory Foo() => const Foo.internal();
Foo.internal();
}
will be transformed into
class Foo extends Widget {
factory Foo({Location loc})
=> const Foo.internal(loc: const Location());
Foo.internal({Location loc}) : super(loc);
}
This does mean that these constant widgets will all have a
location based on the factory constructor declaration and _not_
one per invocation of the factory constructor.
Related to https://github.com/flutter/flutter/issues/63335
Change-Id: Ie3300d3ba81324d5fbd7fb6ab72b9d83d7afcf22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158395
Reviewed-by: Jens Johansen <jensj@google.com >
2020-08-14 10:15:12 +00:00
jlcontreras
0f0e04ec3a
Add empty value class transformer.
...
Change-Id: I8e532c1699785ed75c7eff7a3187a4ca3a2032e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156880
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Javier López-Contreras <jlcontreras@google.com >
2020-08-03 14:14:42 +00:00
Mayank Patke
ca743398c2
Ensure CFE provides correct setter name to instantiateInvocation.
...
All of the backends (dart2js, DDC, VM) were checking if the invocation
name was tagged with "set:" and appending "=" to the name if so.
Instead, we can simply have the CFE perform this logic at the callsite.
Note that the name of the setter itself is still unchanged. Backends may
still need to generate the correct name themselves when handling NSMs
via code paths other than instantiateInvocation.
Change-Id: Iae42c849d3557be3e3b77c3af6f3993347ba0b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156142
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Mayank Patke <fishythefish@google.com >
2020-07-30 06:21:20 +00:00
jlcontreras
96a25bdfa1
Fix a typo in the comment on a transformer.
...
Change-Id: I9d34f5d3bfbeb75b0b5f122ef334b9b0b629aace
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154882
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Javier López-Contreras <jlcontreras@google.com >
2020-07-20 10:50:24 +00:00
Johnni Winther
ab958bee57
[cfe,flutter] Make widget transformer location parameters optional
...
The location parameters added to Widgets was created as required
and non-nullable when opting flutter in to null-safety. This leads
to incremental compilation failing because already transformed
constructors require parameters that cannot be passed by user code.
Fixes https://github.com/flutter/flutter/issues/60269
Change-Id: I91cbeaa455e67e82983ebb17f93da13b46376da2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153085
Reviewed-by: Jens Johansen <jensj@google.com >
Reviewed-by: Jacob Richman <jacobr@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2020-07-16 06:12:13 +00:00
Dmitry Stefantsov
929d5e4a98
[cfe,ddc,dart2js,vm] Add FutureOrType
...
This CL is the sum of the following 5 CLs:
* https://dart-review.googlesource.com/c/sdk/+/149297/
* https://dart-review.googlesource.com/c/sdk/+/149299/
* https://dart-review.googlesource.com/c/sdk/+/149320/
* https://dart-review.googlesource.com/c/sdk/+/149321/
* https://dart-review.googlesource.com/c/sdk/+/149323/
The reason for landing the 5 CLs as one CL is to prevent potential
troubles with bisecting over the branch because the change is fully
functional only with all 5 CLs.
Closes #40123 .
Bug: https://github.com/dart-lang/sdk/issues/40123
Change-Id: Ice52250a98acfe455b1d7fa5bb0624c115ca5dac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150934
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2020-06-15 12:18:46 +00:00
Alexander Markov
cbb5305f78
[vm/nnbd] Optimize type casts
...
Add a kernel transformation which removes redundant casts and reduces
some casts to null checks. This transformation assumes that type
system is sound and subtyping relation is transitive. So in NNBD weak
mode this transformation is always correct. In NNBD strong mode
this transformation is correct only if opted-out libraries are not
allowed.
The following patterns are handled:
If S <: T (this includes S <: T? in weak mode)
S x; x as T => x
If S <: T? in strong mode
S x; x as T => (x == null) ? x as T : x
This kernel transformation is not specific to the VM and can be reused
by other back-ends such as dart2js and DDC.
Fixes https://github.com/dart-lang/sdk/issues/40892
Issue https://github.com/dart-lang/sdk/issues/40893
Change-Id: I466ba96d763d5358011c768400c5225fa7bf5e67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139314
Commit-Queue: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2020-05-19 02:35:12 +00:00
Jens Johansen
6fb1efd584
[flutter/vm] Update dartdoc for WidgetCreatorTracker.transform
...
Change-Id: I6afbc4cc5f975052c9dd05e4befea572e8a91505
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148400
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2020-05-18 10:35:07 +00:00
Jens Johansen
7929b4223e
[CFE] Fix memory leak via WidgetCreatorTracker
...
Change-Id: Iebb961955bcd6cf2513cdec6036dfbd126e45231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148240
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2020-05-15 14:09:02 +00:00
Johnni Winther
d5650235a2
[cfe] Handle ProblemBuilder in binary expression
...
Closes #41787
Change-Id: I81fcf0aee975b58b3b44d0de94054ae87bdd265d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147140
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2020-05-12 11:44:19 +00:00
Clement Skau
2359f4dc68
[VM] Reworked: Remove unnecessary Closure.clone() from sync*.
...
Removes the Closure.clone() in sync* by adding an additional closure
around the rewritten sync* function body.
This is a re-worked version of the now reverted:
- https://dart-review.googlesource.com/c/sdk/+/136190
- https://dart-review.googlesource.com/c/sdk/+/144948
This CL includes changes from both the above CLs, in addition to:
- A new 'ShadowRewriter' transformer to do deep rewriting of
shadowed parameters.
Previous versions only rewrote the immediate sync* function, missing
references in nested rewritten functions.
Note: This CL is re-landing largely unchanged since the roll-blocking
issues suspected to be caused by this was later attributed to a
different set of changes.
I have independently re-run all failing external tests to verify
them passing for this CL.
Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: Id1670a93961180e8558d7c7eca65fe7e9115f07b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145402
Commit-Queue: Clement Skau <cskau@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2020-05-05 12:04:03 +00:00
Clement Skau
12a5c93d4a
Revert "Reland "[VM] Remove unnecessary Closure.clone() from sync*.""
...
This reverts commit 1bf25798fa .
Reason for revert: Rolling back as it breaks more external targets and is currently blocking rolls.
Original change's description:
> Reland "[VM] Remove unnecessary Closure.clone() from sync*."
>
> This reverts commit 430c75b5fa .
>
> Reason for revert: We probably don't care about the dartkb breakages.
>
> Original change's description:
> > Revert "[VM] Remove unnecessary Closure.clone() from sync*."
> >
> > This reverts commit ca94ad7112 .
> >
> > Reason for revert: Appears to break dartkb.
> >
> > Original change's description:
> > > [VM] Remove unnecessary Closure.clone() from sync*.
> > >
> > > Instead, this CL wraps sync*'s sync_op in an additional function
> > > that captures local copies of the necessary closure state.
> > > Notably this state includes the parameters of the original sync* function
> > > as these also need to be cloned for each instance.
> > >
> > >
> > > Note: a large number of .expect files have a small number of changes
> > > due to the additional wrapper function, as well as some extra plumbing.
> > >
> > > Bug: https://github.com/dart-lang/sdk/issues/37753
> > > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > > Commit-Queue: Clement Skau <cskau@google.com >
> > > Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
> >
> > TBR=vegorov@google.com ,cskau@google.com
> >
> > Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> > Reviewed-by: Clement Skau <cskau@google.com >
> > Commit-Queue: Clement Skau <cskau@google.com >
>
> TBR=vegorov@google.com ,cskau@google.com
>
> Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
> Reviewed-by: Clement Skau <cskau@google.com >
> Commit-Queue: Clement Skau <cskau@google.com >
TBR=vegorov@google.com ,cskau@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: I879df17bd282d01468fa010b94a8c89afdb8cd0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145361
Reviewed-by: Clement Skau <cskau@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-04-29 09:52:30 +00:00
Clement Skau
871983d8ae
Revert "[VM] Fixes missing bits for new sync* transform."
...
This reverts commit 05b7f49c72 .
Reason for revert: This appears to break other external targets. Rolling this and original CL back to unblock rolls until deeper investigation can be done.
Original change's description:
> [VM] Fixes missing bits for new sync* transform.
>
> The missing part of the transform fixes an issue that manifested
> as a crash when running tests for [0].
> Which was caused by un-transformed yields in nested functions in sync*s.
>
> The second half of this CL updates the type_checker tool for the new
> transform of sync*s.
>
> [0] https://github.com/KhronosGroup/glTF-Validator
>
> TBR: To unblock roll blocked by crash.
>
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Change-Id: Ie20f351b16f2f87e92f0731fc96b0a5ea29e0300
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144948
> Commit-Queue: Clement Skau <cskau@google.com >
> Reviewed-by: Clement Skau <cskau@google.com >
TBR=kustermann@google.com ,cskau@google.com
Change-Id: Ided526100e7393375445545d0fe16806333b0d20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145360
Reviewed-by: Clement Skau <cskau@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-04-29 08:35:52 +00:00
Clement Skau
05b7f49c72
[VM] Fixes missing bits for new sync* transform.
...
The missing part of the transform fixes an issue that manifested
as a crash when running tests for [0].
Which was caused by un-transformed yields in nested functions in sync*s.
The second half of this CL updates the type_checker tool for the new
transform of sync*s.
[0] https://github.com/KhronosGroup/glTF-Validator
TBR: To unblock roll blocked by crash.
Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: Ie20f351b16f2f87e92f0731fc96b0a5ea29e0300
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144948
Commit-Queue: Clement Skau <cskau@google.com >
Reviewed-by: Clement Skau <cskau@google.com >
2020-04-29 06:56:14 +00:00
Clement Skau
1bf25798fa
Reland "[VM] Remove unnecessary Closure.clone() from sync*."
...
This reverts commit 430c75b5fa .
Reason for revert: We probably don't care about the dartkb breakages.
Original change's description:
> Revert "[VM] Remove unnecessary Closure.clone() from sync*."
>
> This reverts commit ca94ad7112 .
>
> Reason for revert: Appears to break dartkb.
>
> Original change's description:
> > [VM] Remove unnecessary Closure.clone() from sync*.
> >
> > Instead, this CL wraps sync*'s sync_op in an additional function
> > that captures local copies of the necessary closure state.
> > Notably this state includes the parameters of the original sync* function
> > as these also need to be cloned for each instance.
> >
> >
> > Note: a large number of .expect files have a small number of changes
> > due to the additional wrapper function, as well as some extra plumbing.
> >
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > Commit-Queue: Clement Skau <cskau@google.com >
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
>
> TBR=vegorov@google.com ,cskau@google.com
>
> Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> Reviewed-by: Clement Skau <cskau@google.com >
> Commit-Queue: Clement Skau <cskau@google.com >
TBR=vegorov@google.com ,cskau@google.com
Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
Reviewed-by: Clement Skau <cskau@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-04-28 06:17:20 +00:00
Clement Skau
430c75b5fa
Revert "[VM] Remove unnecessary Closure.clone() from sync*."
...
This reverts commit ca94ad7112 .
Reason for revert: Appears to break dartkb.
Original change's description:
> [VM] Remove unnecessary Closure.clone() from sync*.
>
> Instead, this CL wraps sync*'s sync_op in an additional function
> that captures local copies of the necessary closure state.
> Notably this state includes the parameters of the original sync* function
> as these also need to be cloned for each instance.
>
>
> Note: a large number of .expect files have a small number of changes
> due to the additional wrapper function, as well as some extra plumbing.
>
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> Commit-Queue: Clement Skau <cskau@google.com >
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
TBR=vegorov@google.com ,cskau@google.com
Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
Reviewed-by: Clement Skau <cskau@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-04-27 07:45:04 +00:00
Clement Skau
ca94ad7112
[VM] Remove unnecessary Closure.clone() from sync*.
...
Instead, this CL wraps sync*'s sync_op in an additional function
that captures local copies of the necessary closure state.
Notably this state includes the parameters of the original sync* function
as these also need to be cloned for each instance.
Note: a large number of .expect files have a small number of changes
due to the additional wrapper function, as well as some extra plumbing.
Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
Commit-Queue: Clement Skau <cskau@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2020-04-27 07:37:39 +00:00
Johnni Winther
6c21ed6314
[cfe] Support class hierarchy changes in ChangedStructureNotifier
...
Closes #40707
Change-Id: I0a9e0b11d0f597dfed7182dd869382057d04e5dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144821
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2020-04-26 19:51:29 +00:00
Martin Kustermann
e2b6cc93b6
[vm/async] Update async transformation to take NNBD mode into account
...
The removal of unsafeCast causes flutter galley size regressions:
- armv7: -0.43%
- armv8: -0.21%
which we should look into recovering by having better inlining heuristics.
Issue https://github.com/dart-lang/sdk/issues/41373
Closes https://github.com/dart-lang/sdk/issues/41307
Change-Id: I7c0ba4c9598e13f01e807a607c83d50cf03e9abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142501
Commit-Queue: Martin Kustermann <kustermann@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
2020-04-11 08:56:52 +00:00
Martin Kustermann
c4a7c3488e
[vm/async] Make async transformer use typed variables, make async patch use function types
...
This gets rid of a slow AssertAssignable (function type test)
in _asyncThenWrapperHelper/_awaitHelper, which currently falls back to the slow table
search:
AssertAssignable
^--> TypeTestingStub
^--> SlowTypeTestStub
^--> Subtype6TestCacheStub
Issue https://github.com/dart-lang/sdk/issues/37668
Change-Id: I3b6517b7e348e39619e8096d6ac2a4b179bb3242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142022
Commit-Queue: Martin Kustermann <kustermann@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Clement Skau <cskau@google.com >
2020-04-03 08:28:47 +00:00
Clement Skau
b681bfd8d2
[VM] Fixes bad reuse/typing of temps in async transform invocations.
...
For a method invocation temps might get allocated for both the receiver
and argument(s) so that:
A().foo(await null)
becomes:
Future<void> tmp0
...
tmp0 = A() // <- Type mismatch.
yield ...
tmp0 = tmp0.foo(:result) // <- Correct type.
This happens because the liveness analysis finds that the (previously
dynamic) temps can be reused.
Unfortunately 121988 added typing information to these temps, which
means they can't be simply reused in all cases.
This fix makes the temps dynamic again (by removing the type) but adds
unsafecasts to all VariableGets to propagate the know type.
Bug: https://github.com/flutter/flutter/issues/51828
Change-Id: I89c82763e0d4f8b102bb55dec3b694d017345517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138500
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-03-06 12:20:45 +00:00
Johnni Winther
c1ff1cbaae
[cfe] Merge clone with existing procedure in mixin transformation
...
This ensure that any existing references to the original procedure
will correctly refer to the cloned procedure after transformation.
Change-Id: I08f561f11e88d717041009e6a9bd9bb6e8054d88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137976
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2020-03-03 13:52:11 +00:00
Clement Skau
ad118b1718
[Kernel] Fixes bug in async transform causing reuse of temps.
...
Certain nodes will delimit(..) an Expression to some Statements, which
was resetting the temp nameIndex.
This meant any sub-expressions that generated temps would not cause the
outer expressions to see those already used temps.
Bug: https://github.com/dart-lang/sdk/issues/40662
Change-Id: Ife07052ab756b9d05f34f69380614c7eb7309a4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136224
Commit-Queue: Clement Skau <cskau@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2020-02-21 07:35:16 +00:00
Jens Johansen
128771af8a
[CFE] Version 2 of incremental compiler invalidation strategy
...
Change-Id: Iff860e2665dee64fc005a50237ae890986ddb0f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127896
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2020-01-16 07:50:39 +00:00
Jens Johansen
db525fe0f9
[kernel] Remove old unused 'method call' transformer
...
Change-Id: I20afd79daa0d3668c96d52fcc83c78fb5e3fb4bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127620
Reviewed-by: Martin Kustermann <kustermann@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2019-12-09 10:14:57 +00:00
Samir Jindel
1d4c45d2d0
Re-land "[vm/cfe] Elaborate for-in statements during async transform"
...
This removes the component of the change which updates the kernel binary
format.
Change-Id: I86dbfe0ea61453bbea6eee200743961d0d0c3814
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127002
Commit-Queue: Samir Jindel <sjindel@google.com >
Reviewed-by: Teagan Strickland <sstrickl@google.com >
2019-12-05 14:06:08 +00:00
Clement Skau
f9327d3bac
[SDK] Adds --lazy-async-stack support for async*.
...
Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I53cd334243649901ea8e0f9799d9f41c126e3627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126729
Commit-Queue: Clement Skau <cskau@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
2019-12-04 12:47:48 +00:00
Clement Skau
89e31069e8
Revert "[vm/cfe] Elaborate for-in statements during async transform"
...
This reverts commit 63333deed6 .
Reason for revert: Causes failures on Flutter HHH CI in the "flutter test hostonly_devicelab_tests" step due to kernel binary format version mismatch.
Original change's description:
> [vm/cfe] Elaborate for-in statements during async transform
>
> This allows us TFA to analyze the iterator calls and we generate much tighter
> code in AOT.
>
> However, due to the increased inlining opportunities, we end up emitting 0.5%
> more code. Inlining of the _GrowableList iterator specifically also includes the
> concurrent modification check and error handling.
>
> Calls to get:iterator, moveNext and get:current account for 7.12% of all InstanceCall
> instructions in Flutter Gallery.
>
> Fixes https://github.com/dart-lang/sdk/issues/39516
> Issue https://github.com/dart-lang/sdk/issues/39566
> Issue https://github.com/dart-lang/sdk/issues/39565
>
> Change-Id: I8dcc08b7571137e869a16ceea8cc73539eb02a5a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126381
> Commit-Queue: Samir Jindel <sjindel@google.com >
> Reviewed-by: Martin Kustermann <kustermann@google.com >
TBR=kustermann@google.com ,sjindel@google.com ,johnniwinther@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I89b88c3d9f7c743fc340ee73a45c3f57059bcf30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126734
Reviewed-by: Clement Skau <cskau@google.com >
Reviewed-by: Teagan Strickland <sstrickl@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2019-12-03 12:29:35 +00:00
Jens Johansen
1c3468a646
[kernel] Remove Library.isExternal
...
Change-Id: I6638b915c1189838e7081069a0075e4ecd9ee9d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125600
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-12-02 09:24:42 +00:00
Samir Jindel
63333deed6
[vm/cfe] Elaborate for-in statements during async transform
...
This allows us TFA to analyze the iterator calls and we generate much tighter
code in AOT.
However, due to the increased inlining opportunities, we end up emitting 0.5%
more code. Inlining of the _GrowableList iterator specifically also includes the
concurrent modification check and error handling.
Calls to get:iterator, moveNext and get:current account for 7.12% of all InstanceCall
instructions in Flutter Gallery.
Fixes https://github.com/dart-lang/sdk/issues/39516
Issue https://github.com/dart-lang/sdk/issues/39566
Issue https://github.com/dart-lang/sdk/issues/39565
Change-Id: I8dcc08b7571137e869a16ceea8cc73539eb02a5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126381
Commit-Queue: Samir Jindel <sjindel@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
2019-11-29 16:42:36 +00:00
Clement Skau
d5dbf10672
[SDK] Adds non-eager async stack frame collector.
...
This is done by collecting all frames on the current stack until an async/async* frame is hit
which has yielded before (i.e. is not in sync-async case).
From there on it finds the closure of the async/async* frame and starts traversing the listeners:
while (closure != null) {
yield_index = closure.context[Context::kAsyncJumpVarIndex]
pc = closure.function.code.pc_descriptors.LookupPcFromYieldIndex(yield_index);
<emit pc in frame>
closure = closure.context[Context::kAsyncCompleterVarIndex]._future._resultOrListeners.callback;
}
Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I97030d22e529bf8a74ecd30a8a2589cfe57ad330
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122644
Commit-Queue: Clement Skau <cskau@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
2019-11-26 11:51:27 +00:00
Johnni Winther
970c164826
[cfe] Use correct types in transformations and start verifying getStaticType
...
With this fix Expression.getStaticType no longer throws on any known cases.
Users of getStaticType can therefore avoid enclosing static type computation
in try-catch.
Closes #38597
Change-Id: I52eaacd30256333d7c368e5d14f4e4956bafc96f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121988
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
2019-11-21 22:15:58 +00:00
Dmitry Stefantsov
f692a2fbb8
[cfe] Eliminate Nullability.legacy in transformers
...
Nullability.legacy is replaced with an appropriate invocation of a
method on Library to retrieve the appropriate nullability. Only
transformers in pkg/kernel and pkg/front_end are affected. The
inference transformers are excluded from the scope of this CL.
Change-Id: I691c4343def913388a1277227b760fd7e1aa194c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125666
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
2019-11-21 09:12:05 +00:00
Johnni Winther
4b5589e0cb
Reland "[cfe] Use StaticTypeContext for getStaticType" and more"
...
This relands commits
"[cfe] Use StaticTypeContext for getStaticType"
45033c6ad9
"[cfe] Move caching of thisType to CoreTypes"
fab25cbe0c
"[vm/bytecode] Notify static type context when entering/leaving library"
c9f88ae253
Change-Id: I407d6b0e3b3df503cedc9fcb2c834d835cf083f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125343
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-11-16 05:50:58 +00:00
Johnni Winther
ef5fb7d3f4
Revert "[cfe] Use StaticTypeContext for getStaticType" and more
...
This reverts commits
"[cfe] Use StaticTypeContext for getStaticType"
45033c6ad9
"[cfe] Move caching of thisType to CoreTypes"
fab25cbe0c
"[vm/bytecode] Notify static type context when entering/leaving library"
c9f88ae253
Change-Id: I6171f6a74b97f2f4a77a36c242330fc2db94c82f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125341
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Aart Bik <ajcbik@google.com >
Auto-Submit: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Aart Bik <ajcbik@google.com >
2019-11-14 22:51:43 +00:00
Dmitry Stefantsov
fab25cbe0c
[cfe] Move caching of thisType to CoreTypes
...
Closes #38225 .
Bug: http://dartbug.com/38225
Change-Id: I0274bc390ca2d098896f578ea7ddf65527d82027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124325
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-14 16:01:26 +00:00
Dmitry Stefantsov
b4554c1215
[cfe] Make nullability a required parameter for types
...
Change-Id: Id787291294cafb15cf4ecad4a9db9da4c6066638
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124135
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
Auto-Submit: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-07 13:24:47 +00:00
Jens Johansen
f91ef3afd7
[kernel] Deprecate Library.isExternal
...
We're deprecating kernels Library.isExternal as it wasn't used for
what it was originally intended. It will hopefully go away entirely
soon.
Change-Id: If363c50af5607febae68865875af452c106fff85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123721
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-11-04 09:24:02 +00:00
Jens Johansen
0449905e2d
[CFE] Add a serialization-and-unserialization step to strong test
...
Change-Id: Icb6275e9eaec0bbdd890719d780a0218fa660fec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122384
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-10-22 13:40:01 +00:00
Dmitry Stefantsov
515a597710
[cfe] Remove Class.rawType
...
Bug: http://dartbug.com/38224
Change-Id: If0af5487b1d43125738575ee3e0fcd747db54fa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117546
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2019-09-19 10:42:10 +00:00
Johnni Winther
4122034ada
[kernel] Make accept methods generic
...
Change-Id: I50f3c2b5c09a1266811e1fe5a5b2042c77584e43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114514
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-09-05 07:46:10 +00:00
Jens Johansen
f278451729
[CFE/kernel] Spell check kernel too
...
Change-Id: I57c91a61a186d9334d7af189427e78bdcb156aa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114849
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2019-08-28 13:02:51 +00:00
Jens Johansen
e1fe0bf65a
[kernel] Delete unused transformations
...
Change-Id: Id661b878e42628013a942252597837697dc4bbc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114846
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2019-08-28 11:11:22 +00:00
Jens Johansen
9613e15a50
[kernel] Delete old Coq stuff
...
This is unused. If this is something we want to do again at some point
we can revert this cl.
Change-Id: Ia54b4c31a39f88dfb8837cb70960650320511151
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114845
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2019-08-28 11:06:41 +00:00