Commit Graph

409 Commits

Author SHA1 Message Date
Konstantin Shcheglov b7492c31e3 Use Uint32List as the return type of _IntervalListBuilder.buildIntervalList().
R=kmillikin@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2869803002 .
2017-05-08 09:04:45 -07:00
Konstantin Shcheglov cc91d04514 Use FileSystem to read files in SourceLoader and TranslateUri.
This is a prerequisite for writing fast unit tests, as I would like
to do while working on the incremental kernel driver.

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

Review-Url: https://codereview.chromium.org/2865843002 .
2017-05-06 13:09:28 -07:00
P.Y. Laligand 21e9c40b8f Disable analysis on a few packages. (#29571) 2017-05-05 22:06:00 -07:00
Stephen Adams dc8a4f21b8 dart2js allocation tweaks
In compiling a large app:

50% reduction in number of strings allocated.
20% reduction in number of closures allocated.

It is hard to tell if there is a performance improvement because it is in the noise.

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

Review-Url: https://codereview.chromium.org/2864573002 .
2017-05-05 14:40:41 -07:00
Kevin Millikin fbb6c121e6 Add an optional bound to type parameter references
This allows us to represent type parameters with promoted bounds which
are different from the bound at the declaration.  A missing promoted
bound indicates that the type parameter has the original bound at the
declaration.

This is a representation-only change, the optional bound is always
`null`.  Closes #29529.

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

Review-Url: https://codereview.chromium.org/2866593003 .
2017-05-05 23:33:13 +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
Paul Berry 932a749bbc Begin implementing subtype matching for type inference.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2856383003 .
2017-05-04 08:40:45 -07:00
Devon Carew af7f15e633 package:kernel version change 0.3.0-dev.1 => 0.3.0-alpha.1.
BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2857273002 .
2017-05-03 18:06:50 -07:00
Devon Carew 99d21dd9d0 Prepare package:analyzer 0.30.0.
BUG=
R=kevmoo@google.com

Review-Url: https://codereview.chromium.org/2862713002 .
2017-05-03 14:34:55 -07:00
Paul Berry d842f35bb2 Add a strong mode implementation of LUB to fasta; use it to infer ?:
R=ahe@google.com, leafp@google.com

Review-Url: https://codereview.chromium.org/2849213002 .
2017-05-03 10:36:47 -07:00
Asger Feldthaus 3a162d4241 Add flag to track if a constructor is the synthetic default constructor.
BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2856123002 .
2017-05-03 12:48:11 +02:00
Zhivka Gucevska 13cb938bc7 Fix issues in interpreter tests
BUG=
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2850413002 .
2017-05-02 11:43:26 +02:00
Paul Berry 29570728a3 Implement Dart 1.0 LUB algorithm (for interface types) in kernel.
Note: I intend to implement the full LUB algorithm (including strong
mode behaviors) in front_end, however this piece of the algorithm
makes sense to be in kernel so that it can take advantage of
_ClassInfo.

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

Review-Url: https://codereview.chromium.org/2848083002 .
2017-05-01 11:25:47 -07:00
Peter von der Ahé 5d08d5bb6c Update verifier to correctly analyze types of fields.
Fixes #29511.

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2855603002 .
2017-05-01 17:26:10 +02:00
Zhivka Gucevska 184cc25766 Add initial tests for Kernel interpreter
Add logging in the Interpreter for:
 - StaticInvocationExpression, including calls to print
 - ReturnStatement
 - IfStatement

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2841803002 .
2017-05-01 16:12:27 +02:00
Zhivka Gucevska b31e07a29a Fix implicit cast warning
BUG=
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2855473003 .
2017-05-01 12:41:31 +02:00
Erik Corry aa6353b6da Dart SDK Spelling b, c, and d.
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2850783002 .
2017-05-01 08:28:10 +02:00
danrubel c8784af933 rename .analysis_options --> analysis_options.yaml
See https://github.com/dart-lang/sdk/issues/28385

R=brianwilkerson@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2839383003 .
2017-04-30 18:33:10 -04:00
Sigmund Cherem 26c2f3e17f Move dartk to the tool folder
"bin" is part of the public API of a package, private tools can go under the
`tool` folder. This allows us to use a dev_dependency on analyzer without
exposing a broken import publicly.

I've only moved `dartk` so far (which I expect will be removed once we have a
better API for front_end.

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

Review-Url: https://codereview.chromium.org/2842643002 .
2017-04-28 15:39:17 -07:00
Asger Feldthaus ac40d0bb8e Add typedef AST node boilerplate.
This adds the Typedef and TypedefType to the kernel AST,
with the relevant boilerplate.

Typedefs are not implemented in frontend or backend.

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

Committed: https://github.com/dart-lang/sdk/commit/d1c3ee4b35227cb6926f03479a34f82774523773
Review-Url: https://codereview.chromium.org/2825053002 .
2017-04-28 13:26:47 +02:00
Asger Feldthaus 3f1aa32183 Revert "Add typedef AST node boilerplate."
This reverts commit d1c3ee4b35.

TBR

BUG=

Review-Url: https://codereview.chromium.org/2849803002 .
2017-04-28 12:54:19 +02:00
Asger Feldthaus d1c3ee4b35 Add typedef AST node boilerplate.
This adds the Typedef and TypedefType to the kernel AST,
with the relevant boilerplate.

Typedefs are not implemented in frontend or backend.

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

Review-Url: https://codereview.chromium.org/2825053002 .
2017-04-28 12:39:21 +02:00
Sigmund Cherem 06189b271a loader, target, diet_listener moved
from front_end/lib/src/fasta/analyzer/
   to   analyzer/lib/src/fasta/

analyzer_compile and compile_platform_dartk moved
   from front_end/lib/src/fasta/analyzer/
   to   front_end/tool/_fasta/

front_end/src/fasta/testing/* continues to have some shared testing logic,
 - logic to compute the patched sdk is moved up one level
 - TestContext, Run, and suite.dart (which depend on analyzer) moved to pkg/front_end/test/fasta/testing/
 - only a copy of TestContext is duplicated under pkg/kernel/test/closure/.

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

Review-Url: https://codereview.chromium.org/2828583003 .
2017-04-25 13:16:14 -07:00
Kevin Millikin 9adfa8a105 Fix a pair of issues in the Dart code for the front end.
- A type needed for an annotation was not visible.
- An iterable was passed instead of a list.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2838983002 .
2017-04-25 21:45:28 +02:00
Kevin Millikin 385f8fb054 Read platform.dill in the VM.
1. A --platform flag is added to dart to give a path to a Kernel
   binary for the platform libraries (as produced by building the
   runtime_kernel target).

2. This binary is used for bootstrapping.  Since it contains libraries
   other then the VM's bootstrap libraries, they are also loaded.

3. The frontend does not send any library with a dart: import URI
   scheme.  Note that it does not (yet) prune the canonical name
   table, which will contain a lot of unnecessary names used for
   internal linkages in the platform libraries.

4. There is a single dependency in the platform libraries on the
   script: _getMainClosure in dart:_builtin.  This is patched after
   the script is loaded.

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

Review-Url: https://codereview.chromium.org/2786083002 .
2017-04-25 20:04:25 +02:00
Zhivka Gucevska 2860c9cb1b Add support for static invocation with arguments
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2832873004 .
2017-04-24 10:14:23 +02:00
Erik Corry 6617737ff5 Replace 'the the' with 'the'
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2830353002 .
2017-04-24 08:50:37 +02:00
Paul Berry 3dbe0099a2 Prepare to publish analyzer, front_end, and kernel.
Due to the tight coupling between analyzer and front_end, they need to
be published atomically.  The last published version of kernel is old
enough that it needs to be published too.

I've bumped the versions to the following, and changed the
dependencies so that this set of versions is mutually compatible:

- analyzer: 0.30.0-alpha.3
- front_end: 0.1.0-alpha.2
- kernel: 0.2.0

(Note that kernel's version didn't need bumping since the most
recently published version of it is 0.1.0)

R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2828273003 .
2017-04-21 01:35:35 -07:00
Kevin Millikin 2e794c4e16 Move Kernel strings into the VM's heap.
- Instead of a pointer to new'd memory, Kernel strings now have an
  offset from the start of the string data.

- When the streaming reader encounters the string data it records the
  offset from the start of the binary.  This offset is stored in the
  Kernel Program and is used to compute the offset for strings.

- When a KernelReader is constructed, the string data is copied into a
  Uint8 array in the VM's heap.

- A pointer to the string data is put into every Kernel script so it
  can be used for constructing VM strings at compile time.

The source table does not use Kernel strings any more because those
strings are not found in the raw string data.  Instead, the source
table uses new'd buffers for strings (but this will be cleaned up
separately).

R=jensj@google.com

Review-Url: https://codereview.chromium.org/2820363002 .
2017-04-21 10:32:48 +02:00
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
Paul Berry e8e8359cdf Add local type inference logic for integer literals.
This CL introduces Fasta's first type inference rule, and hooks it up
to all the necessary testing infrastructure.  The rule is that a local
variable whose initializer is an integer literal should have an
inferred type of int.

Only variables occurring at top level within a method are inferred (we
don't yet recurse inside sub-blocks).

Additional type inference rules will be added in follow-up CLs.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2828693003 .
2017-04-20 03:36:19 -07:00
Peter von der Ahé 2d9956a93d Move kernel baseline tests to front_end.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2825063002 .
2017-04-19 10:57:58 +02:00
Peter von der Ahé 433575f618 Remove kernel baseline tests.
In CL 2824203002 the associated test cases are moved to pkg/front_end which uses pkg/testing to replace what's implemented in these tests.

R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2824203002 .
2017-04-19 10:22:25 +02:00
P.Y. Laligand 36a7e49822 Updated build files for Fuchsia. (#29382) 2017-04-18 15:02:19 -07:00
Dmitry Stefantsov cd501b2db3 Switch to Fasta in "golden" tests of closure conversion
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2808443002 .
2017-04-07 14:21:04 +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