Commit Graph

304 Commits

Author SHA1 Message Date
Paul Berry 9e5cba8838 Clean up imports in kernel.
dartk.dart was missing a necessary import, and util.dart had an unused one.

TBR=asgerf@google.com, kustermann@google.com

Review-Url: https://codereview.chromium.org/2674733003 .
2017-02-03 08:58:23 -08:00
Martin Kustermann 2e4849856a VM: [Kernel] Add --embedder-entry-points-manifest to dartk/transform and pass it to the treeshaker
The VM's gen_snapshot already accepts an --embedder-entry-points-manifest option.

This CL makes dartk/transform.dart accept the same option and pass the
roots on to the treeshaker.

In addition to what gen_snapshot accepts, we also accept
"*external-instantiation*" instead of a specific constructor/factory name)

BUG=https://github.com/dart-lang/sdk/issues/28559
R=asgerf@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2668893004 .
2017-02-03 12:14:32 +01:00
Asger Feldthaus 14c6b27533 Put tree-shaking behind a flag in dartk.
BUG=
R=jensj@google.com

Review-Url: https://codereview.chromium.org/2669783002 .
2017-02-02 15:10:10 +01:00
Asger Feldthaus 6108988ba2 Update closure conversion test suite after changes to Target
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2674573003 .
2017-02-02 14:30:36 +01:00
Kevin Millikin 0b554a437f Fix a bug in the Kernel testing framework
We obviously should not try to add to an unmodifiable list.

R=asgerf@google.com
BUG=

Review-Url: https://codereview.chromium.org/2677433002 .
2017-02-02 14:19:02 +01:00
Kevin Millikin f9cd5274f5 Fix Kernel tests
Splitting transformations into modular and global ones needs to be
implemented in the tests.

BUG=
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2672713003 .
2017-02-02 14:11:52 +01:00
Asger Feldthaus a2cad3f500 Change type interface target of SuperMethodInvocation to Procedure
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2650823005 .
2017-02-02 13:40:29 +01:00
Kevin Millikin 3057283f0c Split the Kernel transformations into modular and global ones
Target-specific modular transformations have to be able to cope with
external libraries.  Target-specific global transformations should be
optimizations, and not required for correctness, since a simple linker
may choose not to perform them.

Make mixin resolution modular by making it fail when a mixed-in class
comes from an external library.  (We cannot mix in such a class because
we do not necessarily have all class members.)

R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2671653003 .
2017-02-02 13:08:27 +01:00
Paul Berry 7ea43baad1 Fix error "Couldn't infer type parameter" in kernel.
R=jensj@google.com

Review-Url: https://codereview.chromium.org/2666043003 .
2017-02-01 09:13:15 -08:00
Martin Kustermann e2eef7bfce Kernel: Do not try to use return value of []=
Fixes #28302

R=ahe@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2668893003 .
2017-02-01 17:47:16 +01:00
Peter von der Ahé 1be77216f1 Report problems through a method.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2620133004 .
2017-01-31 11:07:13 +01:00
Peter von der Ahé 1bafcd061f Set isSuper on accessors in no-such-method.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2532573002 .
2017-01-31 11:07:13 +01:00
Peter von der Ahé bd9d33736d Restore verifier flags after failed verification.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2614143003 .
2017-01-31 11:07:13 +01:00
Peter von der Ahé 3d4ae561f8 Print <Null> instead of crashing.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2617973002 .
2017-01-31 11:07:13 +01:00
Peter von der Ahé 54062a9210 Preserve isConst when cloning.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2616703006 .
2017-01-31 11:07:13 +01:00
Peter von der Ahé eecf30e48d Make DirectMethodInvocation a subclass of InvocationExpression.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2615193003 .
2017-01-31 11:07:12 +01:00
Peter von der Ahé 5ff19ad4ff Allow main to be null for modular tranformation.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2612873005 .
2017-01-31 11:07:12 +01:00
Peter von der Ahé caa67601ba Print 'await' when for is async.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2527253002 .
2017-01-31 11:07:12 +01:00
Peter von der Ahé f1a306f331 Option to include redirecting factories.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2617963002 .
2017-01-31 11:07:12 +01:00
Martin Kustermann 56e84a40be VM: [Kernel] Fix checked mode issues with await/async transformer
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2659393002 .
2017-01-31 11:03:10 +01:00
Peter von der Ahé 750d77d96b Only tree-shake if there's a main program.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2664033003 .
2017-01-31 10:34:26 +01:00
Asger Feldthaus b07ab608e9 Run tree shaking in strong-mode baseline tests.
This test now asserts that the string literal "unused" does not occur
in the output in addition to checking the expected output.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2645733004 .
2017-01-23 10:38:53 +01:00
Asger Feldthaus e6793f76ee Improvements to the kernel tree shaker.
- Use strong-mode types for more precise tree shaking.
- Bail out nicely if dart:mirrors is used.
- Run the tree shaker in the VM target.

The initial tree-shaking pass could be combined with the type checking
pass (inserting implicit down casts) but for now they remain separate.

R=kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/71efbad90c07bece4010162b77d3b51e79b0a34d
Review-Url: https://codereview.chromium.org/2627723003 .
2017-01-20 10:52:27 +01:00
Asger Feldthaus deedd39f04 Revert "Improvements to the kernel tree shaker."
This reverts commit 71efbad90c.

BUG=

Review-Url: https://codereview.chromium.org/2644543004 .
2017-01-19 16:02:48 +01:00
Asger Feldthaus 71efbad90c Improvements to the kernel tree shaker.
- Use strong-mode types for more precise tree shaking.
- Bail out nicely if dart:mirrors is used.
- Run the tree shaker in the VM target.

The initial tree-shaking pass could be combined with the type checking
pass (inserting implicit down casts) but for now they remain separate.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2627723003 .
2017-01-19 14:00:31 +01:00
Karl Klose e88a478a7c Handle constructor bodies
Also rewrites untransformed closures (for example those in initializers) to throw an exception.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2639253003 .
2017-01-19 13:32:18 +01:00
Asger Feldthaus 76442f9394 Fix language/bad_constructor_test in dartk and analyzer.
The test was incorrect because it did not declare that a static warning
was to be expected due to an unresolved reference to 'q'. The unresolved
reference has been removed as it has nothing to do with what it is
supposed to test.

The analyzer was incorrect in that a setter was reported to clash with
a constructor of the same name, but this failure was hidden by the
above issue. This has been fixed.

dartk inherited the issue (and its fix) from the analyzer, but some
additional error handling was needed in dartk to avoid crashing.

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

BUG=
R=kmillikin@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2643693002 .
2017-01-19 13:10:32 +01:00
Asger Feldthaus d4dfb3088e Fix some crashes in dartk.
Dartk should no longer crash in these cases:
- main method is provided through an export
- main method is missing
- initializing formal parameter is unresolved
- the loadLibrary function is torn off

BUG=
R=kmillikin@google.com, vegorov@google.com

Committed: https://github.com/dart-lang/sdk/commit/d01bd88152b2d30d6a06d1379e41e1280d094dab
Committed: https://github.com/dart-lang/sdk/commit/979072821d1113248e285f7926663eb00d8a8206
Review-Url: https://codereview.chromium.org/2641523002 .
2017-01-19 12:12:36 +01:00
Asger Feldthaus be9088060d Revert "Fix some crashes in dartk."
This reverts 979072821d

BUG=

Review-Url: https://codereview.chromium.org/2638353003 .
2017-01-18 20:52:13 +01:00
Asger Feldthaus 979072821d Fix some crashes in dartk.
Dartk should no longer crash in these cases:
- main method is provided through an export
- main method is missing
- initializing formal parameter is unresolved
- the loadLibrary function is torn off

BUG=
R=kmillikin@google.com, vegorov@google.com

Committed: https://github.com/dart-lang/sdk/commit/d01bd88152b2d30d6a06d1379e41e1280d094dab
Review-Url: https://codereview.chromium.org/2641523002 .
2017-01-18 16:44:45 +01:00
Asger Feldthaus 6272e23d35 Revert "Fix some crashes in dartk."
This reverts commit d01bd88152.

Some status file updates were missing for precompiled mode.

BUG=

Review-Url: https://codereview.chromium.org/2644513002 .
2017-01-18 12:21:43 +01:00
Martin Kustermann e97bcc5475 VM: [Kernel] Partial support for metadata annotations
The CL adds metadata support for Fields/Classes/Functions/Constructors. There
are other places where annotations can be put in the Dart language but the
Kernel IR currently does not store it in the AST.

Whenever a element (e.g. a function) gets annotated, the VM will make a [Field] for this
element whos value is an array of evaluated constant metadata annotations.

This CL attaches to these [Fields] a `kernel_function` which is then used to do the constant
evaluation.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2632253002 .
2017-01-18 10:51:24 +01:00
Asger Feldthaus d01bd88152 Fix some crashes in dartk.
Dartk should no longer crash in these cases:
- main method is provided through an export
- main method is missing
- initializing formal parameter is unresolved
- the loadLibrary function is torn off

BUG=
R=kmillikin@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2641523002 .
2017-01-18 10:39:10 +01:00
Asger Feldthaus a0b35a6c15 Do not emit InvalidStatement in sanitize_for_vm pass
Closes 28424

BUG=
R=kmillikin@google.com, kustermann@google.com

Review-Url: https://codereview.chromium.org/2638303002 .
2017-01-18 10:31:39 +01:00
Karl Klose 1628afdcf0 Add VM target with closure conversion to dartk
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2635223002 .
2017-01-17 15:58:11 +01:00
Karl Klose 8c6a174091 Use List::filled instead of List:: in closure conversion
The redirecting factory List:: is currently removed and replaced with the actual target at the callsites during construction of kernel, but referencing the actual target here would make the transformation platform specific.

R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2637083002 .
2017-01-17 15:17:11 +01:00
Paul Berry 05a417034a Initial implementation of front_end hot reload API.
This implementation is based on the existing kernel and analysis
driver logic, using proxy classes to account for interface
incompatibilities between those components.  In future CLs, I
hope we can (a) move the necessary analysis driver logic into
front_end, and (b) reduce or eliminate the number of proxy
classes needed.

This CL represents the very first inklings of functionality; all that
is confirmed to work at this point is compilation of a single source
file containing an empty `main` method.

R=danrubel@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2624193003 .
2017-01-17 06:10:02 -08:00
Asger Feldthaus 2fc333c93d Fix dispatch name of covariance-checked calls.
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2623333005 .
2017-01-16 12:43:38 +01:00
Martin Kustermann 23cc9cca41 VM: [Kernel] Add toString() support for generated enum classes
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2625053003 .
2017-01-11 19:50:21 +01:00
Martin Kustermann 673eb56471 VM: [Kernel] Fix remaining issues with kernel-based async/await implementation
This CL brings us on-par with the VM implementation in terms of tests.

  * Ensure we have saved-try-ctx/exception/stacktrace variables hoisted out for
    try-catch **and** try-finally.

  * Instead of closing the stream controller for 'async*' functions on return we
    do it inside an try-finally block so we get there in terms of normal and
    exceptional exit.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2627873002 .
2017-01-11 19:35:02 +01:00
Asger Feldthaus 70a4d169c0 Insert covariance checks in strong mode.
"Covariance checks" are checks on certain parameters, necessary due to
the unsafe covariant subtyping rule for interface types.

The new pass generates a checked entry point for each method with
covariance checks. This entry point checks the parameters whose type
cannot be trusted, and then calls the actual method implementation.

Every typed call is then redirected to the checked entry point if the
interface taget declares any parameters with unsafe types, unless the
receiver is 'this'.

Dynamic calls and covariant overrides are not addressed by this CL,
these are still unchecked.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2618393002 .
2017-01-11 16:33:04 +01:00
Asger Feldthaus 8dd2b15951 Insert implicit downcasts in kernel strong mode.
This is implemented as a separate pass, although going forward
I would like the new frontend to insert these checks.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2619193003 .
2017-01-11 13:47:40 +01:00
Jens Johansen 414d66dce6 More offsets in kernel
Added offsets to more nodes.
Added end offsets to some nodes.
Added functionnode debuggability flag.

This changes the dill format.
The new offsets et al. are read on the C++ side, but not used
for anything usefull yet.

This is step #2 in introducing these things, next step(s) will be
using it on the C++ side.

R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2626613002 .
2017-01-11 09:59:52 +01:00
Jens Johansen 98e96e2a29 Initialize boolean to fix checked mode error.
Vvoid 'boolean expression must not be null' error in checked mode.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2619983002 .
2017-01-10 10:41:08 +01:00
Jens Johansen 3f55b8e2b7 Non-format-changing kernel offset changes
Updates to kernel that sets more offsets (and introduces end offests
and 'debuggability') - but doesn't necessarily persist them,
i.e. the format doesn't change and no C++ changes are neccessary yet.

This is step #1 in introducing these things, next step(s) will be
persisting the new stuff and using it on the C++ side.

R=asgerf@google.com, kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/5edca8c4d3733f319ab2d328aa28ceb286a30904

Reopening as I reverted the change as it broke package:compiler.

Review-Url: https://codereview.chromium.org/2610133002 .
2017-01-10 09:16:19 +01:00
Jens Johansen 5215ec6ef2 Revert "Non-format-changing kernel offset changes"
The commit breaks package:compiler.

This reverts commit 5edca8c4d3.

BUG=

Review-Url: https://codereview.chromium.org/2614663007 .
2017-01-05 14:19:23 +01:00
Jens Johansen 5edca8c4d3 Non-format-changing kernel offset changes
Updates to kernel that sets more offsets (and introduces end offests
and 'debuggability') - but doesn't necessarily persist them,
i.e. the format doesn't change and no C++ changes are neccessary yet.

This is step #1 in introducing these things, next step(s) will be
persisting the new stuff and using it on the C++ side.

R=asgerf@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2610133002 .
2017-01-05 13:25:46 +01:00
Asger Feldthaus 0546f6b4b7 Support generic method syntax in kernel pipeline.
Closes https://github.com/dart-lang/sdk/issues/28231
Closes https://github.com/dart-lang/sdk/issues/28238

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2613683003 .
2017-01-04 14:25:36 +01:00
Jens Johansen 41165b47e3 Fix to closure mock.dart
program.uriToLineStarts is now program.uriToSource.

BUG=
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2609183002 .
2017-01-04 12:36:46 +01:00
Jens Johansen aecb572d76 Include source in kernel.
- For now include source uncompressed.
- When running from kernel, use token position 0
  (i.e. dummy, but 'real' position) as start and end on functions
  and classes to enable Observatory to run with the dill file.
- Debugging does not work, but one can browse the source in
  Observatory.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2587673004 .
2017-01-03 14:33:16 +01:00