Commit Graph

20 Commits

Author SHA1 Message Date
Jens Johansen 4bbda48a7c [kernel] Stream everything. Replace .kernel_function with .kernel_offset
- Put pointer to kernel data into Script.
- Replace function.kernel_function pointer to AstNode with
  kernel_offset():
- Replace field.kernel_field pointer to AstNode with kernel_offest().
- Stream the previously unstreamed AstNodes: FunctionDeclaration and
  FunctionExpression.
- Move special handling for _buildin.getMainClosure into the streaming
  flowgraph builder.
- Delete big parts of kernel_to_il.

R=kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/948e2f5d7916032ed6f0bfdc316ba4f577a5ea61
Review-Url: https://codereview.chromium.org/2901533002 .
2017-06-14 10:59:57 +02:00
Jens Johansen de5ebc5a4e Revert "[kernel] Stream everything. Replace .kernel_function with .kernel_offset"
The commit somehow made e.g. vm-linux-release-ia32-be turn red.

This reverts commit 948e2f5d79.

BUG=

Review-Url: https://codereview.chromium.org/2941483003 .
2017-06-14 09:12:38 +02:00
Jens Johansen 948e2f5d79 [kernel] Stream everything. Replace .kernel_function with .kernel_offset
- Put pointer to kernel data into Script.
- Replace function.kernel_function pointer to AstNode with
  kernel_offset():
- Replace field.kernel_field pointer to AstNode with kernel_offest().
- Stream the previously unstreamed AstNodes: FunctionDeclaration and
  FunctionExpression.
- Move special handling for _buildin.getMainClosure into the streaming
  flowgraph builder.
- Delete big parts of kernel_to_il.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2901533002 .
2017-06-14 08:27:21 +02:00
Jens Johansen 76336b225f [kernel] Streaming ScopeBuilder
The old ScopeBuilder is replaced with StreamingScopeBuilder
that does not use the Ast.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2886873008 .
2017-06-13 11:39:31 +02:00
Ryan Macnak bcf2900a26 Reapply "Shuffle around deopt id allocation to give the flow graph builder a chance to record other data as they are allocated".
- Fix inlining of new List(n) to propogate deopt id.
 - Fix CreateArrayOpt to check for a Smi length.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2900963008 .
2017-05-25 10:12:22 -07:00
Ryan Macnak 93864c0db9 Revert "Shuffle around deopt id allocation to give the flow graph builder a chance to record other data as they are allocated."
This reverts commit c94bebf289.

Review-Url: https://codereview.chromium.org/2904733003 .
2017-05-24 11:55:56 -07:00
Ryan Macnak c94bebf289 Shuffle around deopt id allocation to give the flow graph builder a chance to record other data as they are allocated.
We'll use deopt-id -> context-level or deopt-id -> scope mappings to find what variables are in scope for the debugger and async stack trace machinery.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2896903002 .
2017-05-23 16:56:14 -07:00
Régis Crelier 9aafded095 Pass type argument vector to generic functions (if --reify-generic-functions is
true, still false per default).
Work in progress, not functional yet (passed vector is still ignored in callee).

R=vegorov@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2859673002 .
2017-05-18 14:03:47 -07:00
Jens Johansen 73d3aedc6d [kernel] Fix call to NameIndex(NULL)
Previous commit had 3 instances of "NameIndex(NULL)" which workes locally.
Some of the build bots complain about
"implicit conversion of NULL constant to 'int'".
This should fix that.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2878393002 .
2017-05-15 09:45:16 +02:00
Jens Johansen d26558b7be [kernel] [partial] Streaming of kernel binary without AST nodes
This CL allows for streaming big parts of the binary,
i.e. without using the AST nodes.
It is thus a stepping-stone in getting rid of the AST nodes in the VM.

Generally, all Expressions except "FunctionExpression",
and all Statements except "FunctionDeclaration" can be streamed.

There are currently not streamed because they create new functions,
which has a pointer to an AstNode (which we don't have when streaming).

Once we no longer need AstNodes at all these can be streamed as well.
This is, I think, mostly a matter of streaming the ScopeBuilder as well,
something that is not currently done.

The way the streaming is build, one has to stream an entire subtree.
That means, that if an expression (or statement), A, that is generally
streamable contains an expression or a statement, B, that is not streamable,
A cannot be streamed.
The way this is build is by marking AstNodes as streamable or not
("cannot_stream_" field). That way we know up front whether we can stream
a subtree or not.

The streaming is done via "kernel_binary_flowgraph".

In this file there are many obvious comments, e.g.
```
  TokenPosition position = ReadPosition();  // read position.
```
This has been done in an attempt to add a comment to everything that
reads from the binary to make it stand out more.

All changes from kernel_to_il up to and including May 2nd 2017
should be included.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2854393002 .
2017-05-15 09:01:22 +02:00
Kevin Millikin 9935e86688 Introduce classes for string and name indexes
In the VM's Kernel representation, introduce wrapper classes for
string and name indexes so it is obvious which one is which.  For
convenience there is an implicit conversion so that they can each be
used where an int is allowed.  However, there is no implicit
conversion _to_ either of these types.

BUG=
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2860823002 .
2017-05-04 00:43:19 +02:00
Kevin Millikin 514281b8a7 Move the Kernel canonical name table into the VM's heap
The canonical name table is copied into a typed data array in the VM's
heap.  The encoding is the same as in the binary except that the
integer indexes are fixed-size.

Canonical names are now integer indexes instead of objects allocated
in the C++ heap.

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

Review-Url: https://codereview.chromium.org/2853423002 .
2017-05-03 19:27:11 +02:00
Kevin Millikin 865e0669b2 Move the Kernel string offsets into the VM's heap.
Copy the Kernel string offsets into a uint32 array in the VM's heap.
This avoids allocating small string objects with new and avoids having
a table of the canonical strings.

Instead of an offset and a size, strings are now represented as
indexes into the string table in the heap.  The start offset of string
N is found at byte offset N*4 because it is a uint32, and the end
offset is found at byte offset (N+1)*4.  The strings themselves are
just integer indexes instead of pointers.

In the stream flow graph builder, string access is all random access.

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

Review-Url: https://codereview.chromium.org/2852943003 .
2017-05-02 17:35:55 +02: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
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
Jens Johansen 1ef5c76a4e Stream StaticGet
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2794473002 .
2017-04-03 12:28:06 +02:00
Jens Johansen c9750187d8 Stream SymbolLiteral & BigIntLiteral
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2786073002 .
2017-04-03 12:23:38 +02:00
Jens Johansen 819ce4241c Stream DoubleLiteral
BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2783183002 .
2017-04-03 12:18:47 +02:00
Jens Johansen 42c80b5906 Step #2 in streaming the kernel flowgraph
* Stream InvalidExpression
* Stream NullLiteral
* Stream BoolLiteral
* Stream IntLiteral
* Stream ThisExpression
* Stream StringLitereal

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2787463003 .
2017-04-03 12:04:08 +02:00
Jens Johansen 63f1de2068 Initial steps into streaming the kernel flowgraph
- Moved stuff into .h
- Leak kernel binary blob
- "Streaming" rethrow in FlowgraphBuilder

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2776373002 .
2017-04-03 11:40:37 +02:00