Commit Graph

1240 Commits

Author SHA1 Message Date
Vyacheslav Egorov cc98203a2f [kernel] Support BlockExpression-s in the type inference constraint builder.
Ignore function bodies for external methods.

BUG=
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/482497013 .
2016-08-09 16:15:54 +02:00
Martin Kustermann c7fa95d117 [kernel] Add new [InferredValue] ast node, annotate return types, variables, fields
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/485197013 .
2016-08-09 12:53:42 +02:00
Asger Feldthaus b77af073b9 [kernel] Handle classes with a 'call' field or getter.
There is a new 'call handler' meta field in the constraint system,
unfolding any number of 'call' properties on the callee until a
function value is found.

Every method invocation must now load this field to ensure the actual
function is invoked.  This adds quite a bit of overhead, but in strong
mode we should be able to avoid the extra load in practice.

BUG=
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/485117015 .
2016-08-09 12:34:59 +02:00
Martin Kustermann 8b591e0cc5 [kernel] Ensure we wait until binary was written
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/478537014 .
2016-08-08 14:25:40 +02:00
Martin Kustermann 467352bd9a [kernel] Add batch running support for transform.dart
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/481417013 .
2016-08-08 13:49:34 +02:00
Martin Kustermann de1a935bef [kernel] Use Platform.resolvedExecutable to determine location of dart-sdk to use
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/484957013 .
2016-08-05 13:27:22 +02:00
Martin Kustermann b3f0da0f5b [kernel] Do not print transformed main library by default
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/481297013 .
2016-08-05 13:14:05 +02:00
Jens Johansen 15352e963d [kernel] Fixed visitor example in documentation
R=asgerf@google.com
BUG=

Review URL: https://chromereviews.googleplex.com/479327013 .
2016-08-05 11:57:18 +02:00
Asger Feldthaus a9fd5f8b07 [kernel] Add transformation to dynamically verify results of type propagation.
It currently only checks function parameters, and uses an
imperfect check for exactness and subclassing.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/486697013 .
2016-08-05 11:41:05 +02:00
Asger Feldthaus 43e846dc68 [kernel] Ensure all allocated values come with a non-zero bitmask.
Allocation of a value and bitmask input are two different constraints
in the constraint system.  However, for all values other than 'null',
there should be exactly one bitmask input and one allocation constraint.

The bitmask input was omitted in some cases in the handling of
externals, which is fixed in this CL.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/481187013 .
2016-08-05 11:36:24 +02:00
Asger Feldthaus f3b8057f9e [kernel] Fix analyzer warnings and remove unused code.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/483967014 .
2016-08-05 11:33:58 +02:00
Asger Feldthaus d5c43b7050 [kernel] Do not use default 'null' value for fields initialized by constructor.
BUG=
R=kustermann@google.com, vegorov@google.com

Review URL: https://chromereviews.googleplex.com/480257013 .
2016-08-04 15:31:31 +02:00
Asger Feldthaus 8ca58e848e [kernel] Handle null being returned when falling over the end of a method.
BUG=
R=kasperl@google.com, kustermann@google.com

Review URL: https://chromereviews.googleplex.com/484727013 .
2016-08-04 15:24:53 +02:00
Asger Feldthaus 6af9572777 [kernel] Handle default parameter values in type propagation.
BUG=
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/480247013 .
2016-08-04 15:04:57 +02:00
Asger Feldthaus d3361263a1 [kernel] Properly handle arity ranges in more cases.
The constraint fields that model parameters encode the arity of the
call, in order to weed out dataflow from calls with arity mismatch.
But not all the code had been written do follow this strategy.

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

Review URL: https://chromereviews.googleplex.com/479107013 .
2016-08-04 14:52:57 +02:00
Asger Feldthaus 9885189b09 [kernel] Nullability tracking and API for type propagation.
This adds a notion of bitmasks to the constraint system,
which will be propagated by the solver, and joined using
bitwise OR.  The solver does not care what the bits mean.

These bits propagate nullability and other values that we
care to preserve when a good base class could not be found.

This also adds an interface in front of type propagation
that exposes the inferred types in an accessible manner.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/483887013 .
2016-08-04 13:32:45 +02:00
Asger Feldthaus 2295ad8c35 [kernel] Type propagation: Class hierarchy specialization and more.
Instance members are now cloned for every class that inherits it.

The constraint system now explicitly requires all values to be
created using `newValue()`.

There is now a notion of "unions" for representing sets of values.
For class values, unions correspond to types.  For function values,
unions are based on overriding and method names.

The solver's internal map of type (Value,Field) -> Value denoting
the value of a given field has been removed.

The builder must instead register store and load locations for
every valid (Value,Field) pair.  Dynamic stores assign into the
store location, and dynamic loads take the value from the load
location.
Final fields have no store location, so they cannot be polluted
by dynamic stores.

R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/455987013 .
2016-08-02 18:22:54 +02:00
Martin Kustermann 9936f98a16 [kernel] Handle Let expression specially when doing await transformation
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/471207013 .
2016-08-02 12:17:12 +02:00
Martin Kustermann 86e914b8a8 [kernel] Implement support for "await for (...)"
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/463347013 .
2016-08-02 12:17:12 +02:00
Vyacheslav Egorov f26a9269d3 [kernel] Support async exceptions
Transformer lifts try/catch auxiliary variables that need to survive across
yield points into the context.

Drive by fix: we were calling asyncThenWrapper to create an :async_op_error
callback by mistake.

R=kustermann@google.com
BUG=

Review URL: https://chromereviews.googleplex.com/466247013 .
2016-08-02 12:17:07 +02:00
Vyacheslav Egorov 01f1fe8252 [kernel] Various fixes to make async/await work on the VM.
- Rewrite all expressions in functions, not only expression-statements.
- Inject :await_ctx_var and :await_jump_var into the wrapper.
- Don't use transformed expression directly as part of completer.complete call.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/468717014 .
2016-08-02 12:15:21 +02:00
Vyacheslav Egorov 547191a80a [kernel] Add .analysis_options to silence analyzer error
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/467687013 .
2016-08-02 12:14:50 +02:00
Martin Kustermann 439447c41a [kernel] Add AsyncMarker.SyncCoroutine
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/464127013 .
2016-08-02 12:14:50 +02:00
Martin Kustermann 55fb22d91a [kernel] Implement proof-of-concept for async/async*/sync* rewriting
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/461327013 .
2016-08-02 12:14:50 +02:00
Martin Kustermann 6afbf59b56 [kernel] Attempt to make printing of [BlockExpression]s nicer
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/458577016 .
2016-08-02 12:14:50 +02:00
Martin Kustermann 43116be5c5 [kernel] Implement binary format implementation for BlockExpression
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/462427014 .
2016-08-02 12:14:50 +02:00
Vyacheslav Egorov 6fc00fe8cf [kernel] Add the first version of async transformer.
This transformer is responsible for lifting subexpression into temporary variables preserved across yield points.

To maintain AST validity I introduced an expression that can contain a block of statements inside called BlockExpression.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/458577014 .
2016-08-02 12:14:50 +02:00
Asger Feldthaus f5093e39b7 [kernel] Include labels in the textual representation.
BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/475297014 .
2016-07-25 15:18:53 +02:00
Asger Feldthaus c97036648a [kernel] Correctly translate PropertyAccess of a static class member.
This handles the case of null-aware static member access `C?.foo`, as
well as fully qualified static member access `h.C.foo`.

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/476957013 .
2016-07-25 15:18:21 +02:00
Asger Feldthaus 2432655e48 [kernel] Add support for batch mode in dartk.
Also forwards errors reported by the analyzer for use
in testing.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/476727013 .
2016-07-22 17:42:32 +02:00
Asger Feldthaus 455d92f76a [kernel] Use allowTrailingOptions flag in dartk.
There was a flag for this in the args package that I somehow missed the
first time around.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/474927013 .
2016-07-20 14:57:59 +02:00
Asger Feldthaus 0228e8c29e [kernel] Fix deserialization of labels in nested functions.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/472867013 .
2016-07-20 14:12:07 +02:00
Asger Feldthaus 241a79e11b [kernel] Preserve leading BOMs during deserialization.
BUG=#21
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/467567013 .
2016-07-20 14:10:22 +02:00
Asger Feldthaus 10d54d7a61 [kernel] Change the default binary file extension to .dill
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/475637013 .
2016-07-19 17:52:33 +02:00
Martin Kustermann 1d0f534832 [kernel] Revert "Implement binary format implementation for BlockExpression"
This accidentally landed on master branch.
2016-07-08 09:22:36 +02:00
Martin Kustermann 4acb4446fd [kernel] Implement binary format implementation for BlockExpression
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/462427014 .
2016-07-08 09:18:01 +02:00
Martin Kustermann 77001a5494 [kernel] Fix moving super initializer to the end
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/462167013 .
2016-07-05 11:53:03 +02:00
Peter von der Ahé 7eef2bb9a2 [kernel] Null aware assignment is when lvalue is null.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/462137013 .
2016-07-01 13:21:45 +02:00
Asger Feldthaus 1abc2c897c [kernel] Fix some broken tests and benchmarks.
The tests and benchmarks did not use AnalyzerRepository and the test
expectations for type propagation were not updated after a change to
the frontend.

BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/462127013 .
2016-07-01 13:10:00 +02:00
Asger Feldthaus 1d86616fd5 [kernel] Enable Accessor subclasses to provide error handling.
BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/462807013 .
2016-07-01 11:39:21 +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
Peter von der Ahé 72e5a0281b [kernel] ConstructorInvocation extends InvocationExpression.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/456367013 .
2016-06-28 13:11:25 +02:00
Asger Feldthaus d61e67d85a [kernel] Fix a broken parent pointer and add option in dartk to check them.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/460807013 .
2016-06-28 11:15:48 +02:00
Asger Feldthaus 4a40d3f244 [kernel] Insert default super constructor calls.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/457997013 .
2016-06-28 10:59:54 +02:00
Asger Feldthaus 37d46de6a5 [kernel] Fix labeled variable declarations.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/453477013 .
2016-06-27 12:23:02 +02:00
Peter von der Ahé 0e36559dd4 [kernel] Reduce dependencies on analyzer.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/445507013 .
2016-06-17 11:41:26 +02:00
Peter von der Ahé 3f1162ea96 [kernel] Rename ReadOnlyAccessor.finish to _finish.
This way ReadOnlyAccessor overrides Accessor._finish as intended which solves problem where reads would contain free temporary variables.

R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/455597013 .
2016-06-16 10:26:42 +02:00
Asger Feldthaus ab59e37155 [kernel] Canonicalize loads and stores in type propagation.
BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/444557013 .
2016-06-14 17:35:01 +02:00
Asger Feldthaus d78bab065e [kernel] Preserve all annotations on graph nodes.
The text annotator needs all annotations to be present,
and previously only one per member would be preserved.

BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/444547013 .
2016-06-14 12:47:57 +02:00
Asger Feldthaus 41f9505d88 [kernel] Improve graph visualization of type inference constraints.
Constraints are now annotated as well as variables, making it easier
to determine which edges should be included in the graph for a given
member.

BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/445297013 .
2016-06-14 12:23:37 +02:00