Commit Graph

1551 Commits

Author SHA1 Message Date
Clement Skau edde575dcd [SDK] Adds an SDK hash to kernels and the VM.
Adds a new SDK hash to kernels and the VM which is optionally checked
to verify kernels are built for the same SDK as the VM.
This helps catch incompatibilities that are currently causing
subtle bugs and (not so subtle) crashes.

The SDK hash is encoded in kernels as a new field in components.
The hash is derived from the 10 byte git short hash.

This new check can be disabled via:
  tools/gn.py ... --no-verify-sdk-hash

This CL bumps the min. (and max.) supported kernel format version,
making the VM backwards incompatible from this point back.

Bug: https://github.com/dart-lang/sdk/issues/41802
Change-Id: I3cbb2d481239ee64dafdaa0e4aac36c80281931b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150343
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-26 13:35:42 +00:00
Dmitry Stefantsov 8e0b0d5fa0 [cfe] Add NNBD-aware constraint gathering and solving
Closes #41105
Closes #41106
Closes #41447

Bug: http://dartbug.com/41105
Bug: http://dartbug.com/41106
Bug: http://dartbug.com/41447
Change-Id: I041c4a861fa580a9a9da77416308300206f4774e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151393
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-06-24 14:35:01 +00:00
Erik Ernst 5a6c1e5158 Type aliased inference of generative constructor invocation.
This CL adds some infrastructure that makes it possible to defer the
inference of type arguments for a type alias which is used to specify
an instance creation:

  class B<X, Y> {}
  class C<X> implements B<String, X> {}
  typedef T<X> = C<List<X>>;

  void main() {
    B<Object, Iterable<num>> c = T(); // Infer `T<num>()`.
  }

The CL contains an implementation for type inference in the case
where the target is a non-redirecting constructor.

There is not yet an implementation of type inference for the case
where the type alias ultimately resolves to a redirecting factory
constructor, and the shadow nodes are eliminated as null.

Change-Id: I9721b293dce37313e046a8339359e51c2d54b4c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150301
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-06-23 14:14:11 +00:00
Michael Thomsen 2451ff786f Mark front_end and kernel as private packages
Change-Id: I84e8933ece361cb4e058a1305b67208896ea85b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152006
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2020-06-23 13:22:31 +00:00
Daco Harkes 7eac9f355e [vm/ffi] Expose a subset of dart_(native_)api.h for dynamic linking.
This CL introduces dart_api_dl.h which exposes a subset of dart_api.h
and dart_native_api.h for dynamic linking at runtime through the FFI.
Dynamic linking is done through including dart_api_dl.cc in a shared
library and passing NativeApi.initializeApiDLData to the init function.

This CL also includes Native API versioning to deal with possible
version skew between native api version against which native libraries
are compiled and the version in the DartVM the code is run on.

The subset of symbols in the CL includes handle related symbols, error
related symbols, handle scope symbols, and native port sumbols.

Design: http://go/dart-ffi-expose-dart-api

Closes: https://github.com/dart-lang/sdk/issues/40607
Closes: https://github.com/dart-lang/sdk/issues/36858
Closes: https://github.com/dart-lang/sdk/issues/41319
Closes: https://github.com/flutter/flutter/issues/46887
Closes: https://github.com/flutter/flutter/issues/47061

Misc:
Closes: https://github.com/dart-lang/sdk/issues/42260

Change-Id: I9e557808dbc99b341f23964cbddbb05f26d7a6c5
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145592
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-18 07:30:43 +00:00
Johnni Winther 7fce125300 [cfe,kernel] Add AstPrinter
This CL adds a Node.toText method together with an AstPrinter. These
facility and better toString implementation on AST nodes while allowing
for toString independent printing of AST to use in testing. This also
add support for an integrated toString of custom/internal nodes.

Some work is still needed in bringing the toString implementation on
all nodes to the old quality, and not all internal nodes have
customized textual representations yet. This work is left for future
CLs.

Change-Id: Ib0bf8a0bc02f489dfacdc8aa5f96da9c52f26058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150923
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-06-16 17:15:10 +00:00
Johnni Winther 28606d040b [cfe] Recompute type parameter type nullability after substitution
Closes #41697

Change-Id: Ib4977aa3f8d97defa7884036a0f561d6ecb4c3ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149587
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-06-15 13:24:26 +00:00
Dmitry Stefantsov 929d5e4a98 [cfe,ddc,dart2js,vm] Add FutureOrType
This CL is the sum of the following 5 CLs:
* https://dart-review.googlesource.com/c/sdk/+/149297/
* https://dart-review.googlesource.com/c/sdk/+/149299/
* https://dart-review.googlesource.com/c/sdk/+/149320/
* https://dart-review.googlesource.com/c/sdk/+/149321/
* https://dart-review.googlesource.com/c/sdk/+/149323/

The reason for landing the 5 CLs as one CL is to prevent potential
troubles with bisecting over the branch because the change is fully
functional only with all 5 CLs.

Closes #40123.

Bug: https://github.com/dart-lang/sdk/issues/40123
Change-Id: Ice52250a98acfe455b1d7fa5bb0624c115ca5dac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150934
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-06-15 12:18:46 +00:00
Dmitry Stefantsov 363ac11c1f [cfe] Support more statements in round-trip serialization
* async-version of ForInStatement
* AssertBlock
* AssertStatement
* ReturnStatement without return expressions

Change-Id: Ic1dcff70913c37fc09e31f4608eff8a47037eaa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150924
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-06-11 10:10:08 +00:00
Dmitry Stefantsov b5e7966dee [cfe] Add DartTypeComparator
The utility class DartTypeComparator allows to compare two dart types
under various assumptions, such as ignoring nullability at the
top-level type node or equating all top types.

Change-Id: I998e4a0a3ac236077cd1bcd12a5ad146ff10bb1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149427
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-06-08 16:58:31 +00:00
Jens Johansen 652bac12b4 [CFE/VM] Fix 'reject' when using experimental invalidation strategy
Change-Id: Ib7c75584dec6fa605f82487a5b0291894964bed0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150026
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-06-08 12:02:43 +00:00
Johnni Winther 3a021a6545 [cfe] Remove EvaluationMode.legacy
This is no longer valid. Since the SDK is agnostic we should default to weak mode.

Change-Id: Ia9fbf911e7ebb595c93a71afe3bb8de7495cebba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149065
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-30 09:47:02 +00:00
Jens Johansen 0f80f51859 [kernel] Allow merging nnbd disabled + nnbd weak
Allow loading a dill that contains both nnbd disabled and nnbd weak.

Fixes https://github.com/flutter/flutter/issues/58126

Change-Id: Ic188bd1d377aa9d660e8803869713342f3a814c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149424
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-29 14:40:36 +00:00
Dmitry Stefantsov 142d09fed7 [cfe] Provide better context in verifier's diagnostics
Change-Id: I599eb100acab431fc5630305951120dfe98e79b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148763
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-26 10:02:05 +00:00
Jens Johansen 857fca710f [kernel/VM] Fix 'infinite' loop with memory crash on specific invalid dill
The dill file has an index at the end. The last 4 bytes of that index is
a size that indicates how big the file is. This is done to support
concatenated dill files. If the dill is invalid and the size is read as 0
both the VM and the dart kernel reader will go into an infinite loop where
it allocates another list entry on every loop iteration (making the whole
loop not infinate because we will run out of ram soon enough).

This CL fixes the issue by checking the size to be possitive.

Change-Id: I42da0557c6d4a274fdbe1a729fdaf5b8f149b187
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148538
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-26 08:24:05 +00:00
Jens Johansen 53ac4d53f2 [CFE] Set compilation mode if no main found
Change-Id: I2c3121e54f6c12b7ecdd8784851ca0611ff0b9d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148401
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-20 10:29:42 +00:00
Johnni Winther 6708394f03 [cfe] Add predicates to detect late lowered fields.
Needed for https://github.com/dart-lang/sdk/issues/41892

Change-Id: I049e76655cf62a5558c18319e80ab9702c7a3c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148321
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-05-19 08:55:20 +00:00
Alexander Markov cbb5305f78 [vm/nnbd] Optimize type casts
Add a kernel transformation which removes redundant casts and reduces
some casts to null checks. This transformation assumes that type
system is sound and subtyping relation is transitive. So in NNBD weak
mode this transformation is always correct. In NNBD strong mode
this transformation is correct only if opted-out libraries are not
allowed.

The following patterns are handled:
If S <: T (this includes S <: T? in weak mode)
  S x; x as T => x
If S <: T? in strong mode
  S x; x as T => (x == null) ? x as T : x

This kernel transformation is not specific to the VM and can be reused
by other back-ends such as dart2js and DDC.

Fixes https://github.com/dart-lang/sdk/issues/40892
Issue https://github.com/dart-lang/sdk/issues/40893

Change-Id: I466ba96d763d5358011c768400c5225fa7bf5e67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139314
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-19 02:35:12 +00:00
Vyacheslav Egorov 22aa820bd2 [kernel] Fix round trip serialization of metadata when nodes are lazy loaded.
Metadata repository might be populated lazily as we are traversing the
component, so it is incorrect to skip empty metadata repositories early
in the serialization process.

Instead we filter empty repositories at the very end - after all nodes
were written out.

Change-Id: I159e0c0213a034388855944af03e72786d9e951b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148065
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-18 21:30:16 +00:00
Johnni Winther c10b41a4e2 [kernel] Add DartType.toTypeText and Constant.toConstantText
These are used to provide a testable textual representation
of types and constants that do not rely upon Node.toString.

Change-Id: Iff77ebb44e8299b262f4f263666b2e1d4dd5794b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147909
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-18 11:48:20 +00:00
Jens Johansen 6fb1efd584 [flutter/vm] Update dartdoc for WidgetCreatorTracker.transform
Change-Id: I6afbc4cc5f975052c9dd05e4befea572e8a91505
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148400
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-18 10:35:07 +00:00
Dmitry Stefantsov 8294d4c41a [cfe] Complete support for types in round-trip serialization
Change-Id: I9053875814ae771108269cd6c23e952a9dd63ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148261
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-18 08:37:04 +00:00
Jens Johansen 7929b4223e [CFE] Fix memory leak via WidgetCreatorTracker
Change-Id: Iebb961955bcd6cf2513cdec6036dfbd126e45231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-15 14:09:02 +00:00
Dmitry Stefantsov e53e5f2475 [cfe] Separate nullability and declared nullability
For some types it makes sense to distinguish between nullability as a
property of including null and the declared nullability, such as for
type-parameter types and FutureOr types.  This CL introduces the
separation between the two concepts.  The plan is to use that when
implementing FutureOrType.

Bug: https://github.com/dart-lang/sdk/issues/40123
Change-Id: I90b45bea768e89c213d021d360a481d38377c682
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147903
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-15 07:38:05 +00:00
Dmitry Stefantsov c2cf179812 [cfe] Use negative test for support in rount-trip unit testing
Using the negative test (what is not supported yet) will help keep
track of what is yet to be done in order to serialize any Kernel ASTs.

Change-Id: Ie47ac0d3b5a215d4296f7e977f19a30bc19bc94b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147911
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-14 17:10:55 +00:00
Johnni Winther d5650235a2 [cfe] Handle ProblemBuilder in binary expression
Closes #41787

Change-Id: I81fcf0aee975b58b3b44d0de94054ae87bdd265d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147140
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-05-12 11:44:19 +00:00
Dmitry Stefantsov 7cbd5f6f78 [cfe] Add round-trip serialization support for loop nodes
The following nodes are supported now:
* ForStatement
* ForInStatement
* WhileStatement
* DoStatement

Change-Id: I42d43b949da80a631887996fac4b6a6f4c2a8c79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147100
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 17:21:38 +00:00
Dmitry Stefantsov e86e4d6183 [cfe] Add round-trip serialization support for more statement nodes
The support is added for the follwing statements:
* YieldStatement
* Block
* VariableDeclaration (as a statement)
* IfStatement
* EmptyStatement

+ improve diagnostics in related unit tests

Change-Id: Ib738227c6e8c1963aeaee52630953e07cef4b093
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146800
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 10:07:37 +00:00
Jens Johansen a2e7c24cd7 [CFE/kernel] Grab bag of small fixes/improvements
* Refactor a test to make it easier to extend it later.
* Allow the crashing reproduction minimizer to search for a new target
  if it finds another interesting crash.
* Fix update_expectations tool to include textual_outline
* Fix leakingDebugToString on Library

Change-Id: I9a59151f2ad5c2d91b4cbbe10d864fe9928221eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146804
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 07:29:47 +00:00
Clement Skau 2359f4dc68 [VM] Reworked: Remove unnecessary Closure.clone() from sync*.
Removes the Closure.clone() in sync* by adding an additional closure
around the rewritten sync* function body.

This is a re-worked version of the now reverted:
- https://dart-review.googlesource.com/c/sdk/+/136190
- https://dart-review.googlesource.com/c/sdk/+/144948

This CL includes changes from both the above CLs, in addition to:
- A new 'ShadowRewriter' transformer to do deep rewriting of
  shadowed parameters.
  Previous versions only rewrote the immediate sync* function, missing
  references in nested rewritten functions.

Note: This CL is re-landing largely unchanged since the roll-blocking
issues suspected to be caused by this was later attributed to a
different set of changes.
I have independently re-run all failing external tests to verify
them passing for this CL.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: Id1670a93961180e8558d7c7eca65fe7e9115f07b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145402
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-05 12:04:03 +00:00
Dmitry Stefantsov c0e7543c98 [cfe] Add support for InterfaceTypes in round-trip serialization
Change-Id: Ie39848adf7c72e9171e6551717a67ae070c66985
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145802
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-01 12:03:44 +00:00
Dmitry Stefantsov b67a1313ae [cfe] Add an option to inspect internal state of text serialization
The option is added to the unit testing framework and is supposed to
be used locally.

Change-Id: Ia043ca35d27c15e597fe1b66429f923ccb24f3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144825
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-29 10:36:40 +00:00
Clement Skau 12a5c93d4a Revert "Reland "[VM] Remove unnecessary Closure.clone() from sync*.""
This reverts commit 1bf25798fa.

Reason for revert: Rolling back as it breaks more external targets and is currently blocking rolls.

Original change's description:
> Reland "[VM] Remove unnecessary Closure.clone() from sync*."
> 
> This reverts commit 430c75b5fa.
> 
> Reason for revert: We probably don't care about the dartkb breakages.
> 
> Original change's description:
> > Revert "[VM] Remove unnecessary Closure.clone() from sync*."
> > 
> > This reverts commit ca94ad7112.
> > 
> > Reason for revert: Appears to break dartkb.
> > 
> > Original change's description:
> > > [VM] Remove unnecessary Closure.clone() from sync*.
> > > 
> > > Instead, this CL wraps sync*'s sync_op in an additional function
> > > that captures local copies of the necessary closure state.
> > > Notably this state includes the parameters of the original sync* function
> > > as these also need to be cloned for each instance.
> > > 
> > > 
> > > Note: a large number of .expect files have a small number of changes
> > > due to the additional wrapper function, as well as some extra plumbing.
> > > 
> > > Bug: https://github.com/dart-lang/sdk/issues/37753
> > > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > > Commit-Queue: Clement Skau <cskau@google.com>
> > > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > 
> > TBR=vegorov@google.com,cskau@google.com
> > 
> > Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> > Reviewed-by: Clement Skau <cskau@google.com>
> > Commit-Queue: Clement Skau <cskau@google.com>
> 
> TBR=vegorov@google.com,cskau@google.com
> 
> Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
> Reviewed-by: Clement Skau <cskau@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: I879df17bd282d01468fa010b94a8c89afdb8cd0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145361
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-29 09:52:30 +00:00
Clement Skau 871983d8ae Revert "[VM] Fixes missing bits for new sync* transform."
This reverts commit 05b7f49c72.

Reason for revert: This appears to break other external targets. Rolling this and original CL back to unblock rolls until deeper investigation can be done.

Original change's description:
> [VM] Fixes missing bits for new sync* transform.
> 
> The missing part of the transform fixes an issue that manifested
> as a crash when running tests for [0].
> Which was caused by un-transformed yields in nested functions in sync*s.
> 
> The second half of this CL updates the type_checker tool for the new
> transform of sync*s.
> 
> [0] https://github.com/KhronosGroup/glTF-Validator
> 
> TBR: To unblock roll blocked by crash.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Change-Id: Ie20f351b16f2f87e92f0731fc96b0a5ea29e0300
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144948
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Clement Skau <cskau@google.com>

TBR=kustermann@google.com,cskau@google.com

Change-Id: Ided526100e7393375445545d0fe16806333b0d20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145360
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-29 08:35:52 +00:00
Clement Skau 05b7f49c72 [VM] Fixes missing bits for new sync* transform.
The missing part of the transform fixes an issue that manifested
as a crash when running tests for [0].
Which was caused by un-transformed yields in nested functions in sync*s.

The second half of this CL updates the type_checker tool for the new
transform of sync*s.

[0] https://github.com/KhronosGroup/glTF-Validator

TBR: To unblock roll blocked by crash.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: Ie20f351b16f2f87e92f0731fc96b0a5ea29e0300
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144948
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-04-29 06:56:14 +00:00
Clement Skau 1bf25798fa Reland "[VM] Remove unnecessary Closure.clone() from sync*."
This reverts commit 430c75b5fa.

Reason for revert: We probably don't care about the dartkb breakages.

Original change's description:
> Revert "[VM] Remove unnecessary Closure.clone() from sync*."
> 
> This reverts commit ca94ad7112.
> 
> Reason for revert: Appears to break dartkb.
> 
> Original change's description:
> > [VM] Remove unnecessary Closure.clone() from sync*.
> > 
> > Instead, this CL wraps sync*'s sync_op in an additional function
> > that captures local copies of the necessary closure state.
> > Notably this state includes the parameters of the original sync* function
> > as these also need to be cloned for each instance.
> > 
> > 
> > Note: a large number of .expect files have a small number of changes
> > due to the additional wrapper function, as well as some extra plumbing.
> > 
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > Commit-Queue: Clement Skau <cskau@google.com>
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> 
> TBR=vegorov@google.com,cskau@google.com
> 
> Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> Reviewed-by: Clement Skau <cskau@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-28 06:17:20 +00:00
Johnni Winther 3f18d37333 [cfe] Implement NNBD_TOP_MERGE update
Change-Id: I6b204b5d7def6a9d1dd4709e47f95eb102741489
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144763
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-27 16:28:08 +00:00
Johnni Winther 3c0e9642d2 [cfe] Ensure default type on generic forwarding stubs/method signatures
Change-Id: Iad6246c55f45953bffe2c3de4a2e30a32db347d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144820
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-27 16:25:18 +00:00
Clement Skau 430c75b5fa Revert "[VM] Remove unnecessary Closure.clone() from sync*."
This reverts commit ca94ad7112.

Reason for revert: Appears to break dartkb.

Original change's description:
> [VM] Remove unnecessary Closure.clone() from sync*.
> 
> Instead, this CL wraps sync*'s sync_op in an additional function
> that captures local copies of the necessary closure state.
> Notably this state includes the parameters of the original sync* function
> as these also need to be cloned for each instance.
> 
> 
> Note: a large number of .expect files have a small number of changes
> due to the additional wrapper function, as well as some extra plumbing.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-27 07:45:04 +00:00
Clement Skau ca94ad7112 [VM] Remove unnecessary Closure.clone() from sync*.
Instead, this CL wraps sync*'s sync_op in an additional function
that captures local copies of the necessary closure state.
Notably this state includes the parameters of the original sync* function
as these also need to be cloned for each instance.


Note: a large number of .expect files have a small number of changes
due to the additional wrapper function, as well as some extra plumbing.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-27 07:37:39 +00:00
Johnni Winther 6c21ed6314 [cfe] Support class hierarchy changes in ChangedStructureNotifier
Closes #40707

Change-Id: I0a9e0b11d0f597dfed7182dd869382057d04e5dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144821
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-26 19:51:29 +00:00
Dmitry Stefantsov 52df6d0eb7 [cfe] Clean up the remaining TextSerializationFailure statuses
Change-Id: I96ea244589ae9c103b0f061198ebd0b57b8184d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144401
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-23 06:28:48 +00:00
Dmitry Stefantsov 64b8ded48b [cfe] Leave unrecognized types in substitution unchanged
The CL allows type substitution to run over types with implementations
of DartType unknown to it.  Such types will be left unchanged in the
substituted type.

Closes #41199.

Bug: https://github.com/dart-lang/sdk/issues/41199
Change-Id: I335056ff02576d621a815dbd14fad3b3ffab017e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144361
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-22 13:18:07 +00:00
Aske Simon Christensen 8800e65ae1 [kernel] Specialized string (de)serialization.
This makes the string (de)serialization independent of the core library
UTF-8 encoder/decoder so we can change that without affecting kernel
serialization.

It also speeds up serialization and deserialization by a few percent.

Change-Id: I347e471ed0174cc5cb191335dd7c47e6eb3dad59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140293
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-04-22 11:46:24 +00:00
Dmitry Stefantsov 56df960ddf [cfe] Refine text serialization testing: skip free variables
The CL reduces the number of false positive cases in the round-trip
serialization unit testing by refining the verifier analysis.  Not it
doesn't attempt to make the round trip over the sub-trees containing
free variables.

Change-Id: Ib6fb2e72f7543ea7d99c5273c337801f3ad1bec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144285
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-22 10:27:08 +00:00
Jens Johansen 4084c4cc24 [kernel/CFE] Use kernel 'Version' class for versions
Define a "Version" class in kernel that allows easy comparison between
versions (e.g. a < b, a >= b etc).

Use this Version class in CFE.

Change-Id: I2f382e7bb3c2083258743b9b66a909a88d575dbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144283
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-04-21 09:44:52 +00:00
Dmitry Stefantsov 5b342eb9a3 [cfe] Refine analysis of text serialization verifier
The verifier now determined what is supported for the serialization
more precisely, resulting in less TextSerializationFailures in the
unit tests.

Change-Id: I3728f56c9cb5042420b6a13acb2ed06f4be6a924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143809
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-20 10:01:46 +00:00
Dmitry Stefantsov d5dea0056b [cfe] Improve diagnostics on text serialization failures
This CL also includes the following changes:
- The .registerTags() method is added to the Case combinator.
- The actual canonical names' root is passed into the deserializer.
- Some text serialization failures are fixed and the corresponding
status entries in text_serialization.status removed.

Change-Id: I222dfa3fc348dddf83e0c6edb92f15d08b8e73e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143803
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-17 10:53:47 +00:00
Jens Johansen a85a7fc254 [kernel/CFE] Better mixed compilation mode handling
* Throw a specific error on mixed compilation mode; let the incremental
  compiler ignore that error when trying to initialize (i.e. it doesn't
  initialize from it, but it doesn't show any warning either).
* Allow some mixed mode stuff: Eventually the SDK should be in agnostic
  mode, so we should allow mixing agnostic with non-agnostic.

Fixes #41493.

Change-Id: Idb33fb31afe6bbba6d74134cb722ca825751898b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143583
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-17 10:22:46 +00:00
Dmitry Stefantsov ae0eca8318 [cfe] Add text serialization support for libraries
Change-Id: Ia36efcc433df573abf2f82c1b402fa031276c652
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143587
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-17 07:27:06 +00:00