Commit Graph

323 Commits

Author SHA1 Message Date
Zhivka Gucevska 4f59c41c5f Remove state for expression evaluation
BUG=
R=dmitryas@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2833733003 .
2017-04-21 10:11:06 +02:00
Jacob Richman 997b4e62af Run formatter on a few frontend and kernel files that hadn't been formatted.
BUG=
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2820323005 .
2017-04-20 09:25:13 -07:00
Zhivka Gucevska b00a85231e Parametrize over the additional agrument type for StatementVisitor1 and ExpressionVisitor1
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2835453002 .
2017-04-20 18:03:15 +02:00
Zhivka Gucevska feb38e4c8b Implement expression evaluation in Coninuation Passing Style
This enables support for Return statements.

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

Review-Url: https://codereview.chromium.org/2806483003 .
2017-04-20 15:22:33 +02:00
Peter von der Ahé 6b150cb01f Verify rethrow and parents of variables.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2800853005 .
2017-04-07 12:59:03 +02:00
Peter von der Ahé ddda182957 Add Source.getTextLine and use it to display source snippets in error messages.
R=asgerf@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2788373002 .
2017-04-05 15:02:49 +02:00
Zhivka Gucevska c91fd31036 Implement flow control with breaks
BUG=
R=dmitryas@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2790063002 .
2017-04-05 13:00:44 +02:00
Zhivka Gucevska f420d1bef5 Update documentation for InvocationExpression and implicit setters
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2790063005 .
2017-04-05 12:19:34 +02:00
Zhivka Gucevska b01acf32d7 Fix Setter lookup
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2795883003 .
2017-04-04 14:52:50 +02:00
Kevin Millikin 04cb9809d1 Restructure the Kernel string table.
Instead of a list of strings given by their length and UTF-8 encoding,
restructure the string table to consist of a list of string ending
offsets followed by a blob of UTF-8 encoded strings without lengths.

This is a step toward copying the string blob into the VM's heap and
building a heap-allocated structure to give random access to them.

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

Review-Url: https://codereview.chromium.org/2790073004 .
2017-04-04 13:04:25 +02:00
Martin Kustermann d8e291cb89 [kernel] vm: Fix a few issues in the kernel flow graph builder, update status file for checked-mode
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2792033002 .
2017-04-03 19:47:01 +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
Emily Fortuna 6b398ef91c Allow dartk to print out binary Kernel IR results to stdout if requested.
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2784303003 .
2017-03-31 10:48:09 -07:00
Dmitry Stefantsov 42f82d1d21 Add primitive to create closures and use it for closure conversion
A new AST node 'ClosureCreation' is added. It takes a name of a
top-level function, a context, and a closure function type and creates a
closure of the given type. The effect of this closure invocation is the
same as of the invocation of the given top-level function with the
contexts as the first argument.

In order to use 'ClosureCreation', the closure conversion pass now
transforms closures into top-level functions, not closure classes. These
functions receive the context as the first argument.

The type of the expression represented by 'ClosureCreation' is its third
parameter. It its the responsibility of closure conversion pass to
create the correct types for 'ClosureCreation' nodes based on types of
closures transformed into top-level functions.

R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2778223002 .
2017-03-31 14:43:56 +02:00
Kevin Millikin d562f7ced5 Remove definitions from Kernel canonical names.
Before: Canonical names contained pointers to the corresponding Kernel
tree which assumed that the whole tree was in memory whenever the
canonical names were.

Now: Canonical names do not contain these pointers.  They were only
really used to perform name-based lookup in the VM's heap so the
canonical name itself is enough.

If we later find that we need to get from a canonical name to its
Kernel tree we can add an offset in the binary (for instance) to the
canonical name or in a separate mapping on the side.

BUG=
R=asgerf@google.com, jensj@google.com, vegorov@google.com

Committed: https://github.com/dart-lang/sdk/commit/ed77783cd32d55fdad61bf9bc749030847ba9384
Review-Url: https://codereview.chromium.org/2781893004 .
2017-03-30 09:31:31 +02:00
Zach Anderson a7d1d99389 Revert "Remove definitions from Kernel canonical names."
This reverts commit ed77783cd3.

BUG=
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2782913003 .
2017-03-29 11:25:17 -07:00
Kevin Millikin ed77783cd3 Remove definitions from Kernel canonical names.
Before: Canonical names contained pointers to the corresponding Kernel
tree which assumed that the whole tree was in memory whenever the
canonical names were.

Now: Canonical names do not contain these pointers.  They were only
really used to perform name-based lookup in the VM's heap so the
canonical name itself is enough.

If we later find that we need to get from a canonical name to its
Kernel tree we can add an offset in the binary (for instance) to the
canonical name or in a separate mapping on the side.

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

Review-Url: https://codereview.chromium.org/2781893004 .
2017-03-29 16:03:03 +02:00
Kevin Millikin 4de94b2d7b Await cancellation in the Kernel await transformer
When an an async for loop's StreamIterator is canceled the returned
Future should be awaited.  Closes issue 29192.

BUG=https://github.com/dart-lang/sdk/issues/29192
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2782053003 .
2017-03-29 15:20:23 +02:00
Asger Feldthaus f396d919ae Remove some additional code that depended on the old type propagation.
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2781473004 .
2017-03-28 13:51:21 +02:00
Asger Feldthaus a3402df15c [Kernel] Remove code from the old type propagation.
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2780513004 .
2017-03-28 12:43:22 +02:00
Zhivka Gucevska 1851ca685e Change layout of fields in a object values
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2781453002 .
2017-03-28 11:19:16 +02:00
Zhivka Gucevska 23cc114c2f Implements simple statement executer
This change adds support for executing:
 - BlockStatement
 - ExpressionStatement
 - IfStatement
 - VariableDeclaration

Currently only BlockStatement introduces a new environment and
VariableDeclaration modifies the environment.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2775293002 .
2017-03-28 10:23:15 +02:00
Dmitry Stefantsov 9ab86da19c Add Vector type to Kernel
There are four operations that work on Vectors: Vector creation, looking
up an item in a Vector, assigning a value to an item in a Vector, and
copying a Vector. The first three operations are allowed to only use
integer literals as number operands (length for Vector creation, index
for item lookup and assignment). Corresponding AST nodes are created for
these operations.

Vectors are used to represent contexts in Closure Conversion. The parent
context is stored as item 0 in its children contexts. The "golden" tests
for this transformation are adjusted accordingly.

The support for Vectors is added to ast-to-text, ast-to-binary, and
binary-to-ast transformations.

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

Review-Url: https://codereview.chromium.org/2767773004 .
2017-03-27 15:52:32 +02:00
Peter von der Ahé 02573b3caa Remove Fasta's copy of accessors.dart.
R=asgerf@google.com, jensj@google.com

Review-Url: https://codereview.chromium.org/2777883002 .
2017-03-27 14:04:43 +02:00
Zhivka Gucevska 02251a05eb Add support for implicit getters and setters
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2764073002 .
2017-03-24 16:04:02 +01:00
Jens Johansen a6ea038643 [kernel] offsets on direct property get/set
BUG=
R=ahe@google.com, kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/7577f6aaa052c9a1c309f13bf338b92bf4fb9fd0
Review-Url: https://codereview.chromium.org/2748333002 .
2017-03-21 14:43:45 +01:00
Zhivka Gucevska 80a334512a Add representation for object values
It also adds few operators for the Basic literals for testing purposes.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2764823002 .
2017-03-21 13:17:33 +01:00
Jens Johansen a1a34a1c84 [kernel] Debugging of switch statement
BUG=
R=ahe@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2750013002 .
2017-03-21 11:36:48 +01: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
Paul Berry 685045d619 Start unraveling circularities between analyzer and front_end/kernel.
This CL moves many of the files from
pkg/front_end/lib/src/fasta/analyzer/ to pkg/analyzer/lib/src/fasta/.
It also moves two files from pkg/kernel/lib/analyzer/ to
pkg/analyzer/lib/src/kernel/.

This reduces the amount of circularity between analyzer and
front_end/kernel so that there are no files in front_end or kernel
which are both dependend upon by analyzer and depend upon analyzer.  I
will clean up the remaining circularities in future CLs.

There should be no functional change.

R=ahe@google.com, asgerf@google.com, kmillikin@google.com, scheglov@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2756593004 .
2017-03-17 05:56:06 -07:00
Zhivka Gucevska 3f141d638f Implement visitor with 1 argument for Statements
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2740273003 .
2017-03-16 11:11:04 +01:00
Peter von der Ahé 0d83d61601 Remove unnecessary casts.
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2752823003 .
2017-03-16 10:49:47 +01: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
Jens Johansen 9fa510ea38 Revert "[kernel] offsets on direct property get/set"
This commit wanted stuff from anther CL that haven't landed yet.

This reverts commit 7577f6aaa0.

BUG=

Review-Url: https://codereview.chromium.org/2751083002 .
2017-03-15 13:54:03 +01:00
Jens Johansen 7577f6aaa0 [kernel] offsets on direct property get/set
BUG=
R=ahe@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2748333002 .
2017-03-15 13:26:45 +01:00
Jens Johansen 5e1ba94af4 [kernel] debugging for in statement
BUG=
R=ahe@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2747813003 .
2017-03-15 13:22:58 +01:00
Zhivka Gucevska bd3cfd6979 Implements support for variables and evaluation of logic expressions
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2740433006 .
2017-03-15 12:50:16 +01:00
Dmitry Stefantsov 5526d5eeca Don't create a closure class if it already exists
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2743363007 .
2017-03-15 10:04:05 +01:00
Jens Johansen 4c38b85cb5 [kernel] set dartAsyncMarker to Sync for continuations
After 89b68e905b debugging of async
functions via kernel haven't worked.
Prior to this the dartAsyncMarker for e.g. a rewritte async function
would have been Sync, after it was Yielding.
This changes it back in the continuations rewriting cases.
An alternative fix would be to change
  function.set_is_debuggable(
      kernel_procedure->function()->dart_async_marker() == FunctionNode::kSync);

to something like
  function.set_is_debuggable(
      kernel_procedure->function()->dart_async_marker() == FunctionNode::kSync ||
      kernel_procedure->function()->dart_async_marker() == FunctionNode::kYielding);

in the C++ code.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2743283002 .
2017-03-13 14:37:03 +01:00
Peter von der Ahé 4f6d58fc50 Implement nested switches and missing switch continue targets.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2746923002 .
2017-03-13 13:52:39 +01:00
Jens Johansen a58fe4898d [Fasta] include source code in dill
At least for now, only when passing --include-source

BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2729913005 .
2017-03-07 15:48:25 +01:00
Jens Johansen 9837563cd1 Kernel debugging; service tests
- Offsets on more stuff
- Status file for kernel
 -> Testing with (before fasta)
    ```
    python tools/test.py -mrelease -cdartk --no-tree-shake --no-dfe service
    ```
    now shows everything as passing.
    Reload stuff, and evaluation stuff (e.g.) has been disabled though.
- Lots of new service tests that tests what positions we stop at when
  saying next.

As fasta has now landed debugging does not currently work, but this is still needed in order to both test better and allow for proper kernel debugging support.

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

Review-Url: https://codereview.chromium.org/2680303002 .
2017-03-07 09:43:59 +01:00
Zhivka Gucevska 1b82e0c3a0 Initial implementation of interpreter for Kernel
Basic framework, evaluation of BasicLiterals and dummy evaluation
of print.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2722283003 .
2017-03-02 13:19:27 +01:00
Jens Johansen 89b68e905b Set dartAsyncMarker the same as asyncMarker unless explicitly set
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2728683005 .
2017-03-02 11:13:38 +01:00
Asger Feldthaus af10678cb3 Add source information to the covariance checks inserted for strong mode
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2718363003 .
2017-03-01 09:51:10 +01:00
Kevin Millikin f31b6d5e2c Reland "Track the 'awaiter return' call stack..."
Original CL: https://codereview.chromium.org/2692803006/

Original commit message:
Tracking the awaiter return call stack:

- [x] Each async function closure now knows who is awaiting on their
return. This is effectively the asynchronous equivalent of the 'frame pointer'.
- [x] Each async* function closure now knows how is listening on their
stream. This is effectively the asynchronous equivalent of the 'frame pointer'.

Detecting uncaught exceptions in async functions:

- [x] Code object keeps a map from :await_jump_var to token position
- [x] Exception Handlers keep track if they are generated (as part of compilation) or directly from user code
- [x] Debugger maps :await_jump_var to a specific try index

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2725623003 .
2017-02-28 16:13:41 +01:00
Asger Feldthaus ccaff30f00 Fix a type error in reify/transformation/builder.dart.
A call to toList was missing after .map().

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2725623002 .
2017-02-28 13:38:10 +01:00
Karl Klose 5df5395559 closure conversion: Do not set Context.parent if the value is null
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2716573002 .
2017-02-28 11:23:00 +01:00
Karl Klose 5a42bf8062 Support closures in initializers
Moved the code to modify the current block with context updates to its own class and added another class for context updates in initializer expressions.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2712473003 .
2017-02-28 11:16:41 +01:00
Asger Feldthaus a2e55c953d Add LibraryIndex class for finding classes and members by name.
The new class becomes a superclass of CoreTypes, which now gets its
functionality from that class, but also exposes commonly used built-in
members as fields.

This replaces a couple of ad-hoc linear searches spread throughout
the code.

The canonical names are not a convenient interface for transformers, so
the idea is that they can use LibraryIndex to address their own runtime
libraries.

To avoid name clashes and still have a somewhat convenient interface,
getters and setters are prefixed by 'get:' and 'set:' in the lookup
table (and only in the lookup table), and top-level members can be
accessed using '::' as the class name. This is the same convention
used by the VM, although it is currently not required to be the same.

R=dmitryas@google.com, karlklose@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2706243011 .
2017-02-24 14:49:12 +01:00