With this change debugger requests yield(await) positions from kernel builder so it can confirm which frame handles what exceptions.
This also renames ':completer' to ':async_completer' in constructed kernel, so it is compliant with what VM expects to see(and updates test expectations accordingly).
Further it fixes async stack navigation for sync-async that became default in dart vm since first version went for the review((uses `future` getter, rather than property).
It also makes `future` getter non-debuggable to allow stepping-out of async methods.
Make Handle zone-scoped. Clean up frame counter var name.
Bug: https://github.com/dart-lang/sdk/issues/29056
Change-Id: Ia71f3c851a6b313655b57dad28c296f5dd081eda
Reviewed-on: https://dart-review.googlesource.com/54640
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This CL turns the ClassHierarchy incremental and use that in two places:
* When compiling incrementally
* When performing the second ClassHierarchy computation after adding
forwarding stubs.
Change-Id: I7046d6be9d7673dc0783a98789b5a25183b44799
Reviewed-on: https://dart-review.googlesource.com/53804
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Removing this directory as it is mostly unused.
Closure conversion still relies on VariableAccessor, so I moved it
there.
We should consider removing closure conversion. I don't believe we
actually use it.
Change-Id: I885620b310c4d1bf3a9b9b805188921bc242a993
Reviewed-on: https://dart-review.googlesource.com/54221
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This CL:
* Removes unused functions in the ClassHierarchy
* Turns the data structures used in the ClassHierarchy upside down
(nodes have a lists of supers instead of lists of subs)
* Factors some things that needs the original list-of-subs into another
class that the user can ask the ClassHierarchy to compute if needed.
It appears that it isn't generally.
This is step #1 in turning the ClassHierarchy into an incremental
ClassHierarchy.
Change-Id: I48c5731c01c1b0e8bf1fcd4ddba7f2bf7ce3b9c9
Reviewed-on: https://dart-review.googlesource.com/53662
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This reverts commit 039e8a1755.
Reason for revert:
Blocks the roll into Flutter.
See https://github.com/dart-lang/sdk/issues/33095
Original change's description:
> [vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)
>
> This CL also uses the newer `onProblem` error reporting mechanism, which supports contexts.
>
> The errors by the constant evaluator are formatted e.g. like this:
>
> .../language_2/compile_time_constant_o_test_01.dart:14:8: Error: Duplicate keys are not allowed in constant maps (found duplicate key "StringConstant(foo)").
> "foo": 499
> ^
> .../language_2/compile_time_constant_o_test_01.dart:32:24: Context: While analyzing:
> Expect.identical(m1, m3);
>
> Change-Id: I463416e14686e218b0f08903bd6aa0bca7392260
> Reviewed-on: https://dart-review.googlesource.com/53021
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
TBR=vegorov@google.com,kustermann@google.com,alexmarkov@google.com,askesc@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I1af0200dcb0aef03c7bd9ba3b5aead1565f05708
Reviewed-on: https://dart-review.googlesource.com/54720
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Todd Volkert <tvolkert@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This CL also uses the newer `onProblem` error reporting mechanism, which supports contexts.
The errors by the constant evaluator are formatted e.g. like this:
.../language_2/compile_time_constant_o_test_01.dart:14:8: Error: Duplicate keys are not allowed in constant maps (found duplicate key "StringConstant(foo)").
"foo": 499
^
.../language_2/compile_time_constant_o_test_01.dart:32:24: Context: While analyzing:
Expect.identical(m1, m3);
Change-Id: I463416e14686e218b0f08903bd6aa0bca7392260
Reviewed-on: https://dart-review.googlesource.com/53021
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This "knob" to turn off constant evaluation for annotations is required
because the TFA transformation leaves annotations in a state where they
cannot be evaluated anymore.
Change-Id: I7720a07ef42ff69834e24a856613ea2e846b4f2d
Reviewed-on: https://dart-review.googlesource.com/52803
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Instead of simply throwing an exception when a compile-time error was
discovered during constant evaluation, we report the error and continue
transforming.
This also collects a context, which can be used by error reporters to
show users in which context an error occured.
The reason for using an interface for reporting errors is to be able to
report reasonable nice error messages, keep the transformation inside
package:kernel and allow users of the transformation to possibly report
nicer error message, e.g. by adding quotes of source positions (which
will come in another CL). This makes it slightly verbose.
Change-Id: I965cafc690dddb525b20368d03bb978e18a6ee58
Reviewed-on: https://dart-review.googlesource.com/52447
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Translate assert statements in async functions. The translation of
the condition subexpression can produce a sequence of statements that
have been hoisted out of it. These need to be guarded so they are
executed only when asserts are enabled.
For this purpose, we introduce an AssertBlock. The semantics of the
assert block:
assert { s0; ...; sn; }
is the same as:
if (assertsEnabled) { s0; ...; sn; }
where assertsEnabled is a more primitive nullary expression that is
true iff. assertions are enabled. We chose not to encode this using a
construct like assertsEnabled because (1) we would have to support it
appearing as an arbitrary expression which we don't currently need
and (2) it requires deeper pattern matching to detect and skip the
guarded code when desired.
The translation is more complicated because if there is a message
subexpression in an assert, it is conditionally evaluated only if the
assert's condition is false.
Fixes https://github.com/dart-lang/sdk/issues/28498
Change-Id: I0912a57104ede3160533e49f65b6fb79b76f1500
Reviewed-on: https://dart-review.googlesource.com/46442
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This reverts commit 52d1b4e96d.
Reason for revert: Analyzer and DDC do not support the super-mixin fix and flag, so the new test fails on them. The test needs to either be marked as failing on them, or support needs to be added and work in the test framework.
Original change's description:
> Fix a bug in Kernel's mixin elimination
>
> Mixin elimination copied factory constructors from the mixin class to
> the mixin application class. This could be observed as an unbound
> type parameter which led to a crash in the VM. Fixes
> https://github.com/dart-lang/sdk/issues/32267.
>
> Change-Id: I87b70a35d11c364739d01e261adf5329d492d8cf
> Reviewed-on: https://dart-review.googlesource.com/42922
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
TBR=vegorov@google.com,jensj@google.com,kmillikin@google.com
Change-Id: I4a0bcf0b323c9adef7e5dc7d9019b6aafe40509d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/42960
Reviewed-by: William Hesse <whesse@google.com>
Slightly alter async/await transformation in such a way that
:await_jump_var/:await_ctx_var are set before _awaitHelper(...) is invoked -
just like in the AST transformer used by the legacy pipeline. This guarantees
that recursive invocations will continue from the right "jump" point (instead of
continuing from the current jump point).
Fixes https://github.com/dart-lang/sdk/issues/32098
Change-Id: I8899669ceefe3f2edba6531897834b2c275efada
Reviewed-on: https://dart-review.googlesource.com/40520
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
As requested in #31691 the incremental compiler should be able to
initialize its state from a previously generated dill file.
This CL introduces that functionally.
It is tested, but actual usage (e.g. proper invalidation of old files)
should live outside of the front-end (i.e. it's the callers responsibility).
One option would be for the caller to load the dill file and use the
included sources to invalidate changed files.
On my machine a from-scratch compile of dart2js takes ~5 seconds,
one initialized from such an output and with a single file invalidated
(though it actually hasn't changed) it takes ~1 second and the resulting
dill file is bit-perfect compared to the from-scratch compiled one.
Closes#31691.
Change-Id: I07f5efca5f2684d73f6c252f2dbc2ad04e9b5cd0
Reviewed-on: https://dart-review.googlesource.com/37260
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Dart allows 'external' functions which are not connected to their body.
Calling such functions produces runtime error, but they should be accepted
at compile time. Test language_2/external_test verifies this behavior.
This CL fixes treeshaker/findNativeName to return 'null' instead of throwing
an error for 'external' functions without @ExternalName annotation (which
is used to specify native name).
Change-Id: I04ec892af29ffe064ece8fddd6f67c7acdca1139
Reviewed-on: https://dart-review.googlesource.com/37122
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Before: Kernel static errors were represented by throwing a distinguished
error or else by calling a distinguished library const constructor.
Now: Kernel static errors are represented by InvalidExpression. To support
error reporting, InvalidExpression has an optional message and a file
offset. A back end can choose to signal these errors at any time; for
example, when deserializing the binary, or when compiling the procedure
containing the static error, or when the erroneous expression is evaluated
at run time.
InvalidStatement is removed because it can be encoded as ExpressionStatement
of InvalidExpression.
Future work:
* supporting static errors where an expression cannot appear in the AST
* allowing InvalidExpression to contain an Expression for error recovery
* adding a top-level list of static errors and warnings to the binary
Bug: https://github.com/dart-lang/sdk/issues/29840
Change-Id: Ifdfe9a76cee6cefed28061bf245be70531d2f413
Reviewed-on: https://dart-review.googlesource.com/31320
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
* The package:kernel/transformations/precompiler.dart is moved to
package:vm and split into 2 libraries: metadata/direct_call and
transformations/cha_devrtualization.
* Fasta 'target-options' command line argument and
package:kernel/target/implementation_option.dart are cleaned up
as they are no longer used.
Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I21a7b6bc62a036a9694e62a5dae890f6120d79ab
Reviewed-on: https://dart-review.googlesource.com/26360
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
We change the type of FileUriNode.fileUri from String to Uri, which in principle
doesn't change the binary format. However, we did notice that LibraryParts
weren't serialized as specified in binary.md, so we also fixed that.
Since fileUris are stored as strings in a separate table, Uri.parse is only called
once per unique URI.
Fasta only uses relativizeUri when printing diagnostics, and URIs stored in
expectation files (golden files) are relativized using String.replaceAll.
Change-Id: Ib2dc1b80c03a0cdaf84e48b8b3ba73b16bdf8a40
Reviewed-on: https://dart-review.googlesource.com/25421
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
The changes in this CL include:
* handle interface targets also on this dispatch (which happens due
to mixins)
* preserve class members if interface targets refer to them
* remove references to shaken elements in `Library.additionalExports`
* support handling of typedefs
Change-Id: Id8df6fbf5c3428ae9c9f8b11ee9bf80c35a7a091
Reviewed-on: https://dart-review.googlesource.com/21640
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The introduced "constants" transformation can evaluate constant expressions. The
original use-sites of constant expressions are replaced by a new [ConstantExpression]
node, which points to a subclass of a new [Constant] class hierarchy. Constant
[Field]s and [VariableDeclarations]s will be removed, since all use-sites are
re-written.
The [Constant] class hierarchy is, similarly to the [DartType] class hierarchy, not
part of the AST tree (also has no parent pointer). The constants form a
DAG (directed acyclic graph).
There is no canonicalization requirement of the [Constant] objects referenced by the
AST (via [ConstantExpression]). Although it is beneficial to canonicalize them during
construction, since it reduces time spent in operator==/hashCode.
This CL furthermore adds support for a constant table in the binary format. Similarly
to [String]s, we canonicalize the constants before writing the table to the binary.
The constant table entries in the binary are written in a post-order way, to ensure
easy construction on the backend side.
The text format will be augmented with a "constants { ... }" section at the end,
which lists the constants in the same order as in the binary format.
The transformation can be used by those backends who choose to do so. It is not
enabled by default atm. It should therefore not affect analyzer, fasta or other
components.
Change-Id: I57cd9624fedcf537ab6870db76246149647bed21
Reviewed-on: https://dart-review.googlesource.com/14382
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Otherwise we might match up a getter to a setter and crash.
The test cases indirectly verify that mixin resolution does the right
thing by checking the semantics of the generated code. These tests do
not pass yet, because covariance checks are not yet implemented in the
VM.
Change-Id: Ibe6d8b7479f86151c515c45c20ed7c880bf2ad43
Reviewed-on: https://dart-review.googlesource.com/16686
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>