Commit Graph

267 Commits

Author SHA1 Message Date
Johnni Winther 246b23e5be [cfe] Implement late lowering for local variables.
Change-Id: I18f848561f7eca61f662f8083f7ca1451a8a0b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125605
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-11-20 08:30:18 +00:00
Dmitry Stefantsov e4a60912a7 [cfe] Use library's NNBD opt-in status while serializing supertypes
Change-Id: Id1ab5fd9a36b4aadb213febb0e1ae2eba968244d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124331
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-11-08 10:24:36 +00:00
Dmitry Stefantsov b4554c1215 [cfe] Make nullability a required parameter for types
Change-Id: Id787291294cafb15cf4ecad4a9db9da4c6066638
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124135
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Auto-Submit: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-07 13:24:47 +00:00
Jens Johansen f91ef3afd7 [kernel] Deprecate Library.isExternal
We're deprecating kernels Library.isExternal as it wasn't used for
what it was originally intended. It will hopefully go away entirely
soon.

Change-Id: If363c50af5607febae68865875af452c106fff85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123721
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-04 09:24:02 +00:00
Dmitry Stefantsov 2897bebdef [cfe] Resolve serialization mismatch due to variance computation
Change-Id: Id38c63f5bd659f21423d802fd6180aa04465712c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123406
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-10-31 10:15:29 +00:00
Dmitry Stefantsov 9910fa8454 [cfe] Implement the first part of NNBD-aware isSubtypeOf
This CL is a squashing of the following smaller CLs:

* https://dart-review.googlesource.com/c/sdk/+/120669/
* https://dart-review.googlesource.com/c/sdk/+/120670/
* https://dart-review.googlesource.com/c/sdk/+/121331/
* https://dart-review.googlesource.com/c/sdk/+/121381/
* https://dart-review.googlesource.com/c/sdk/+/121383/
* https://dart-review.googlesource.com/c/sdk/+/121620/
* https://dart-review.googlesource.com/c/sdk/+/121707/
* https://dart-review.googlesource.com/c/sdk/+/122144/
* https://dart-review.googlesource.com/c/sdk/+/122360/
* https://dart-review.googlesource.com/c/sdk/+/122381/
* https://dart-review.googlesource.com/c/sdk/+/122783/
* https://dart-review.googlesource.com/c/sdk/+/122787/

Change-Id: I9d850f531f0fce07055ff9b5cd39abb605752005
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122868
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-10-25 16:37:39 +00:00
Jens Johansen 18fa7485ad [kernel] Read ContinueSwitchStatements in nested FunctionNodes correctly
Closes #39040

Change-Id: I8ae9a89cfd750dddbf0a994e93d9b2aa2d46490c
Fixed: 39040
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122386
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-23 08:34:27 +00:00
Johnni Winther c6cb89c622 [cfe] Replace child nodes in parent nodes on post-traversal
Replace child nodes in parent nodes on post-traversal instead of using
TreeNode.replaceChild and TreeNode.replaceWith

Change-Id: I2f6f908dce0cd38f1d9a68d4183810e2e0cdca71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121622
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-17 12:56:49 +00:00
Kallen Tu 7b135fc7a6 Differentiate between legacy and sound covariance.
Used to separate the behaviour without the variance experiment flag
turned off and with the flag turned on. Allows for more specific error
descriptions and allows the backend to avoid emitting variance
annotations for legacy covariance and only when the experiment is
enabled, otherwise there is no way of knowing whether the variance is
user specified.

Change-Id: Ia3070a1358e9b0fef10a3ce5057df881b9659832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121140
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-16 18:18:06 +00:00
Jens Johansen b8aef62abd [kernel] Effectively clear extension members before adding new ones when loaing dill if 'shouldWriteData'
Prior to this change, loading a dill with extensions in it twice,
would mean getting the extension members twice.

Change-Id: I766a4a6b0ade98ce9af803db0c696e64821e015a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121064
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-11 07:33:03 +00:00
Jens Johansen f09edd1d32 [CFE] Add incremental serializer
Add an incremental serializer that can be used to avoid re-serializing
the same thing again and again.
It does this by grouping libraries into Components / bundles,
serializing them individually and using the concatenated dill feature to
output the wanted data --- just potentially faster if we had the data
in cache.

Note that the serialized output might contain *more* than the input given
if we cached the wanted data into a bigger bundle.
The output will always be "closed" though, i.e. if the stuff that is
included that is too much added a new dependency, that dependency will be
included as well.
This should generally make it safe, although one can imagine situations
where it could pull in lots of dependencies that it wouldn't otherwise
have.

It is being driven by the incremental compiler which makes sure to
invalidate the cache when the data changes.

Except for situations where the libraries are changed externally after
being serialized, but before being serialized again, where one then wants
the updated library serialized, the feature should be safe.

Change-Id: I2a504abe6dbb68434c3b04abff13480ef72a6a6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120786
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-09 13:28:12 +00:00
Jens Johansen 6ebf3f0889 [kernel] Clear a few lists when loading dill
Prior to this change, loading the sdk dill twice for instance would
result in additional exports as well as parameter counts doubling,
essentially destroying the result.

Change-Id: I4d694bec1926d6df6572e9bb36e8a88ec0822e27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120785
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-09 10:34:07 +00:00
Johnni Winther 9276d50fdc [cfe] Remove Severity.errorLegacyWarning
Change-Id: I1cc7a34af307b9edee4c92e43e8607a450cf471d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120585
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-10-08 09:16:47 +00:00
Ryan Macnak d65a60db00 [vm, bytecode] Populate bytecode cache when initializing an incremental compiler from a kernel file.
AST
"without_change_elapsed_time_ms": 2863,
"implementation_change_elapsed_time_ms": 6009,
"interface_change_elapsed_time_ms": 5888,
"with_coverage_time_ms": 2884

BYTECODE BEFORE
"without_change_elapsed_time_ms": 5216,
"implementation_change_elapsed_time_ms": 8517,
"interface_change_elapsed_time_ms": 8895,
"with_coverage_time_ms": 5462

BYTECODE AFTER
"without_change_elapsed_time_ms": 3384,
"implementation_change_elapsed_time_ms": 8139,
"interface_change_elapsed_time_ms": 8073,
"with_coverage_time_ms": 3473

Change-Id: Ic8e1c183070cb6019ea48f16c04ea5363df41a97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119620
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-02 23:53:42 +00:00
Jens Johansen 84848b1467 [kernel] Add VM pragma prefer-inline to certain methods in kernel serialization
In my measurements this changes the time it takes to write the sdk by
-11.1274% +/- 0.624366% (via slightly modified
pkg/kernel/test/binary_bench.dart AstToBinary out/ReleaseX64/vm_platform_strong.dill)

Change-Id: I4c5cbe17f42b70ef361b2edda0b33c8fc1727b63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119540
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-01 12:03:42 +00:00
Johnni Winther 8218857032 [kernel] Handle Extension in BianryBuilderWithMetadata
Change-Id: Iba967214e592d6836863ac523850ec573bd40998
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119335
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-01 08:15:50 +00:00
Ryan Macnak 14983a2941 [vm/bytecode] Add timeline events for major compilation phases.
Change-Id: Ie2a1f8a5979bb58133535b7698c5137d4ab2b046
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118648
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-09-30 16:36:09 +00:00
Kallen Tu 134839098b Serialization/Deserialization for Variance in Type Parameters.
Change-Id: I9bce86293c23c4b9d2b8011e866f04bcab80e74a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118881
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2019-09-27 16:57:00 +00:00
Dmitry Stefantsov adbfe7ce05 [cfe] Update the rules for TypeParameterType.nullability
Closes #38220.

Bug: http://dartbug.com/38220
Change-Id: If200e1173bd36997715003cc87c35a8e17f4e115
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118561
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-09-25 08:15:47 +00:00
Ryan Macnak 79cc54e519 [kernel] Avoid trampling sources when loading split components.
Change-Id: Ia906d6ca90cc2dae392a50ccb03c6a76cf4b3907
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118475
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-09-25 00:13:44 +00:00
Dmitry Stefantsov 8d487b4fdc [kernel] Recover TypeParameter.variance while deserializing
Change-Id: I46d78dc5e98c5e3707d448eccfd6bdabb1c25ddb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/91827
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-09-23 15:17:38 +00:00
Johnni Winther 94dd49cdb6 [cfe] Add NullCheck expression node
Change-Id: I17223bffa5dec7b1ce7652b21bf1a3381137f4f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118380
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-09-23 10:04:48 +00:00
Jens Johansen f35f9e8e24 [kernel] Don't lazy load classes when dills are concatenated
We have two layers of laziness.
Lazy loading functions (the old one) disables itself when loading a
concatenated dill file.
Lazy loading class content (the new one) forgot to do that while not
being geared towards it either.
This means that it - when loading lazily - can look into the wrong
string table, the wrong link table etc.
This CL brings the laziness for classes on par with the laziness for
functions in that it is now disabled when loading a concatenated dill
file.

Change-Id: If3449d5aff34287221a14fb7e940779d93b1e7b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117145
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-09-13 12:52:52 +00:00
Dmitry Stefantsov bdf237fa77 [cfe] Add a bit to Library to inticate if it's opted in for NNBD
Closes #37682.

Bug: http://dartbug.com/37682.
Change-Id: Ibe21cd0a1eac25a2883d2e2241d7476ca627edba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114857
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-09-12 12:15:56 +00:00
Jens Johansen ce5556ab36 [kernel] Load classes lazily
This CL gives the option to load classes lazily (on by default),
meaning that fields, procedures, constructors and redirecting
factory constructors of classes are not initially read,
but instead read when (or if) needed.

The idea being that many classes aren’t needed, and that
spending time on reading them is thus just a waste of time.

This is especially true in modular compilation where a lot
of modules needs to be given as input as the compilation at
hand might technically rely on it, but in practice only very
few of the classes are actually needed (or very few classes
actually need their members).

The below numbers are comparing a VM without this change and without
the lazy class hierarchy member lists change with
b31566b297 (the base change for those
two changes).

For running a simple hello-world script, on my machine 500 times
and doing statistics on it I can measure the following differences:

With verbose, from kernel_service startup to compile complete:
Difference at 95.0% confidence
        -17.8 +/- 0.555817
        -24.3455% +/- 0.760206%
        (Student's t, pooled s = 4.48379)

With verbose, total runtime measure by `time`
Difference at 95.0% confidence
        -19.346 +/- 0.905217
        -12.0333% +/- 0.563051%
        (Student's t, pooled s = 7.30242)

Without verbose, total runtime measure by `time`
Difference at 95.0% confidence
        -17.862 +/- 0.842905
        -12.0635% +/- 0.569276%
        (Student's t, pooled s = 6.79974)

For running a number of modular compilations I’ve recorded an
improvement in actual runtime in the order of 20-37% depending
on the circumstance. In a real build system, though, the
difference seems to be more in the order of around 5%.

Change-Id: Id329bcf2b01d12c12d7a49f2b8abacd9c2447f05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115703
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-09-12 08:08:33 +00:00
Aske Simon Christensen 0242f0c724 [kernel] FileUriExpression node
Change-Id: I8ea3cbeb17d555cebd6d693fbf2bb3148e9f2db3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114321
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-09-06 12:22:09 +00:00
Johnni Winther 34004f7f6b [cfe] Support modular compilation of extensions
Includes serialization/deserialization of Extension and
ExtensionMemberDescriptor.

Change-Id: I04df581355b0d6f9e6bfa638241c8b7f210d3ce5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115369
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-09-05 11:19:53 +00:00
Jens Johansen 4bd13a74d9 [kernel] Better error on empty input
Change-Id: Ia1097f7a6ecfb41928749533e7adebcc8063ac64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115366
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-09-04 12:41:42 +00:00
Jens Johansen f278451729 [CFE/kernel] Spell check kernel too
Change-Id: I57c91a61a186d9334d7af189427e78bdcb156aa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114849
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-28 13:02:51 +00:00
Jens Johansen 8621e63190 [kernel/VM] cleanup unused dill tags
Change-Id: I76a3985abf7806f038cdb6971e526accd7cc20a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114605
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-28 09:30:04 +00:00
Johnni Winther eae781c73e [cfe] Add Field.isLate, VariableDeclaration.isLate and VariableDeclaration.isRequired
Add support for the `late` modifier on fields and local variables in
CFE, and `required` on named parameters When using the option
--enable-experiment=non-nullable the `isLate` and `isRequired` flags will be set
accordingly on Field and VariableDeclaration nodes.

Closes #37686
Closes #37684

Change-Id: If37fc93defdabc5cc974f3f068f57752a665f4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113036
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-16 19:39:05 +00:00
Johnni Winther 271ad96813 [cfe] Create Extension nodes for extensions
Adds Extension node to kernel/ast, currently with serialization. This
is needed to support resolution of extension methods through dill
boundaries.

Adds (Source)ExtensionBuilder for build Extension nodes and
DeclarationBuilder as common superclass of ClassBuilder and
ExtensionBuilder.

Change-Id: Id945a40452f2729f9a4f390477dd6c76f9030eaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112256
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-09 20:46:01 +00:00
Dmitry Stefantsov f3139f57b4 [cfe][nnbd] (De)Serialize nullability modifiers in .dill files
Closes #37688.

Bug: http://dartbug.com/37688
Change-Id: Ie3aa8fe09d859cd65bbb58da3f56297483b7b725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112085
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-08-07 10:06:40 +00:00
Jens Johansen 69ae29076a Default language version if nothing is specified
A kernel library will say it has the newest language version if no
language version is set.
This basically preserves the current semantics of always being on the
newest version (if nothing is explicitly done), e.g. if creating a kernel
library by hand and not setting it.
The front_end also utilize this and just doesn't set it, if it isn't set.

Change-Id: I033fef13626ee034030ba8fc9d141b182ba1a5ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111739
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-06 09:13:29 +00:00
Jens Johansen fd7baa4fd9 [CFE] Serialize language version
Change-Id: I6ea448df722a7e1e51c31f06d42bfbe743855a45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111725
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-05 09:14:09 +00:00
Aske Simon Christensen 50efd7f187 [Kernel] Add list of unused arguments to InstanceCreation nodes.
During constant evaluation, unused arguments to a const constructor are
thrown away after evaluation, since their values do not affect the
resulting instance constant. If such an unused argument ends up
unevaluated, any errors that would arise in the final evaluation are
not reported.

This CL adds space in the Kernel AST for saving these unevaluated
expressions so they can be checked during final constant evaluation.

Even though this is an incompatible change, no update is needed to the
VM code (except for the version bump), since the VM does not support
InstanceCreation nodes in the first place.

Change-Id: I4752562c1164efbba79eb018c15b07ed8354ce5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105761
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-06-13 09:42:26 +00:00
Jens Johansen 5eff2a0374 Split CanonicalNameError, no warning if CanonicalNameSdkError
Prior to this CL, we would issue a warning whenever a CanonicalNameError
was encountered.
This is in principal a good thing, but because we currently have no way
to detect if the sdk we get is the one we expect
(by any other measure than when it issues a CanonicalNameError) we often
issue these warnings for no "real reason" whenever, for instance,
the flutter sdk changes.

This CL splits the CanonicalNameError in two such that errors with
references to the sdk ("dart:" libraries) issue CanonicalNameSdkError
instead, an we then handle that differently. Namely we silently ignore
the error (i.e. don't issue a warning) and just don't initialize from
dill.

This should remedy the situation and be strictly better than to always
swallow CanonicalNameErrors.

Bug: 36032
Change-Id: Idbae0b5ee5b9843a5dbeb49b3c65ae25f5962e36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105240
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-06-06 10:10:46 +00:00
Jens Johansen 099af47a69 [kernel] add ability to disable offsets for bazel worker to use
This is a lightly modified version of Jennys CL @
https://dart-review.googlesource.com/100275

Change-Id: I46a1665d84d04602af1f338cf963bc25b4e6b25c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101280
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-05-21 07:55:10 +00:00
Jens Johansen ed8e4255a4 Proposed fix to #36644
TL;DR: Unbind canonical names doesn't do what you think it does and
probably shouldn't (ever) be used. This CL stops using it in a few places.

Longer version:

When loading a dill file it:
- First loads the table of canonical names. These have no references yet.
- When a canonical name is asked for its reference it creates one if it
  doesn't yet have one.
- When loading, for instance, a library, it asks for the reference.

When unbinding a canonical name:
- It removes itself (the canonical name) from the reference
- It removes the reference in itself
- Note: Whatever has a pointer to the reference keeps it, and the
  reference points to whatever node it already pointed to.

This also means, that if we have a dill file that's split in two and:
- Load #1
- Load #2
that works fine, but if we
- Load #1
- Unbind canonical names
- Binds canonical names
- Load #2
stuff is not bound correctly (and an error is thrown).

And - the cause of this bug:
- Load #1
- Load #2
everything is fine
- Unbind canonical names
- Binds canonical names
- Load #2'
stuff is not bound correctly --- references points to stuff loaded as #2,
not as #2'. On top of being weird, wrong and confusing it also caused wrong
things to be but into the class hierarchy which ultimatly caused the crash.

This CL fixes it by not calling unbind and force loading of dill files
(at specific call sites) to create new libraries
(and in the process overwriting references ".node").

Revert "[dartdevc] Retry ddc incremental compile on crash"

This reverts commit ecdbdf00b8.

Revert "[kernel_worker] retry on failure"

This reverts commit 43eebea5a3.

Fixes #36644

Bug: #36644
Change-Id: Id8f548179e6a409b01f2ebfa3219f94cb64b1c05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100380
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-04-26 07:18:28 +00:00
Jens Johansen 1555594ddb Include a per-library index of owned sources in kernel
This for instance allows the VM to include all patches
(e.g. the previously missing `runtime/lib/date_patch.dart`)
in what's returned from `LoadedScripts()`.

Over time this also allows for `LoadedScripts()` to be simplified and
become faster (it's currently something like O(m + m*n) where m is the
number of results in DictionaryIterator(*this) and n is the number of
returned scripts).

Change-Id: I4b5a6a0fe666b774fc0987d099ed02e81ac97b43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98660
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-04-11 12:40:49 +00:00
Dmitry Stefantsov 4ab4545ff7 [cfe] Add type and file offset to constant expressions
Closes #36471.

Bug: http://dartbug.com/36471
Change-Id: I5ac294057f2f69f1a8edfdf1106f65908fc257ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98677
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-10 09:55:36 +00:00
Aske Simon Christensen f63eaab3af [kernel] Add instance creation kernel node.
This is used in constant evaluation to represent const constructor
invocations with unevaluated field values or asserts.

Change-Id: I1d2d60a18f967a4dd195b3b5895db9a126c47803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98561
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-04 12:22:50 +00:00
Jens Johansen e9e0daee5c Add importUri and fileUri to Source.
This will enable the VM to map URIs to package-URIs to solve problems
such as https://github.com/dart-lang/sdk/issues/35859

Change-Id: I15520325a5b81a99a7e3f56c2e35fd775d9da946
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96905
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-03-20 08:44:33 +00:00
Aske Simon Christensen ff55d429f6 [kernel] Collection concatenation nodes.
These arise when the constant evaluator partially evaluates collections
containing spreads or control-flow constructs with unevaluated
subexpressions. They are removed by the final constant evaluation.

Change-Id: Icdd155c4805cbcefe6aa4b45c2f85ec258e7bd36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95760
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-03-08 13:08:55 +00:00
Aske Simon Christensen 2b2e71770c [kernel] Add SetConstant node to Kernel.
Change-Id: I83da1afc9f15009c650a871a51ca8171b482d4df
Reviewed-on: https://dart-review.googlesource.com/c/94863
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-03-04 10:20:56 +00:00
Kevin Millikin 38259ca3c8 [Kernel] Change block expression to have a block body
Having a block as body instead of a list of expressions simplifies
code handling block expressions.  Since it is always a block, it can
be left untagged in the serialized representation so the serialized
representation is not changed with this change.

Change-Id: I3c34f663041ff8cb4a530c2d6a148343e59c68fe
Reviewed-on: https://dart-review.googlesource.com/c/94223
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-02-25 14:20:07 +00:00
Kevin Millikin c9b8bae4e6 [Kernel] Add BlockExpression to the Kernel language
This is not yet used or tested.

Change-Id: Id050802926ad6452df3c39ace12ea5dd56d4faaa
Reviewed-on: https://dart-review.googlesource.com/c/87970
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2019-02-22 12:38:26 +00:00
Jens Johansen eb956a2516 Add synthetic bit to Library flags
Fasta can generate synthetic libraries.
Previously we didn't include them when serializing, but that leaves
references in the binary to libraries that doesn't exist which isn't
ideal.

This change includes them, and adds a flag to kernel Libraries such that
we know they are synthetic.

Change-Id: Ied25a21cd1f384d318347021bc7ec18dae3a4e05
Reviewed-on: https://dart-review.googlesource.com/c/91722
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-01 11:00:26 +00:00
Aske Simon Christensen f066c05319 Rename klass getter on InstanceConstant to classNode
This achieves consistency with similar getters in the API.

This is technically a breaking change, since it changes a published
part of the Kernel API. Since the constants API is relatively new and
so far only used internally in the AOT compiler, the change is
expected to be unproblematic.

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

Change-Id: I3ca30922580d226ccbdb6f77496983c21ef2102b
Reviewed-on: https://dart-review.googlesource.com/c/90220
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-01-28 13:31:05 +00:00
Kevin Millikin c9a55b437a [Kernel] Remove the dedicated fromEnvironment constants
These can be represented as an unevaluated static invocation.

Change-Id: Ib827345f1f65a09f1a856eae33366722a2e613d2
Reviewed-on: https://dart-review.googlesource.com/c/90008
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-01-18 10:10:42 +00:00