Commit Graph

256 Commits

Author SHA1 Message Date
Peter von der Ahé 5b32ab3be6 Remove the word "strongMode" from some package:kernel libraries.
Temporarily using "legacyMode" instead, but I plan to rid these soon.

Change-Id: Iff8bcde03b6ebe4ad95f963f456c855e73e58926
Reviewed-on: https://dart-review.googlesource.com/c/79042
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-10-11 08:50:43 +00:00
Alexander Markov 270fd8e4a8 [vm/aot] Handle annotations on parameters in tree shaker and constant evaluator
Fixes https://github.com/dart-lang/sdk/issues/34644
Issue https://github.com/flutter/flutter/issues/22355

Change-Id: Iaf1e5da9a2d33cf4cd8ea2510cf1faff1a20c886
Reviewed-on: https://dart-review.googlesource.com/c/77673
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-03 16:16:46 +00:00
Vyacheslav Egorov f8a3d802d0 Revert "[vm/kernel] Preserve strong mode types in async transformation"
This reverts commit eec96f9076.

Revert "[vm/kernel] In async transformation check if strongMode is on."

This reverts commit 348ed30efd.

Reason for revert: getStaticType is unreliable in Kernel

R=alexmarkov@google.com

Change-Id: I08b914f947a00923491bb610ed74d6348882554f
Reviewed-on: https://dart-review.googlesource.com/75220
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-09-17 22:58:55 +00:00
Vyacheslav Egorov 348ed30efd [vm/kernel] In async transformation check if strongMode is on.
It seems we are still using non-strong mode targets in few
places (e.g. when training front-end server we by accident
train it in legacy mode).

A separate bug is filed to clean that up https://github.com/dart-lang/sdk/issues/34468

For now to unbreak the build we simply check if we are in the
legacy mode and then avoid using getStaticType in async
transformation.

This is followup to eec96f9076.

Bug: https://github.com/dart-lang/sdk/issues/34463
Change-Id: Ib693fddfb9abbf89599ae646cb408d4a9c93f1b6
Reviewed-on: https://dart-review.googlesource.com/75061
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-14 22:11:30 +00:00
Vyacheslav Egorov eec96f9076 [vm/kernel] Preserve strong mode types in async transformation
Async transformation uses dynamic variables in few places (e.g.
for temporaries and for incomming arguments) - which creates
not strongly typed AST with method invocations having dynamic
receivers and non-null interface targets at the same time.

To maintain strong typedness of the AST we insert unsafeCast
when accessing the temporaries.

Bug: https://github.com/dart-lang/sdk/issues/34463
Change-Id: I11e38c128645ebc8acb0c982a80fe4c5c4036673
Reviewed-on: https://dart-review.googlesource.com/75000
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-14 17:19:29 +00:00
Martin Kustermann 609d2770be Reland "[VM] Add new SymbolConstant to package:kernel/ast.dart"
The canonicalization of symbols needs to take library privacy into
account. Since the Symbol class itself only has a [_name] field but does
not reference in which library the symbol came from, the [_name] must be
mangled.

Mangling is done by backends and so we make a new [SymbolConstant] which
the backends can desugar by doing appropriate mangling and construction
of a [Symbol] instance.

Fixes https://github.com/dart-lang/sdk/issues/34396

Change-Id: I2e13288483c35f875d39eefdb73677b2cc03527a
Reviewed-on: https://dart-review.googlesource.com/74360
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-09-11 09:29:01 +00:00
Alexander Aprelev d97823b704 Revert "[VM] Add new SymbolConstant to package:kernel/ast.dart"
This reverts commit ef72098353 as it broke
buildbot on CQ.

Change-Id: If9d19a9393157078d0e0890b92a418ba5ced42c6
Reviewed-on: https://dart-review.googlesource.com/74281
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-10 20:40:43 +00:00
Martin Kustermann ef72098353 [VM] Add new SymbolConstant to package:kernel/ast.dart
The canonicalization of symbols needs to take library privacy into
account. Since the Symbol class itself only has a [_name] field but does
not reference in which library the symbol came from, the [_name] must be
mangled.

Mangling is done by backends and so we make a new [SymbolConstant] which
the backends can desugar by doing appropriate mangling and construction
of a [Symbol] instance.

Fixes https://github.com/dart-lang/sdk/issues/34396

Change-Id: I5ddb5331ce79a0b942807929d4b8f1050a9899e7
Reviewed-on: https://dart-review.googlesource.com/73883
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-10 15:31:09 +00:00
Alexander Markov 9c8e9f02a3 [vm/kernel] Support CheckLibraryIsLoaded node in kernel constant evaluator
Change-Id: I5530c54ce86a61e1545c727215ca561c77b86e99
Reviewed-on: https://dart-review.googlesource.com/73840
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-09-07 19:32:11 +00:00
Sam Rawlins 57918dad37 Fix some new 'missing_return' errors in kernel
Change-Id: I561ca47e698f51c01d998c7b347436f2993a6cae
Reviewed-on: https://dart-review.googlesource.com/69540
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-08-14 16:14:15 +00:00
Dmitry Stefantsov 53321309da [kernel] Remove Vector-related Kernel nodes
They were supposed to be used as a part of the closure conversion pass,
which is now obsoleted.

Change-Id: Ie063f6c44487df7cd5d21895e8edc03251525d5f
Reviewed-on: https://dart-review.googlesource.com/68662
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-08-07 11:49:49 +00:00
Jens Johansen 164c7e3195 Debugging sync* and yield
Set position on yield in sync* functions; use yield position in VM.

Change-Id: I1c92fd47e3c8d4f747242e076007c122ea0d2186
Reviewed-on: https://dart-review.googlesource.com/68366
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-08-07 08:39:32 +00:00
Alexander Markov 1babc13b93 [vm/kernel/bytecode] Report compile-time errors from constant evaluation while generating bytecode
Change-Id: I931622f5e442a439f5bfa241aade686b1bc91afd
Reviewed-on: https://dart-review.googlesource.com/68222
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-08-03 19:21:17 +00:00
Jens Johansen ac8fdb5a58 Add :controller_stream and call _asyncStarListenHelper
This changes how we step out of async* functions slightly to match how
Dart1 behaves.

Bug: #29158

Change-Id: I8ee2df5eee8167fd1907a6e9f30c9dc7ab6939b1
Reviewed-on: https://dart-review.googlesource.com/63625
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-02 06:49:47 +00:00
Jens Johansen 2e98da68f9 Call _asyncStarMoveNextHelper in kernel
This changes how we step into async* functions slightly to match how
Dart1 behaves.

Bug: #29158
Change-Id: I4969ca48f798bd51f9d2d5bc26dd224fa7eff627
Reviewed-on: https://dart-review.googlesource.com/63624
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-02 06:16:15 +00:00
Jens Johansen 3a1b09dc63 Fix for bug #33660
Fix for #33660 that doesn't try to use fewer temporaries.
This fix could be revisited and possibly improved later.

Bug: #33660
Change-Id: I966d2756d74e9f041d043e839487bee8a3cc5aa2
Reviewed-on: https://dart-review.googlesource.com/63823
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-07-09 12:20:54 +00:00
Jens Johansen 1467909921 Call _completeOnAsyncReturn instead of .complete directly
The VM debugger expects _completeOnAsyncReturn to be called when
returning from an async function for stepping out of the async function
to work.

This CL does just that.

Note that `_completeOnAsyncReturn` only exists in the VM, but as
the async transformation is only run for the VM target that shouldn't
be a problem.

Change-Id: Id71344310de918f743dcb1ad66e165fc649516ba
Reviewed-on: https://dart-review.googlesource.com/63383
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-07-03 06:24:49 +00:00
Martin Kustermann e232ddd28c [VM] Handle [VariableGet]s for parameters/let variables differently than other const variables
Change-Id: I10e74b7535936a62964cc4f00aac2572552b31d7
Reviewed-on: https://dart-review.googlesource.com/62064
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-06-25 14:12:33 +00:00
Martin Kustermann 2ff5f8cfcb [VM] Report an error when accessing constructor parameters inside a constructor invocation
Closes https://github.com/dart-lang/sdk/issues/33604

Change-Id: I84034499de43ea300b278f2f922bc73c565e8bcc
Reviewed-on: https://dart-review.googlesource.com/61934
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-06-25 12:05:53 +00:00
Dmitry Stefantsov a3a8d8bbd5 [VM][kernel] Don't mix in noSuchMethod forwarders
Bug: http://dartbug.com/33380
Change-Id: I57f85e1e33105c4ffcb6a9c8a970cfbc42318936
Reviewed-on: https://dart-review.googlesource.com/60924
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-06-20 12:57:41 +00:00
Martin Kustermann b172a42881 [VM] Catch errors for integer operations in kernel2kernel constant evaluator
Issue https://github.com/dart-lang/sdk/issues/33481

Closes https://github.com/dart-lang/sdk/issues/33469

Change-Id: I7ca9825a0aa5f062732a759b4dd116e716a0d1b3
Reviewed-on: https://dart-review.googlesource.com/60580
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-19 10:28:05 +00:00
Martin Kustermann c54a302495 [VM] Evaluate symbols in kernel2kernel constant evaluator in AOT (even in non-const contexts)
Closes https://github.com/dart-lang/sdk/issues/33185

Change-Id: Ifa6a3e34e6f1a517f0adce1593e4ff747fe5c2cb
Reviewed-on: https://dart-review.googlesource.com/60246
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-06-14 13:35:39 +00:00
Alexander Markov 828a168622 [vm/kernel/bytecode] Generate bytecode for native methods
Change-Id: If47ef9ef4ff5ac3cb3f4f6737590370b647fc9ff
Reviewed-on: https://dart-review.googlesource.com/59180
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-06-13 01:16:03 +00:00
Alexander Markov b7266fa3b3 [vm/kernel/bytecode] Support async/async*/sync* in bytecode generator
Change-Id: If164289608322647c0ee5d1f1ed35eb2562b1a03
Reviewed-on: https://dart-review.googlesource.com/56627
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-06-01 21:57:44 +00:00
Alexander Markov fb4f887eff [vm/kernel/aot] Fix recognition of native methods after annotations are constant evaluated
This change fixes findNativeName() in package:kernel/transformations/treeshaker
to handle constant evaluated Dart annotations. This function is used from
TFA and kernel tree shaker.

This change is a prerequisite for enabling constant evaluation of annotations.

Change-Id: I40f91cce6b34f0e262db7ae6f0fd98303acbf133
Reviewed-on: https://dart-review.googlesource.com/57401
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-30 19:29:20 +00:00
Alexander Markov 1ca17b6d03 [vm/kernel] Recognize desugared mixin applications in dart:mirrors
Kernel mixin transformation desugars mixin applications into normal
classes. Mixed-in type is pulled into interfaces list.
However, dart:mirrors needs to know the original mixed-in type of
a mixin application.

This change solves this problem by propagating a 'isTransformedMixinApplication'
attribute of a class through kernel AST, kernel binary and VM objects
into dart:mirrors implementation.

Fixes: https://github.com/dart-lang/sdk/issues/33240
Change-Id: I98ca69294e1ad445402a5ca91d90c30447aabcb2
Reviewed-on: https://dart-review.googlesource.com/56721
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-05-29 18:12:26 +00:00
Kevin Millikin e2597dfba7 Revert "Mark normal classes that were originally mixin applications"
This reverts commit 53cd0b4af1.

The commit causes failures in the VM's precompiler because its mixin
deduplication transformation apparently needs to distinguish between
anonymous and named mixins.

Change-Id: I3861a3bf90b10f627d5fc8f0e94f117c102422d7
Reviewed-on: https://dart-review.googlesource.com/56780
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-05-28 12:05:46 +00:00
Kevin Millikin 53cd0b4af1 Mark normal classes that were originally mixin applications
To implement dart:mirrors correctly, a backend like the VM needs to
know that a class was originally a mixin application.  Use the
`isSyntheticMixinImplementation` flag which was already there and
ignored by the VM.

Now the property is:

- if `isSyntheticMixinImplementation` is set on a class with a
  mixed-in type, then it was originally an anonymous mixin application

- if `isSyntheticMixinImplementation` is set on a normal class then it
  was originally a mixin application of some kind and the mixed-in
  type can be found as the last impelemented type

Bug: https://github.com/dart-lang/sdk/issues/33240
Change-Id: I004adc6bfe08e583efba8e511076a6c603c0c687
Reviewed-on: https://dart-review.googlesource.com/56760
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-05-28 09:17:34 +00:00
Kevin Millikin 0a042a270f Fix a bug in the async transformation of let expressions
The transformation worked as if there was never an await "to the
right" of the body of a let expression (i.e., an expression evaluated
after the let expression's body but before the value of the let
expression's body is used).  This is obviously not right.

Fixes https://github.com/dart-lang/sdk/issues/33206

Change-Id: Idc175dc8c65f3d520de8b65f2285164d361ff38e
Reviewed-on: https://dart-review.googlesource.com/56492
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-24 13:16:09 +00:00
Kevin Millikin 51fa5c1662 Correctly transform async functions with FutureOr return types
The async transformer did not allocate a completer with the correct
type in the case for async functions with a FutureOr return type.

Fixes https://github.com/dart-lang/sdk/issues/33196

Change-Id: I72654f24576295e38e8d79dff30aae5c90cb2564
Reviewed-on: https://dart-review.googlesource.com/56488
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-05-24 10:54:03 +00:00
Alexander Aprelev e71bd048e5 [vm, kernel] Fix async stack code traversal in dart2.
With this change debugger requests yield(await) positions from kernel builder so it can confirm which frame handles what exceptions.
This also renames ':completer' to ':async_completer' in constructed kernel, so it is compliant with what VM expects to see(and updates test expectations accordingly).
Further it fixes async stack navigation for sync-async that became default in dart vm since first version went for the review((uses `future` getter, rather than property).
It also makes `future` getter non-debuggable to allow stepping-out of async methods.

Make Handle zone-scoped. Clean up frame counter var name.

Bug: https://github.com/dart-lang/sdk/issues/29056

Change-Id: Ia71f3c851a6b313655b57dad28c296f5dd081eda
Reviewed-on: https://dart-review.googlesource.com/54640
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-22 00:27:01 +00:00
Martin Kustermann aafc2a6d43 Reland "[vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)"
The CL was originally committed in 039e8a175 (and reverted in
46ab040e5). The fix for the issue has landed in 9d9ce8d69 .

This time the CL will land in "disabled" form and will be enabled in a separate CL.

Change-Id: I3d5eb952230aee99875e3c58a6595691c5145e25
Reviewed-on: https://dart-review.googlesource.com/55361
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-16 12:48:38 +00:00
Martin Kustermann f2b37ab643 [VM] Add support for conditions in switch-case expressions to "constants" transformation
This seems to be the last remaining case which causes constant
evaluation in the VM in AOT mode.

Change-Id: I37dba2c634afa3bebd918ebe6dd93ff52a7708e7
Reviewed-on: https://dart-review.googlesource.com/55163
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-15 12:52:22 +00:00
Jens Johansen 9d05ada522 Renamings and updated comments in class hierarchy #2
Follow-up to https://dart-review.googlesource.com/c/sdk/+/53804.

Change-Id: I8359985f60207ef92c365c9a6e3833be181b49be
Reviewed-on: https://dart-review.googlesource.com/55162
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-05-15 10:12:32 +00:00
Jens Johansen f08f61e84d Incremental ClassHierarchy
This CL turns the ClassHierarchy incremental and use that in two places:

* When compiling incrementally
* When performing the second ClassHierarchy computation after adding
  forwarding stubs.

Change-Id: I7046d6be9d7673dc0783a98789b5a25183b44799
Reviewed-on: https://dart-review.googlesource.com/53804
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-05-15 07:37:09 +00:00
Peter von der Ahé 02cd63eefd Remove unused closure conversion
Change-Id: I0edbbd29a4cc603e7479023bc0e8869c78ca7bcc
Reviewed-on: https://dart-review.googlesource.com/54225
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-05-14 14:58:17 +00:00
Peter von der Ahé bc86dc1dd6 Remove unused reify transformation
Change-Id: I4d29e3372b9aaf6bc7f1849e9fc0fb27f63e5c5f
Reviewed-on: https://dart-review.googlesource.com/54223
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Karl Klose <karlklose@google.com>
2018-05-14 14:48:57 +00:00
Peter von der Ahé abb861d812 Remove pkg/kernel/lib/frontend directory
Removing this directory as it is mostly unused.
Closure conversion still relies on VariableAccessor, so I moved it
there.

We should consider removing closure conversion. I don't believe we
actually use it.

Change-Id: I885620b310c4d1bf3a9b9b805188921bc242a993
Reviewed-on: https://dart-review.googlesource.com/54221
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-14 14:25:38 +00:00
Jens Johansen 7b3ba3f41f ClassHierarchy refactorings
This CL:
* Removes unused functions in the ClassHierarchy
* Turns the data structures used in the ClassHierarchy upside down
  (nodes have a lists of supers instead of lists of subs)
* Factors some things that needs the original list-of-subs into another
  class that the user can ask the ClassHierarchy to compute if needed.
  It appears that it isn't generally.

This is step #1 in turning the ClassHierarchy into an incremental
ClassHierarchy.

Change-Id: I48c5731c01c1b0e8bf1fcd4ddba7f2bf7ce3b9c9
Reviewed-on: https://dart-review.googlesource.com/53662
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-05-14 11:33:20 +00:00
Zach Anderson 46ab040e58 Revert "[vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)"
This reverts commit 039e8a1755.

Reason for revert:
Blocks the roll into Flutter.
See https://github.com/dart-lang/sdk/issues/33095

Original change's description:
> [vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)
> 
> This CL also uses the newer `onProblem` error reporting mechanism, which supports contexts.
> 
> The errors by the constant evaluator are formatted e.g. like this:
> 
>     .../language_2/compile_time_constant_o_test_01.dart:14:8: Error: Duplicate keys are not allowed in constant maps (found duplicate key "StringConstant(foo)").
>       "foo": 499
>        ^
>     .../language_2/compile_time_constant_o_test_01.dart:32:24: Context: While analyzing:
>       Expect.identical(m1, m3);
> 
> Change-Id: I463416e14686e218b0f08903bd6aa0bca7392260
> Reviewed-on: https://dart-review.googlesource.com/53021
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,kustermann@google.com,alexmarkov@google.com,askesc@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I1af0200dcb0aef03c7bd9ba3b5aead1565f05708
Reviewed-on: https://dart-review.googlesource.com/54720
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Todd Volkert <tvolkert@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-05-11 17:50:46 +00:00
Kevin Millikin 8dbe716085 Remove the unused GenericCovariantInterface bit
None of the back ends are using it and it imposes a cost to have to
compute it and try to preserve it.

Change-Id: I217e1191b535829021fa11f2698cadd8d4baf1c8
Reviewed-on: https://dart-review.googlesource.com/54383
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-09 15:04:43 +00:00
Martin Kustermann 039e8a1755 [vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)
This CL also uses the newer `onProblem` error reporting mechanism, which supports contexts.

The errors by the constant evaluator are formatted e.g. like this:

    .../language_2/compile_time_constant_o_test_01.dart:14:8: Error: Duplicate keys are not allowed in constant maps (found duplicate key "StringConstant(foo)").
      "foo": 499
       ^
    .../language_2/compile_time_constant_o_test_01.dart:32:24: Context: While analyzing:
      Expect.identical(m1, m3);

Change-Id: I463416e14686e218b0f08903bd6aa0bca7392260
Reviewed-on: https://dart-review.googlesource.com/53021
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-09 09:00:02 +00:00
Alexander Aprelev 384a59595c Recognize synthetic catch-clause and unhandled exceptions.
Bug: https://github.com/flutter/flutter/issues/16741
Change-Id: I619c2eb0662cfdd16cc865ae5eae9c7d19bc55c4
Reviewed-on: https://dart-review.googlesource.com/52984
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-05-02 22:39:56 +00:00
Martin Kustermann a31d24dbd8 [vm/kernel] Add a knob to constant evaluate annotations only conditionally
This "knob" to turn off constant evaluation for annotations is required
because the TFA transformation leaves annotations in a state where they
cannot be evaluated anymore.

Change-Id: I7720a07ef42ff69834e24a856613ea2e846b4f2d
Reviewed-on: https://dart-review.googlesource.com/52803
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-30 13:34:35 +00:00
Martin Kustermann 4697e3c8f6 [vm/kernel] Change "constants" kernel2kernel transformation to be able to recover from errors
Instead of simply throwing an exception when a compile-time error was
discovered during constant evaluation, we report the error and continue
transforming.

This also collects a context, which can be used by error reporters to
show users in which context an error occured.

The reason for using an interface for reporting errors is to be able to
report reasonable nice error messages, keep the transformation inside
package:kernel and allow users of the transformation to possibly report
nicer error message, e.g. by adding quotes of source positions (which
will come in another CL). This makes it slightly verbose.

Change-Id: I965cafc690dddb525b20368d03bb978e18a6ee58
Reviewed-on: https://dart-review.googlesource.com/52447
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-30 11:27:55 +00:00
Martin Kustermann e9ffc02663 Add partial instantiation support for constant evaluator [PartialInstantiationConstant]
Change-Id: Iaa93da60331737aaa6bceb4d2fe1d791dc7e95e9
Reviewed-on: https://dart-review.googlesource.com/52445
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-04-25 09:25:28 +00:00
Samir Jindel db2f3de25d [kernel] Fix handling of function type type parameters in closure conversion.
Change-Id: Ic805d13bff3e1bc09f8483d918a14fe2f1d7f2d9
Reviewed-on: https://dart-review.googlesource.com/51920
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-04-22 23:01:45 +00:00
Dmitry Stefantsov c7cdb72f32 Move CloneWithoutBody to Kernel API
Change-Id: I21be996293af74bbaf96913d6f345cef28975a4c
Reviewed-on: https://dart-review.googlesource.com/47840
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-22 14:25:52 +00:00
Peter von der Ahé 4f2bdff90b Rename Program to Component
Change-Id: I1a3cc03fba9783807fa637a9d42fdbad68ee7686
Reviewed-on: https://dart-review.googlesource.com/31040
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-15 12:22:23 +00:00
Kevin Millikin 65b19ffa3c Translate asserts in the VM-specific async translation
Translate assert statements in async functions.  The translation of
the condition subexpression can produce a sequence of statements that
have been hoisted out of it.  These need to be guarded so they are
executed only when asserts are enabled.

For this purpose, we introduce an AssertBlock.  The semantics of the
assert block:

assert { s0; ...; sn; }

is the same as:

if (assertsEnabled) { s0; ...; sn; }

where assertsEnabled is a more primitive nullary expression that is
true iff. assertions are enabled.  We chose not to encode this using a
construct like assertsEnabled because (1) we would have to support it
appearing as an arbitrary expression which we don't currently need
and (2) it requires deeper pattern matching to detect and skip the
guarded code when desired.

The translation is more complicated because if there is a message
subexpression in an assert, it is conditionally evaluated only if the
assert's condition is false.

Fixes https://github.com/dart-lang/sdk/issues/28498

Change-Id: I0912a57104ede3160533e49f65b6fb79b76f1500
Reviewed-on: https://dart-review.googlesource.com/46442
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-03-14 19:41:09 +00:00