Commit Graph

15 Commits

Author SHA1 Message Date
Asger Feldthaus 564970c10e [kernel] Refactor frontend to allow modular compilation.
The concept of a binary library file no longer exists.

A kernel file can contain any number of libraries, and some of these
libraries can be "external".  To reference a class or member from
another build, the class or member must be declared in an external
library.

Members in an external library contain all their type information,
but have no body.

Classes in an external library have their hierarchy information
present, but are not guaranteed to contain all their actual members.

The idea is that references themselves don't really cross module
boundaries, but rather refer to a local definition whose body is
contributed from elsewhere, much like 'external' members in Dart.

A modular backend such as DDC should be able to compile from one of
these kernel files without needing to load auxiliary information from
summaries or other kernel files.

For whole program transformations or backends, a linking step, which
is not yet implemented, must merge classes and members in external
libraries based on their name.

External libraries share the same IR and binary format as ordinary
libraries.  Transformations that affect the interface for a member
or class should transform the external libraries alongside with the
internal ones, ideally without needing to treat them any different.

R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/516847013 .
2016-10-04 13:30:46 +02:00
Jens Johansen 43b8443f0d [kernel] Dill source file and source position inclusion
For now the focus is on getting stacktraces to look right.
What that basically means is to include source positions for throws,
calls (in many forms).

Includes source file uri for libraries, field, classes and methods.
Methods and fields for instance needs it because of top-level
procedures that might be included via 'parts'.

Corresponding kernel-sdk change in review at
https://chromereviews.googleplex.com/516617014

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

Review URL: https://chromereviews.googleplex.com/509247013 .
2016-09-29 11:26:40 +02:00
Asger Feldthaus a91cae8bb4 [kernel] Remove the ?? operator from the IR and desugar it in the frontend.
Note that this affects the binary format, since a type is no longer
stored on LogicalExpression.

R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/502297014 .
2016-09-23 12:52:00 +02:00
Asger Feldthaus 998e581d90 [kernel] Update binary.md
BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/499387013 .
2016-09-08 15:53:07 +02:00
Asger Feldthaus 9a3c54e0e9 [kernel] Revert "Insert dynamic when type arguments are omitted from redirecting factory."
This reverts commit 9d9d61ec4649b159ed3bbe1c2a486d98e7bf07ea.

BUG=

Review URL: https://chromereviews.googleplex.com/502317013 .
2016-09-08 15:35:20 +02:00
Asger Feldthaus f7fd49e0f1 [kernel] Insert dynamic when type arguments are omitted from redirecting factory.
BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/500317013 .
2016-09-08 14:24:42 +02:00
Asger Feldthaus 062cb17ec4 [kernel] Strong mode: add interface targets and resynthesis of expression types.
The interface target can now be stored on PropertyGet, PropertySet, and
MethodInvocation  If set, we know the concrete target overrides or
implements that member.

All expressions have a method getStaticType for computing its type,
which relies on interface targets for the expressions that have one.

Expressions whose type is a least upper bound have the type stored
explicitly, so the definition of least upper bounds is contained only
in the frontend.

This is a work in progress towards strong mode support, it is still
not complete.

Still missing in the frontend:
- checks from implicit downcasts
- parameter checks from covariant override or covariant generics

Implemented but not part of this CL:
- subtype tests
- IR type checker (for debugging)

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/496717014 .
2016-09-06 11:40:13 +02:00
Asger Feldthaus 760baa3b55 [kernel] Make mixin and super resolution a transformation.
This makes super calls name-based (no target) and add direct calls with
both receiver and explicit target.

Super call resolution translates the name-based super calls into direct
calls after they have been cloned into the mixin application.

For JS backends, it should suffice to clone mixed-in methods that
contain super calls, but that transformation is not part of this CL.

This also adds a --target option to dartk designating the target to
which the kernel IR should be specialized.  The new transformation
is run when --target=vm.

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/486537013 .
2016-08-24 16:46:50 +02:00
Asger Feldthaus 4c82d6853e [kernel] Support metadata annotations on classes and members.
BUG=
R=jensj@google.com, kustermann@google.com, vegorov@google.com

Review URL: https://chromereviews.googleplex.com/481447014 .
2016-08-09 16:32:23 +02:00
Asger Feldthaus f13be3e4bc [kernel] Add LocalInitializer and move super calls last in initializer lists.
LocalInitializer lets us to bind temporaries to variables in the
initializer list.  We use it to ensure the arguments to super() are
evaluated at the right time.

accessors.dart and the new file super_calls.dart have been moved into
a folder "frontend" for frontend helpers that operate on Kernel IR.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/457457013 .
2016-06-28 14:27:01 +02:00
Asger Feldthaus 638b4bfaff [kernel] Normalize DartTypes to 'dynamic' instead of 'null' when omitted.
For constructor bodies, we arbitrarily set the return type to 'void'.

Although there is hardly any legitimate use for the "return type" of
a constructor, this doesn't have any overhead and it simplifies the
restriction on FunctionNode.

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/446827013 .
2016-06-06 15:01:51 +02:00
Asger Feldthaus 49746d5092 [kernel] Remove ProcudureKind.IndexGetter and IndexSetter.
They are now ProcedureKind.Operator.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/433267013 .
2016-05-27 11:27:19 +02:00
Asger Feldthaus a117d3f8f7 [kernel] Add 'const' modifier to StaticInvocation.
This is to distinguish constant calls to an external constant factory.

This changes the binary format.
2016-04-28 12:58:42 +02:00
Asger Feldthaus 6f060282f4 [kernel] Support external constant factories such as String.fromEnvironment.
Also fixes a bug in translation of factory calls.
2016-04-28 12:29:40 +02:00
Asger Feldthaus 811a47d430 [kernel] Initial implementation of Dart Kernel.
Contains:
- Command-line tool
- Kernel AST
- Binary serialization
- Printing as text
- Frontend based on analyzer
- Class hierarchy and type algebra
2016-04-26 10:39:15 +02:00