Commit graph

159 commits

Author SHA1 Message Date
Samir Jindel e80b42a235 Fix parsing of ClosureCreation kernel nodes in VM.
Summary:

Previously, the VM would crash when it encountered a ClosureCreation node
because it was not aware of the new type arguments field.

Now, it skips the type arguemnts field, which allows many tests to pass again,
even though it doesn't correct forward the type arguments at runtime.

Test Plan:

Removed expected failure lines for all the tests added in my prior
CL (introducing the new field).

BUG=
R=dmitryas@google.com, jensj@google.com

Reviewers: dmitryas@google.com
Review-Url: https://codereview.chromium.org/2987143002 .
2017-08-03 16:42:57 +02:00
Zhivka Gucevska a04c14da7d Add support for redirecting constructors
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2984423002 .
2017-08-03 11:12:16 +02:00
Zhivka Gucevska 4aab6a4a49 Add support for super initializers in constructor initializer list
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2990943002 .
2017-08-03 09:00:16 +02:00
Zhivka Gucevska 2331199968 Add support for field initialization in objects
Fields declared as T f = E are now initialized to the value
expression E evaluates to.
Fields without initalizer expression are intialized with null.

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2985883002 .
2017-07-27 13:47:12 +02:00
Samir Jindel ff0c3936a1 Revert "Revert "Preserve type variables in closure conversion.""
This reverts commit fd4a0c658f.
2017-07-26 13:27:35 +02:00
Samir Jindel fd4a0c658f Revert "Preserve type variables in closure conversion."
This reverts commit 4d7490c609.
2017-07-26 12:44:15 +02:00
Samir Jindel 4d7490c609 Preserve type variables in closure conversion.
Summary:

Previously, we filled in all occurrences of captured type variables with either
"dynamic" or their bound, if they had one.

Now, we add extra type parameters to the top-level function corresponding to the
closure, and pass in the corresponding arguments as type arguments to the
"MakeClosure" operation.

Test Plan:

Updated [type_variables.dart] and added a new test case to it.

R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2989563002 .
2017-07-26 12:43:02 +02:00
Dmitry Stefantsov 08e91e07b7 Enable Run step in closure-conversion test suite
R=sjindel@google.com

Review-Url: https://codereview.chromium.org/2984963002 .
2017-07-25 14:02:52 +02:00
Dmitry Stefantsov 5475240725 Add support for converted closures with explicit contexts to VM
The closure-conversion transformation is not enabled yet.  This commit
only adds the support for it to FlowGraphBuilder and
StreamingFlowGraphBuilder.  More work should be done before enabling the
transformation; most mportantly, the 'platform.dill' file that is used
in the Kernel isolate and is loaded by VM for linking with executed
programs should be separated.  The former should receive a file not
touched by the transformation, and the latter should receive a
transformed one.

BUG=
R=jensj@google.com, karlklose@google.com, kustermann@google.com

Review-Url: https://codereview.chromium.org/2891053003 .
2017-07-21 11:45:15 +02:00
Zhivka Gucevska 1288ece5c8 Introduce statement continuations following the specification
The next statement to be executed is captured by a statement
continuation.

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2975173002 .
2017-07-18 13:03:39 +02:00
Sigmund Cherem 98d057075a Add missing import: fix warning introduced in last CL
TBR=paulberry@google.com

Review-Url: https://codereview.chromium.org/2979093002 .
2017-07-14 15:42:11 -07:00
Sigmund Cherem 4ad4f985af Move reify to use fasta instead of dartk
Note the suite seemed to have a lot of tests crashing in verification.

With my change I'm noting other crashes, but I haven't investigated where they are from.

Also, to run the suite, before it used to be run as:

  dart pkg/kernel/test/reify/suite.dart

Now it needs to be run as:
  DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/dart pkg/kernel/test/reify/suite.dart

BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2981813002 .
2017-07-14 15:04:43 -07:00
Samir Jindel a459f73fac Convert closures in all initializers, and share the context between them.
Summary:

Previously, we only handled `FieldInitializer` and `LocalInitializer`.

Now we handle all initializers.

Previously, we would create separate contexts for each initializers, which was
incorrect because it changes made to an argument from a closure within one
initializer would not be seen by a closure within another.

Now, we create the context in a `LocalInitializer` so all initializers will see
the same copy of the argument variables.

There is still an outstanding issue where variables introduced as local
initializers and later captured by closures in subsequent initializers are not
placed into the context. However, this will at least trigger an assert in the closure conversion pass.

Test Plan:

'closures_initializers/initializers.dart(.expect)' has been updated with very
simple test cases for super and redirecting initializers. The second bug
mentioned (captured local initializers) has not been reproduced yet.

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2981603002 .
2017-07-14 10:59:17 +02:00
Konstantin Shcheglov 00d5012906 Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt.
...instead of mixing formatting with actual changes in many CLs.

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

Review-Url: https://codereview.chromium.org/2975253002 .
2017-07-13 16:28:18 -07:00
Sigmund Cherem 03bc29f24c Remove uses of internal API in closures_initializers suite.
I had removed the uses in other suites, but this suite got added while my CL was
being reviewed. I didn't notice this new case until today.

R=paulberry@google.com
CC=ahe@google.com,dmitryas@google.com

Review-Url: https://codereview.chromium.org/2981663002 .
2017-07-12 13:46:30 -07:00
Konstantin Shcheglov b985f3c000 Rename TranslateUri to UriTranslator, rename files, extract Impl.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2982593002 .
2017-07-12 11:56:14 -07:00
Peter von der Ahé 9236a3445e Deprecate all diagnostics methods that use strings.
See #30080.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2970273004 .
2017-07-10 11:23:09 +02:00
Samir Jindel 4df146dd9a Revert "Fix closure conversion in field and local initializers."
This reverts commit a49dcb6bb1.

Committed: a7d1837d3d
Review-Url: https://codereview.chromium.org/2974673002 .
2017-07-10 10:12:45 +02: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
Samir Jindel a7d1837d3d Revert "Fix closure conversion in field and local initializers."
This reverts commit a49dcb6bb1.

Review-Url: https://codereview.chromium.org/2974673002 .
2017-07-07 18:42:51 +02:00
Samir Jindel a49dcb6bb1 Fix closure conversion in field and local initializers.
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2971293002 .
2017-07-07 17:48:38 +02:00
Dmitry Stefantsov b1e629f078 Add tests for handling closures in LocalInitializers
BUG=https://github.com/dart-lang/sdk/issues/29887
R=sjindel@google.com

Review-Url: https://codereview.chromium.org/2944433002 .
2017-07-06 16:39:25 +02:00
Paul Berry be01632bc0 Fix type inference of getters that "override" setters and vice versa.
Normally getters and setters are considered distinct and unrelated by
the type inference algorithm.  However, if a getter has no declared
type and doesn't override anything, then we fall back on inferring its
type from an inherited setter, and vice versa.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2946733003 .
2017-06-20 05:34:31 -07:00
Konstantin Shcheglov bcf179c9fa Add the 'crossGettersSetters' flag to ClassHierarchy.forEachOverridePair().
We need to be able to get 'overrides' of setters with getters and vise
versa to support top-level inference.

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

Review-Url: https://codereview.chromium.org/2941363002 .
2017-06-17 18:32:44 -07:00
Dmitry Stefantsov 5982ace801 Add transformLibraries for closure conversion
Closure conversion can now be run on a part of a program.  It allows
using closure conversion in kernel-isolate.  It comes at a cost of
temporarily sacrificing implementation of tear-offs via closures; VM
mechanism for tear-offs is used for now.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2938773003 .
2017-06-15 14:18:10 +02:00
Dmitry Stefantsov 32eed0892d Update expectations for closure conversion tests
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2935223003 .
2017-06-14 11:03:46 +02:00
Konstantin Shcheglov cf59b1a0f9 Remove ClassHierarchy factory constructor.
KernelTarget already uses IncrementalClassHierarchy, and other clients
either need ClosedWorldClassHierarchy, so should explicitly create it,
or don't care, and can be switched to IncrementalClassHierarchy.

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

Review-Url: https://codereview.chromium.org/2930973002 .
2017-06-08 18:42:22 -07:00
Konstantin Shcheglov 5fe793ec4e Use ClassHierarchy.applyChanges() in MixinFullResolution.
So, we let the hierarchy to decide how to react to the changes, and
instance of which class hierarchy to create.

This makes initial compilation with Kernel Driver about 5% faster.

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

Review-Url: https://codereview.chromium.org/2924333002 .
2017-06-08 14:00:51 -07:00
Dmitry Stefantsov 09e755196a Pass a Target instance to DillTarget instead of its name
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2924833002 .
2017-06-06 16:03:49 +02:00
Konstantin Shcheglov 8ec1f95af6 Replace ClassHierarchy.classes with getOrderedClasses().
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2924713002 .
2017-06-05 20:23:13 -07:00
Konstantin Shcheglov 64ce51ce4b Fix the test and implement forEachOverridePair() for IncrementalClassHierarchy.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2920323002 .
2017-06-05 13:11:29 -07:00
Konstantin Shcheglov 71b1905265 Fix the test for ClassHierarchy.getDispatchTarget().
The blame was placed incorrectly - it was a bug in the test itself.
We need both empty FunctionBody and isAbstract flag for Procedure.

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

Review-Url: https://codereview.chromium.org/2925573002 .
2017-06-05 10:42:21 -07:00
Konstantin Shcheglov 5cf61cb0dc Implement getInterfaceMember() for IncrementalClassHierarchy.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2916383003 .
2017-06-03 18:52:00 -07:00
Konstantin Shcheglov 952687a64f Implement getDispatchTarget() in IncrementalClassHierarchy.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2916403002 .
2017-06-02 13:58:26 -07:00
Konstantin Shcheglov 99363d42d0 Implement getClassicLeastUpperBound() in IncrementalClassHierarchy.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2921083002 .
2017-06-02 13:46:58 -07:00
Konstantin Shcheglov c2b5ae00ce Implement getClassAsInstanceOf() and getTypeAsInstanceOf() for IncrementalClassHierarchy.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2915263003 .
2017-06-02 11:54:47 -07:00
Konstantin Shcheglov 4301ce842a Implement IncrementalClassHierarchy.getRankedSuperclasses().
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2916323002 .
2017-06-02 09:15:44 -07: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 65c1f5f8ab Start implementing IncrementalClassHierarchy.
Only getClassDepth() for now.

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

Review-Url: https://codereview.chromium.org/2922533002 .
2017-06-01 15:01:51 -07:00
Konstantin Shcheglov d91ba05859 Additional tests for ClassHierarchy.forEachOverridePair().
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2918663006 .
2017-06-01 14:51:14 -07:00
Konstantin Shcheglov 717937a180 Add the more complex LUB test.
Peter asked to a more complex test.

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

Review-Url: https://codereview.chromium.org/2916093003 .
2017-06-01 14:46:20 -07:00
Konstantin Shcheglov 00f97489cf Remove the ClassHierarchy.rootClass getter.
According to the language specification the root class is always
equivalent to the Object class.

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

Review-Url: https://codereview.chromium.org/2919833002 .
2017-06-01 11:56:46 -07: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 463275881d Replace modelled Dart code comments with Kernel text validation.
Paul, do you want to keep ASCII hierarchies, or the text provides
enough information / easy to read?

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

Review-Url: https://codereview.chromium.org/2920563002 .
2017-05-31 13:09:36 -07:00
Konstantin Shcheglov e94a8e1367 Start adding unit tests for ClassHierarchy.
I need these tests in order to be sure that I understand expectations
of the ClassHierarchy interface, and to be able to test a lazy
implementation I'm going to create for incremental kernel generator.

I moved lub_test tests into this wider test suite.

Tests for forEachOverridePair() are not complete yet, just one path
is tested.

If there are any additional cases that you think should be covered,
please let me know.

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

Review-Url: https://codereview.chromium.org/2912173002 .
2017-05-31 11:31:36 -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