Commit Graph

68 Commits

Author SHA1 Message Date
Samir Jindel bc9645509e Revert "Revert "[kernel] Fix NoSuchMethod errors for generic functions.""
This un-revert fixes the issues revealed in https://logs.chromium.org/v/?s=chromium%2Fbb%2Fclient.dart%2Fvm-kernel-mac-release-x64-be%2F2217%2F%2B%2Frecipes%2Fsteps%2Fvm_tests%2F0%2Fstdout.

Patchset 1 contains the original revision unmodified.

This reverts commit 9029ee09c5.

Bug:
Change-Id: I109c011c2688144b00293ce50b3aad53e018a2f2
Reviewed-on: https://dart-review.googlesource.com/18340
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-06 17:07:38 +00:00
Samir Jindel 9029ee09c5 Revert "[kernel] Fix NoSuchMethod errors for generic functions."
This reverts commit 52e1466588.

Bug:
Change-Id: Ic1b37a5df2f50ede4f6873b6d2a701663673bcbb
Reviewed-on: https://dart-review.googlesource.com/18261
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-02 16:52:32 +00:00
Samir Jindel 52e1466588 [kernel] Fix NoSuchMethod errors for generic functions.
Bug:
Change-Id: I8ad90e34a7b1f77b29f1d711f158bcb69f5928f4
Reviewed-on: https://dart-review.googlesource.com/17941
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-02 15:16:08 +00:00
Jason Simmons 81c8e2bfc4 Remove Flutter diagnostic server
Bug:
Change-Id: I729f60ad310c3d864273687fe46b9b93d4696772
Reviewed-on: https://dart-review.googlesource.com/16882
Reviewed-by: Alexander Aprelev <aam@google.com>
2017-10-27 03:50:59 +00:00
Karl Klose 51089b53cd Remove strong mode type check insertion transformations
Change-Id: I7f4bb08b32b0ecf5af4d60af0a5b5b3a2e41c49a
Reviewed-on: https://dart-review.googlesource.com/16482
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Karl Klose <karlklose@google.com>
2017-10-26 07:32:00 +00:00
Alexander Markov 1d629221d1 Wrap the description of an option to fit within 80 columns
This is the follow-up for review comment

https://dart-review.googlesource.com/c/sdk/+/15644/2/pkg/kernel/lib/target/implementation_option.dart#10

to the CL 34df7f3599.

Change-Id: If0c17e36bbfb42df0aa410b04e5830ebd979d3cd
Reviewed-on: https://dart-review.googlesource.com/16301
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-10-25 17:27:49 +00:00
Alexander Aprelev b6d7ad59dc Include dart:diagnostic_server into flutter patched sdk.
Bug: https://github.com/dart-lang/sdk/issues/31145
Change-Id: Id9cd5e484d108f62d1008cd07dc3d4e0eb05d598
Reviewed-on: https://dart-review.googlesource.com/15920
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-10-23 21:29:09 +00:00
Alexander Markov 34df7f3599 Wire up strong-aot implementation option
This CL adds handling of previously introduced 'strong-aot'
implementation (target-specific) option into VM target.

After this change, it will be possible to enable strong-mode
whole-program optimizations in Flutter (in addition to standalone VM).

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I054b75ce4ba1b9bcf150e0b7f25fa7ca1bdd187e
Reviewed-on: https://dart-review.googlesource.com/15644
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-10-23 16:57:17 +00:00
Samir Jindel dd0d299dcb [kernel] Un-revert support for generic function types and removing type erasure.
Change-Id: I8032e4622a0756199528a61fdb59f3d0ec132d1f
Reviewed-on: https://dart-review.googlesource.com/14202
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-10-16 23:17:09 +00:00
Régis Crelier ae94cbf3d6 Revert "[kernel] Support generic closures in VM's kernel frontend."
This reverts commit a273ff8314.

Revert "[kernel] Support generic function types in the VM's kernel frontend."

This reverts commit 2cac57da09.

Revert "[kernel] Completely remove type erasure."

This reverts commit 3ffacb3814.

Change-Id: I8fdd40a6a8f34911028353f48249fdd4bf7dba76
Reviewed-on: https://dart-review.googlesource.com/13622
Reviewed-by: Alan Knight <alanknight@google.com>
Commit-Queue: Alan Knight <alanknight@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2017-10-12 20:01:11 +00:00
Samir Jindel 3ffacb3814 [kernel] Completely remove type erasure.
Bug:
Change-Id: I146db24f3f745d9f87560b051f3e57b784de1cb4
Reviewed-on: https://dart-review.googlesource.com/12294
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-12 15:34:21 +00:00
Alexander Aprelev 87538ffd7e Add vmservice_sdk to target as it is needed in platform.dill to be included into app dill file for Flutter release gen_snapshot
Bug:
Change-Id: I699768ef6f3a315d497bc65c7d713d0c538313ca
Reviewed-on: https://dart-review.googlesource.com/12783
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-10-10 21:18:06 +00:00
Alexander Markov 9ee73fe322 [Kernel] Remove outdated and duplicated front-end Targets
This CL replaces outdated VmTarget and FlutterTarget with VmFastaTarget
and FlutterFastaTarget. 'Fasta' suffix is droped from target names.

The new FlutterTarget extends VmTarget, so they share more code.

Change-Id: Id79956698a889c9a49b8a67914f1f96a731407ab
Reviewed-on: https://dart-review.googlesource.com/9423
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-04 18:02:49 +00:00
Peter von der Ahé 086f389959 Implementation options with expiration date.
Change-Id: Ie71ca21fb37a036f32fe8ee3348e95ee02089ac7
Reviewed-on: https://dart-review.googlesource.com/9542
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-04 07:47:52 +00:00
Régis Crelier db8b20107b Revert "Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError.""
This reverts commit 8cf9ef22c4.

The expectations in Dart2js and Kernel tests have now been updated.

Change-Id: I9d65ff207490cfc783849b1b726db81cf56ecfc2
Reviewed-on: https://dart-review.googlesource.com/9124
Reviewed-by: Régis Crelier <regis@google.com>
2017-09-28 00:27:24 +00:00
Régis Crelier 8cf9ef22c4 Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError."
This reverts commit db15f5d73b.

Dart2js and Kernel tests are comparing text that has changed because of
the core lib change.

Change-Id: I1d33716a3d6e6a077aa1f1a9ad7cc37825d31fa6
Reviewed-on: https://dart-review.googlesource.com/9082
Reviewed-by: Siva Chandra <sivachandra@google.com>
2017-09-27 21:08:20 +00:00
Régis Crelier db15f5d73b Dart Core Lib change to support generic functions in class NoSuchMethodError.
Change-Id: If7d1a8c07e4bee7ec68fede80a9d17cae0044d31
Reviewed-on: https://dart-review.googlesource.com/5329
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-09-27 17:57:41 +00:00
Alexander Markov 1989edb06e [kernel] Add VM precompiler target and devirtualization optimization
This CL adds a new target for kernel front-end, vm_precompiler. This is
an experimental target for new Dart VM precompiler pipeline which
will fully exploit strong mode type system and perform whole-program
optimizations.

As an example of such whole-program optimization, this CL adds
draft implementation of devirtualization of method invocations, which
uses single target computed by closed-world class hierarchy analysis.
Corresponding null checks (required for correctness) are not generated
yet.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I704cd16843a08f036a188b1188c80ee4dfbeab3b
Reviewed-on: https://dart-review.googlesource.com/3402
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-07 16:54:33 +00:00
Sigmund Cherem e1bccfc857 FE: let targets override whether imports to internal platform
libraries (dart:_foo) are allowed.

Override this in Dart2jsTarget to allow it in the dart2js_native test suite.

R=sra@google.com

Review-Url: https://codereview.chromium.org/2992073002 .
2017-07-31 15:23:12 -07:00
Sigmund Cherem c720c776e0 Add native extension to flutter targets (this was removed accidentally in an
earlier CL, I had assumed flutter targets simply extended the VM targets).

Fixes #30118

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

Review-Url: https://codereview.chromium.org/2980513002 .
2017-07-10 10:55:34 -07:00
Sigmund Cherem b71bd543a9 Reapply "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service.""
Original CL had a bug that wasn't visible unless you delete your
out/ReleaseX64/patched_sdk folder.

Patchset #1 is the original CL, patchset #2 shows the fix.

This reverts commit 4aadfe09df.

BUG=

Review-Url: https://codereview.chromium.org/2976543002 .
2017-07-07 15:32:24 -07:00
Sigmund Cherem 4aadfe09df Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service."
Reason: broke VM bots, still investigating.

This reverts commit 610d081947.

TBR= paulberry@google.com

Review-Url: https://codereview.chromium.org/2979463002 .
2017-07-07 15:21:37 -07:00
Sigmund Cherem 610d081947 Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service.
This CL tweaks the public APIs in package:front_end, and
starts using those APIs outside the package. For example, this
removes 9 uses of DillTarget, so it is not longer mentioned
outside pkg/front_end and the analyzer_target.

Actual changes:
 - in package:front_end

   * added kernel_generator_impl: new file contains code that
     used to be in kernel_generator. Code has some modifications:
     it uses a single canonical-root when loading summaries, and
     it supports generating both outlines and kernel in one go.

   * removed code that didn't belong here:
     a. most of calculating deps for .GN moved to patch_sdk
     b. vm-specific outcomes moved to kernel-service

   * updated how `native` is implemented, so we can more easily
     support dart2js and ddc

   * updated how we check where `int`, `bool`, etc can be implemented.

   * added support "hermetic mode" in modular builds
     ('chaseDependencies = false' option)

   * moved `trim` step out of fasta, and for now call it only within
     the public API. This is not yet exposed, and I stopped covering it in
     most tests (now only covered in shaker tests). The plan is to add
     tests for the public API covering this in the future.

   * removed `uriToSource` when serializing outlines

   * added unit tests for public APIs

 - patch_sdk
   * use the public API to craete platform.dill, outline.dill (now
     500K insted of 3Mb because it excludes sources), and vmservice_io.dill
   * moved here logic internal to .GN

 - kernel service
   * use the public API
   * moved here logic that depends on VM internals (e.g. status enum,
     compilation results)

 - package:compiler
   * use the public API in tools and unit tests
   * simplified patched-sdk generation: no more extending fasta's internals

 - package:kernel
   * fix bug in deserialization: initializers and other lists were
     overwritten accidentally with external definitions.
   * updated unit tests, moved shared logic to frontend/src/fasta/testing

R=johnniwinther@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2953703002 .
2017-07-07 15:14:22 -07:00
Paul Berry 7ee5d4b3a2 Create an option to disable type inference and type promotion.
This is intended for profiling, to ensure that type inference and type
promotion do not slow down compilation too much.

Currently the option is just plumbed through to the kernel Target
class since I'm not exactly sure how we'll want to enable/disable this
option; we can plumb it the rest of the way in a future CL.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2962913002 .
2017-06-29 05:31:06 -07:00
Sigmund Cherem f5a03eb0ef fix bot: remove analyzer error
(I'm not sure why I didn't see this error before submitting)

TBR=aam@google.com

Review-Url: https://codereview.chromium.org/2940863004 .
2017-06-14 21:34:15 -07:00
Sigmund Cherem 5a63b0e339 Add flutter mode to patched_sdk
This is needed to create a platform.dill for flutter.

R=aam@google.com

Review-Url: https://codereview.chromium.org/2931773003 .
2017-06-14 17:29:36 -07:00
Siva Chandra a879f91420 Remove dart:_vmservice and dart:vmservice_io from platform.dill.
A mirrors test which now passes has been removed from the blacklist.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2931193002 .
2017-06-13 13:49:38 -07:00
Peter von der Ahé 14e9d0bd89 Prepare for improved error recovery from compile-time errors.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2931423002 .
2017-06-13 15:59:18 +02:00
Peter von der Ahé d6a766bb14 Improve NSM handling.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2927613002 .
2017-06-07 09:28:13 +02:00
Dmitry Stefantsov 1e2f06f8da Reapply "Use backend targets to run Kernel transformations in Fasta"
This reverts commit 0b424ca5d2

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2919003003 .
2017-06-02 16:10:28 +02:00
Dmitry Stefantsov 0b424ca5d2 Revert "Use backend targets to run Kernel transformations in Fasta"
This reverts commit 8ff762067a.

TBR=ahe@google.com

Review-Url: https://codereview.chromium.org/2918923003 .
2017-06-02 12:45:34 +02:00
Dmitry Stefantsov 8ff762067a Use backend targets to run Kernel transformations in Fasta
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2918623004 .
2017-06-02 10:40:13 +02:00
Konstantin Shcheglov 5bdfd1e69b Pass ClassHierarchy instead of creating it.
MixinFullResolution is also updated to create new ClassHierarchy
instance only if there are transformed classes. This improves
incremental kernel generator initial time from 22 to 16 seconds.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2918593003 .
2017-06-01 07:20:13 -07:00
Konstantin Shcheglov 3803374d32 Don't recreate CoreTypes in transformers. Pass it in.
The same will be done later for ClassHierarchy. So, it would be up to
the client to decide which flavour to create, and whether the same
instance can be reused.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2904203003 .
2017-05-31 09:54:27 -07:00
Konstantin Shcheglov 0dd81884bf Perform MixinFullResolution only for source libraries.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2912503003 .
2017-05-30 09:33:26 -07:00
Peter von der Ahé 4fddc2e4d5 Move code for instantiating Invocation to Target.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2897683002 .
2017-05-22 15:59:06 +02:00
Kevin Millikin 04f7ba272a Remove the Kernel setup_builtin_library transformation
This transformation replaces the body of _getMainClosure in
dart:_builtin with `return main` for the script's main if there is one
and removes the body if there is no main.

Without this transformation fasta will compile `return null` and dartk
will compile `return throw new NoSuchMethodError...`.  Both of these
patterns will be patched in the VM when dart:_builtin is compiled from
Kernel.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2861023002 .
2017-05-04 20:29:44 +02:00
Ryan Macnak dd6140f61b Remove dart:jni library in FlutterTarget
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2793703002 .
2017-03-31 15:55:00 -07:00
Jacob Richman d1fa3c67af Run dartfmt on kernel package
BUG=
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2747113004 .
2017-03-17 08:21:52 -07:00
Dmitry Stefantsov b87a479c2b Pass type arguments as a list in generic methods invocations
All generic methods are equipped with one extra named parameter for
passing type arguments as a list of type values.

Additinally, this change forces strong mode usage for 'dartk' in
'reified_dart'. Strong mode is required for loader to not strip away
type arguments from generic methods. In future, a command line argument
may be implemented for that (e.g. --generic-methods), if generic method
support will land before the strong mode.

R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2713163002 .
2017-03-16 10:47:11 +01:00
Asger Feldthaus 8bfc4b47c0 Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member.  All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.

dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.

dartk now has a flag --include-sdk which includes the entire SDK in
the output.  This is so the SDK can be compiled alone and then linked.

Example of compiling separately and then linking:
  dartk foo.dart -o foo.dill
  dartk main.dart -o main.dill
  dartk --include-sdk -o sdk.dill
  dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill

dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.

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

Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 14:12:10 +01:00
Dmitry Stefantsov d5e2fcb430 Merge the work on Generic Types Reification from 'dart-lang/reify' repo
This CL adds the work done at https://github.com/dart-lang/reify to SDK.
The commit that is used for the merge is
a2066a68374d49de92ff75f5e1ffc36335fd9451 (Nov 23, 2016). The code is
adjusted to respect the changes of the kernel package in SDK since that
commit.

The reify transformation is run by specifying 'vmreify' target to
'dartk'. The transformation requires its runtime library to present in
the program being transformed. The library is found in its default
location in SDK checkout if 'dartk' is run from its default location in
SDK checkout. To preserve the library in the output, TreeShaker is
disabled in 'vmreify' target.

The "golden" set of tests is also copied from 'dart-lang/reify'
repository, and the appropriate test suite is defined for it.

The bash script 'bin/reified_dart' from 'dart-lang/reify' is rewritten
as Dart script 'pkg/kernel/bin/reified_dart.dart'. It requires path to
'dartk' and path to SDK. Those are taken from their default locations in
SDK if 'reified_dart.dart' is run from its default location in SDK.

The added files were formatted using 'dartfmt' with default settings.
Additionally, the files were checked with 'dartanalyzer --strong'. The
necessary changes were made to fix the error messages. There are some
'hint' and 'error' messages left for some .dart files from the added
test cases, but they reflect intentional errors or conventions in those
files.

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

Review-Url: https://codereview.chromium.org/2697873007 .
2017-02-17 14:19:29 +01:00
Asger Feldthaus ac3e8cb7b3 Support for modular mixin resolution.
When a class from a different build unit is mixed in, the instance
members of the mixed-in class are retained in the external library
definition, so the mixin resolution pass can clone them.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2669303002 .
2017-02-13 14:20:04 +01: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
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
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 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