Validates a yaml format encoding a native asset mapping, and
synthesizes a component containing a pragma with this information.
Yaml example:
```
format-version: [1,0,0]
native-assets:
linux_x64:
'package:foo/foo.dart': ['absolute', '/path/to/libfoo.so']
```
Generated format example:
```
@pragma('vm:ffi:native-assets': {
'linux_x64' : {
'package:foo/foo.dart': ['absolute', '/path/to/libfoo.so']
}
})
library;
```
TEST=pkg/vm/test/native_assets/synthesizer_test.dart
TEST=pkg/vm/test/native_assets/validator_test.dart
In a follow-up CL, we will consume the yaml from `gen_kernel`
and consume the pragma in the VM for `@FfiNative`s.
Bug: https://github.com/dart-lang/sdk/issues/49803
Change-Id: Ie8d93b38ff4406ef7485e5513807e89b2772164b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272660
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Add AwaitExpression.runtimeTypeCheck to support easy backend
implementation of runtime type check.
In response to https://github.com/dart-lang/sdk/issues/49396
TEST=pkg/front_end/testcases/general/issue49396.dart
Change-Id: I13b9b14566ebc34cdb0811c16a262421417b68e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270723
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
I've sampled (eagerly) reading the VM platform, a compilation of
dart2js, a compilation of "flutter gallery" and a compilation of a big
internal app, and reordered switch cases accordingly.
I can't measure any difference in runtime, but have a hard time
thinking it's not better.
I've included the tool that does the sampling.
Change-Id: If61c5a95265229c238020264010553f281fec49c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267362
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
These are needed for the 'views' feature. No nodes are created yet.
TEST=existing
Change-Id: I0c7a34e460a4d17bd39ee23e7aa6bd8851f4275e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266620
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
On a big internal app this saves 6.5 MB of FunctionTypes.
Change-Id: I5064f92996f615ff586a2776de6775aabc2865bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266941
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
When loading the sdk, a compilation of dart2js and a big internal app
without lazy loading (but with useGrowableLists: false though that
part shouldn't matter) I see these changes:
Loading the sdk: Saving ~1.17 MB Public and ~0.33 MB Private.
A total of ~1.5 MB.
Loading a compile of dart2js: Saving: ~7.0 MB Public and ~1.1 Private.
A total of ~8.1 MB.
Loading a compile of a big internal app: Saving ~74.7 MB Public and
~25.4 MB Private.
A total of ~100 MB.
Specifically, when loading a big internal app I see these changes:
Change, without lazy loading (and useGrowableLists: false):
Current memory: -122.88 MB
Peak memory: -92.16 MB
Heap: -102.4 MB / -92.16 MB
_PublicNames: -74.75 MB (2 mio+ fewer)
_PrivateNames: -25.4 MB (800,000+ fewer)
Change, with lazy loading (and useGrowableLists: false):
Current memory: +10.24 MB (yes, more).
Peak memory: +10.24 MB (yes, more).
Heap: +2.2 MB / +2.5 MB (yes, more)
_PublicNames: -0.76 MB (20,000+ fewer)
_PrivateNames: -11.3 KB (some hundred fewer)
Change-Id: I710d966aacf2ab184139a1fb7e65e12551e830ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266386
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
The old `native "<name>"` syntax was lowered to `@ExternalName()`
annotations. Those have been deprecated in favor of
`@pragma('vm:external-name')`. Users have now been migrated and we can
therefore remove the VM support for `@ExternalName`.
Issue https://github.com/dart-lang/sdk/issues/28791
TEST=ci
Change-Id: I69febe49f59627659c540dd50ad0fbf704b6c3a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266387
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Looking at only the amount of data used by interface types after
loading a dill completely (lazy loading disabled or everything read):
Loading the sdk: Saving ~3.3 MB.
Loading a compile of a simple flutter app: Saving: ~11.6 MB.
Loading a compile of dart2js: Saving: ~18.2 MB.
Testing on a big internal app I see savings of 200+MB.
In my tests it reduces the amount of interface types by a factor of between 7 and 12.
Looking at the VMs reported memory, peak memory and heap usage, without
lazy loading for the big internal app we're talking ~200 MB savings,
with lazy loading (without loading anything) we're generally
talking a ~10MB saving (process current an peak memory,
but where the heaps total capacity was ~4 MB bigger).
https://github.com/dart-lang/sdk/issues/50161
Change-Id: Ic6601e907fb3127694f54e0865fe7c5a7057d9f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266383
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The initializer was built in an 'inferred' rather than a 'required'
constant context, meaning that it would be encoded as a declaratively
constant literal instead of a structurally constant literal.
Closes#50132
Change-Id: I58b995d879efd2ec374b711718b63ac8f122bcfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262349
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Instead of relying on descriptors, we now just take in an export
map that was already precomputed for a given class. This map is
then used to create an object literal that maps property names to
their Dart targets.
Change-Id: I431cbfb3978eb41543bb46859612e13da7637e79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261764
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This reverts commit a07a0333c3.
Reason for revert: Seems to increase AOT build times significantly (see b/251787563).
Original change's description:
> [kernel] Create Source.sourceCode as view of the binary bytes
>
> This saves about 400MB heap when loading a 900MB .dill file.
>
> Change-Id: I5a09b06764cb493aab8dade2afb4665e12688133
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255802
> Reviewed-by: Jens Johansen <jensj@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Ia7edd7d5e711a33bd037f6edbe52ba2fb561709c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263101
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
We had multiple implementations of this logic and with the introduction
of IntersectionType some where not updated. Instead, this is now added
as a property of `DartType`.
Closes#50112
Change-Id: I2d7a3943b0577d905a1861aa35b0552578766993
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262960
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This saves about 400MB heap when loading a 900MB .dill file.
Change-Id: I5a09b06764cb493aab8dade2afb4665e12688133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255802
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
If a concrete class implements an interface containing a name that's
private to a different library, any attempt to invoke that name will
result in an exception getting thrown. Previously, such attempts
would result in the call being diverted to noSuchMethod.
This change closes a loophole in Dart's privacy system, and paves the way for
a future implementation of promotion for private final fields (see
https://github.com/dart-lang/language/issues/2020).
Bug: https://github.com/dart-lang/sdk/issues/49687
Change-Id: Ie55805e0fc77dc39713761a80a42c28bd0504722
Tested: language tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255640
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
This change adds minimal support for RecordType, RecordLiteral,
RecordIndexGet, RecordNameGet and RecordConstant kernel nodes to TFA.
TFA is *not* yet extended with the ability to infer record types.
TEST=language/records/simple
Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I7c5eb860c6a5cb263e4d1bb55ad230e5c51f47c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259520
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This introduces a MemberName abstraction that supports the late
computation of member names, taking privacy and synthesized names
of unnamed extensions into account. With this feature, the unnamed
extension are now more directly handled as having no (known) name
which avoids the clash between the eagerly synthesized named of
unnamed extensions in different parts.
Closes#48765
TEST=existing
Change-Id: I62c00ace017141ecbc61eeecb275d0211f341c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258800
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Before this CL the verifiers `visitInterfaceType` would start by calling
`node.visitChildren(this);` and finish by calling
`defaultDartType(node);` which calls `defaultNode(node)` which calls
`node.visitChildren(this);`. This means that we call `visitChildren`
twice which means exponential --- e.g. the added test with nested Lists
(List mentioned 40 times) the innermost type would have been visited
549,755,813,888 times (that's 500+ billion times) (for a total of
1 trillion+ visits to types for that alone).
Fixes https://github.com/dart-lang/sdk/issues/49780.
PS: We don't want to run the formatter on that either. It doesn't
exhibit bad speed-wise behavior but the output isn't exactly pretty.
Change-Id: Ibb2f0d2669511934badb562cb96ee439bd44bebd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256121
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This adds the flag `isEnumElement` to the `Field` node and uses it
to recognize enum elements for the exhaustiveness computation on
switch statements.
Closes#49697
TEST=pkg/front_end/testcases/general/issue49697/main.dart
Change-Id: I21852f3b063329e043639c825054f538c8ed6536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255808
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Deletes the outline stubber as it's not necessary on any backend.
DDC should compile the entire sources and outline dill in one step.
dart2wasm operates similarly, and so only needs the modular transformer.
dart2js moves the erasure to a global transform.
Also, this CL reverts now unnecessary plumbing that was needed for the
outline stubber.
Change-Id: Ic085c4fad5a6bdfc7d6916f7fa575c6ef9b20110
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253000
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Closes https://github.com/dart-lang/sdk/pull/49478
TEST=Manual
GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Types in constants and supertypes need to be visited in case
they include @staticInterop types.
Fixes a bug in caching in the constant replacer.
Change-Id: Icde8b7170a8806d6a1995cad57a9788893b7772f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249441
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Tested: Standard CQ
Change-Id: Ic52d4d38a5b117dfcdc778dedfac08315ca30a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251541
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
For now it's only done for unevaluated constants as that's where an
issue has been observed.
This CL further more limits the default nesting depth for both
expressions and statements (e.g. when .toString() printing an ast node)
to 50. Again this has been shown in one case to be a good place to
stop an (exponential time) issue from happening.
Change-Id: I6affb2846a6587542ffce3f8d6914a4209b08322
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251103
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This change removes kernel transformation which was used to
desugar async/async*/sync* functions in the old implementation of
async/async*/sync*.
The useful part of the transformation is retained in
pkg/vm/lib/transformations/for_in_lowering.dart.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ic70c1fb35162a31bcc22eac3a8f6488b61e945b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249944
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Adds a replacement visitor for Constant types using null as a
sentinel value for whether a subnode has changed or not (except
in the case of TreeNodes in order to match existing Visitor
semantics).
Change-Id: Iaaab1b1c608af07f36ece08071b3d703884cd91b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248944
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This is in preparation for supporting `augment super` access of
augmented members.
Change-Id: Ib306ef59faa7c9ad735304545aa414f6b21e2596
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249862
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Fixes#49301
From https://github.com/dart-lang/sdk/issues/49301#issuecomment-1165536192
Adds referenceFromIndex to outline transformations so that the eraser
can use it to find the reference for the stub if it was already created.
This is needed when the module where the stub exists is invalidated.
Since references in other modules should still be valid, we should
attempt to get that reference.
Change-Id: I5905a002480444aecd57de650cd439bdc34d4eba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249729
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
In response to https://github.com/dart-lang/sdk/issues/47406
The error is currently not reported if the mixin declaration is from
an outline dill.
Change-Id: I94a61d6409d0c238614d9f377b5f324153360bc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249184
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This is a step towards improving the semantics of these nodes.
TEST=existing
Change-Id: I95bdb86790414b38af73e9e932cc228b3c0f1f6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249040
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
This for instance avoids an exponential blowup that would previously
have occurred in certain cases.
Change-Id: I258d8153e75f7059bca346826b5dec62cc1bac84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Fixes b/235393918
@staticInterop replaces factories with a new named node, a static
method. In order to persist this transformation in modular
compilation, this needs to be done to outlines that can then be
consumed by the source library. In order to allow erasure at the
time of 'performOutlineTransformations', coreTypes is added to that
API.
Change-Id: I90d17fff8bbe143982fcd12cfb06dc3e8d58781a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247928
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This enables the serialization to handle references to libraries that
are not part of the serialized libraries. This is a step towards
removing the need to call computeCanonicalNames from outside the
serialization and to always use library filters for serialization
of a subset of the libraries in a component.
In response to b/235393918
TEST=existing
Change-Id: I48cd8b027795850ac2411a80e4b55efd517bb2cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248588
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This changes the encoding of super access without a target to use
InvalidExpression, similar to static access without a target, instead
of a SuperMethodInvocation/SuperPropertyGet/SuperPropertySet node with
a `null` interface target.
This is in preparation for using (Abstract)Super* nodes with the same
precision as Static*/Instance* nodes.
Change-Id: Ie0320c72241162a4c32a904a6608c9d29c2df401
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248780
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This adds the capability to trigger inference through
TypeBuilder.build when it is passed a ClassHierarchyBase object.
TypeBuilder.isExplicit is added to signal when a type can be built
without the need for inference. NamedTypedBuilder and
FunctionTypeBuilder are split into _Explicit* and _Inferred* subtype
the latter of which support late building of the type.
The new _Inferred* builders are not used yet.
Change-Id: I66fd669ae47e6eb3079461af31477215c262dcbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247220
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Tested: Added flag to text output and updated expectation files
Change-Id: I44bb82242ad608b19894e22c41d8404c5003c2d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245982
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This CL brings the CFE into agreement with the spec and the Analyzer
for function types with optional positional parameters by adjusting
the number of such parameters.
Close https://github.com/dart-lang/sdk/issues/49044
Change-Id: I0d15bb5b4b10c5ca18b78c985e3424899155a3c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245367
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This adds AbstractSuperMethodInvocation, AbstractSuperPropertyGet,
AbstractSuperPropertySet nodes which are to be used for super access
in mixin declaration.
These super accesses do not resolve to their statically bound target
but instead the interface target on the types in the 'on' clauses, and
need to be updated to the statically bound target upon mixin application.
This has lead backends to disregard the interface target provided by
the CFE and instead always compute targets for super accesses.
This change is a step towards creating a clear separation between the
two use cases, enabling a more precise handling of super accesses.
The new nodes are not created yet with this CL.
TEST=existing
Change-Id: I70ea9baf5b4b970b10cc72b7409633d270d57755
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245168
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This fixes a bug where this method is showing up in coverage reports.
Also needed some plumbing in the VM for this flag, because we were
ignoring it before.
Change-Id: I9200a16dab488f5f880b9797243bd2f39de993b3
Fixes: https://github.com/dart-lang/coverage/issues/386
TEST=Added a source_report_test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245041
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
This CL moves the bounds checking into the TypeBuilder instead of
performing it from the outside on the computed DartType node.
This solves several problems:
1) Errors are now reported on the type in the code instead of the
declaration which holds the type.
2) Checking of type aliases (both function and nonfunction type
aliases) is now handled correctly in all cases. This achieved by
computed the aliased type (containing TypedefType nodes)
internally and performing the checking on this type, and only
convert the type into the unaliased version (without TypedefType
nodes) after checks have been performed. Previously this handled
through the FunctionType.typedefType property for function type
aliases and through and incomplete work-around for nonfunction
type aliases.
3) With 2) FunctionType.typedefType is no longer needed and is
removed.
TEST=general/bounds_*
Change-Id: I7653bca5ccb0ebf4b3553828a298d1ad918ef235
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243722
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
It should not be necessary to ever run `pub get` for a package which is
not published. All packages used in the SDK are controlled by a single
package config, so it's not necessary to declare versions or paths for
any packages.
Remove all dependency overrides.
R=devoncarew@google.com
Change-Id: Icb328813b471f35ee4c99995f4e90aac4d8ed438
Tested: Covered by existing static analysis.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244767
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
- Wrap returns in Future.value to ensure the returned Future has the async function's return type.
- Skip any function that has try/catch/finally as these introduce more complex control flow. (Might be able to convert these using an onError callback in the future).
- Don't assume futureValueType since CFE might not populate it in Kernel when syntax is incorrect.
Change-Id: Ice3954da52a10a74f93b0adc6409a2d98e13cb3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241260
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This change allows function literals in invocations to be inferred in
dependency order. For example, given the following code:
U f<T, U>(T Function() g, U Function(T) h) => h(g());
test() {
var x = f(() => 0, (y) => [y]);
}
The function literal `() => 0` is inferred first, causing the type
parameter `T` to be assigned the type `int`. Then, `(y) => [x]` is
inferred with the benefit of this type assignment, so `y` gets the
type `int`, and consequently, `U` gets assigned the type `List<int>`.
This completes the support for
https://github.com/dart-lang/language/issues/731 (improved inference
for fold etc.)
Change-Id: I48c22693720a1cc8bbf435643e863834e07f02b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243002
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Such return statements are allowed in Dart, and they can be present in
kernel that has not been processed by the async transformation.
Change-Id: I8592cce58cb8fca2d78cdb0d5e5532715553c1ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242544
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Add `toText` to both Reference and CanonicalName.
Change how CanonicalNames are printed through `text_util.dart` to be
more aligned with how the corresponding node would be printed had
it existed (and the CanonicalName thus normally not been used for
printing).
Add a test for (some definition of) common cases where printing should
be the same wherther done though the node, the reference or the
canonical name.
Fix usage of toStringInternal in the constant evaluator (though only
in use through an experiment) and add a test that showed that the
previous output was bad and the new isn't (at least in this case).
Change-Id: I10cbc1a542c7d8b079e0510bbd5eb5173b2e7563
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242102
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This change includes kernel-related changes:
* --compact-async option is added to kernel compilers (front-end
server and gen_kernel). This option disables desugaring of async
and await on kernel AST. Note that 'await for' is still desugared.
* File offset of the 'await' is now written for AwaitExpression nodes
in the kernel binaries (will be used for async stack traces).
* Async/async*/sync* functions and AwaitExpression nodes are supported
in TFA.
Design doc: go/compact-async-await.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I4233086b7434bc48347f4220645b0be5f9133456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241842
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Expressions like
List<VariableDeclaration> variables = ...
List<Expression> reads = variables.map((v) => VariableGet(v)).toList()
don't get the intended type argument `<Expression>` through inference,
but instead the type inferred from the return type of the closure, in
this case `<VariableGet>`.
This causes problems when used with the AST which assumes that
expressions are interchangeable wherever they are used, and is likely
the cause of https://github.com/flutter/flutter/issues/102077 .
This CL adds an explicit type argument in these cases.
TEST=general/infer_map
Change-Id: I0bcae21f06c54f290dc20686b0d84c065d8ea04c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241605
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Tested: Default CQ run; Dart VM changes were generated.
Change-Id: If0ea7b9fd2bb0de8459c9d4b39b9cc91cec73e23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240542
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
The computation of default values on super parameters requires the
notion of a declared initializer. By adding this as a flag to
VariableDeclarations the implementation can now be normalized across
parameter from source and dill.
TEST=existing
Change-Id: Ic980e68b569e3bdab38d2c7c7e4374e0c931a87b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240403
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The JS expansion of an async/await function is a complex state machine.
In many cases 'async' functions either do not use 'await' or have very
simple 'await' logic which is easily captured by [Future]. By making this
transformation we avoid substantial over head from the state machine.
This implements the simplest case of a function with no awaits which translates to a Future.value() call.
Tested on cm_shell with the following results:
Before: Compiled 243,799,156 characters Dart to 155,116,598 characters
After: Compiled 243,799,156 characters Dart to 154,781,536 characters
Reduced output size by ~0.2%.
Later iterations of this will reduce JS size by ~0.7%.
Change-Id: I918f820ed2a8b27081dad0de9f922b595113d21f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238461
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Happened upon this and noticed it was missing. Might not cause correctness bugs but my exclude the cloned function from some optimizations.
Change-Id: I2481c66a5f277556ac652954f03f09983d68480a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239320
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Various cleanups to the TypeBuilder classes:
TypeBuilder:
* Remove `origin` parameter from TypeBuilder.build and instead make
FunctionType.typedefType mutable and set if after creation.
* Remove `charOffset` and `fileUri` parameters from
TypeBuilder.buildSupertype/buildMixedInType
* Remove `bind`, `resolveIn`, and `check` from TypeBuilder so that
these are only present on NamedTypeBuilder
* Remove TypeBuilder.buildTypeLiteralType and instead pass an
argument to NamedTypeBuilder that determines what type to create
on `build`.
NamedTypeBuilder:
* Make NamedTypeBuilder.instanceTypeVariableAccess private
* Add NamedTypeBuilder.forDartType for prebuilt types
* Add NamedTypeBuilder.forInvalidType for types created for errors
* Make NamedTypeBuilder.declaration private and corresponding getter
* Check most type use errors on NamedTypeBuilder.bind
* Make NamedTypeBuilder helper methods private
* Add `TypeVariableBuilder.isClassParameter` to support checking for
valid type variable use through the `NamedTypeBuilder.bind` method.
* Remove checking of type variable in static context from BodyBuilder
since it is now checking on `NamedTypeBuilder.bind`.
FunctionTypeBuilder:
* Cache result of FunctionTypeBuilder.build
TypeBuilderComputer:
* Cache "constant" type declarations in TypeBuilderComputer
Change-Id: Ibaedcb255487eecc5efe70b84e5cbd5a118c1e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239023
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This is in preparation for including a "futureValueType" for
non-nnbd async functions.
TEST=existing
Change-Id: I15cf5e58623df07fe3c670aa866b7b04805c0f3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238703
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This updates ast-to-text to show the annotations on import/exports. A
test is added that uses augmentation libraries to show that the
annotations are not currently ascribed to the correct library dependency.
Change-Id: I340c1ab920b16ff08dd9ac36ee9be4d2d651b4a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237301
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This changes tool/fasta.dart to run the subcommand in the same VM when
no VM arguments are specified. This speeds up the tool and as a
consequence speeds up the tool/update_all.dart and
tool/update_expectation.dart tools.
Change-Id: I80b61a692a3ac2e15a7d1d097e65e1efbf9e4aee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236560
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
These transformations are maintained by the VM team and keeping them
in pkg/kernel would put a burden on the CFE team after code reviews
are tightened to require OWNERS approval.
TEST=ci
Change-Id: I931033ba987d17a2c9c6d80a16dad09bfbaa0572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234905
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This adds a [MacroSerializer] interface to abstract how URIs are
created for precompiled macro components.
Two strategies are added. The existing solution using a temporary
directory in TempDirMacroSerializer and a new solution using the
recently added (experimental) Isolate.createUriForKernelBlob feature
in IsolateSerializer.
Change-Id: Id7117cc518f09e9b3762d6ca924c788c81fd9ac0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234282
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This CL
* Makes :async_op only have two parameters: We take advantage
of the fact that errors not only have exception != null but
also stacktrace != null.
* Makes :async_op have no optional parameters. This reduces
code size significantly.
* Removes unused parameter in _awaitHelper calls
* Wrap the then callback instead of the error callback. (needed
to make optional parameters required)
This results in 2% code savings on a big g3 app.
The size of :async_op shrinks on average by 11%
TEST=ci
Change-Id: I38d5fba4ebebc780b48dac5aa6a250d2c7952bfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233362
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.
For additional background information see go/dart-sdk-owners.
TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.
TEST=No behavior changes.
Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
In general any async function can return X or Future<X>. Though the
future implementation has to do different things depending on which case
we're in. It does so by using a `<obj> is Future<T>` test. This test is very
expensive if many different classes flow into `<obj>`.
Though most functions do not return `Future` objects from async
functions. We can determine that statically by looking if any returned
expression could be a future. If not, we can bypass the `is Future<T>`
test entirely.
Issue https://github.com/dart-lang/sdk/issues/48226
Issue https://github.com/dart-lang/sdk/issues/48235
TEST=pkg/front_end/testcases/general/async_function_returns_future_or.dart
Change-Id: If655bdbdddc214dd7b12be9905b3c788252547d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230662
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This CL adds a tool that can compare the class hierarchies of two dill files.
Currently it only checks for public classes and their public supertypes.
We could extend the tool later if needed.
Currently it gives this for flutter:
```
$ out/ReleaseX64/dart pkg/kernel/bin/compare_hierarchies.dart /path/to/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill /path/to/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/platform_strong.dill "dart:nativewrappers#NativeFieldWrapperClass1"
(1): /path/to/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill
(2): /path/to/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/platform_strong.dill
Missing classes in lib dart:_internal
In (2) but not in (1): [VMLibraryHooks, Lists, VMInternalsForTesting, ClassID]
Missing classes in lib dart:ui
In (1) but not in (2): [PlatformViewRegistry]
Class(ColorFilter) in dart.ui from (2) has these extra supertypes: [ImageFilter (dart:ui)]
```
where the last line is https://github.com/dart-lang/sdk/issues/48245
It gives this for the dart sdk:
```
$ out/ReleaseX64/dart pkg/kernel/bin/compare_hierarchies.dart out/ReleaseX64/vm_platform_strong.dill out/ReleaseX64/ddc_platform_sound.dill "dart:nativewrappers#NativeFieldWrapperClass1"
(1): out/ReleaseX64/vm_platform_strong.dill
(2): out/ReleaseX64/ddc_platform_sound.dill
Missing classes in lib dart:_internal
In (1) but not in (2): [VMLibraryHooks, Lists, VMInternalsForTesting, ClassID]
```
which seems fine (dart:_internal after all)
Change-Id: I03c0dbcc3e5058a0c7d6a996b511cf6d449dd4f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231100
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
The VM patch files contain many annotations that guide the TFA and the
VM compilation pipeline. Most of these are not relevant to dart2wasm,
and having the TFA look at these when running inside dart2wasm leads to
sub-optimal, and sometimes even unsound, results.
In order to enable sharing of patch files between the VM and dart2wasm,
the annotation parser is given a target flag to control which
annotations it should recognize and how to parse them. The annotation
parser thus becomes an abstraction layer between the concrete
annotations in the patch files and the parsed annotations that the TFA
sees.
Additionally, external members used by dart2wasm don't always have
external names. To support this, the signature shaker must skip all
external members, not just the ones with an external name. This makes no
difference for the VM, since all of its external members either have an
external name or are implemented in a patch file, making them no longer
external.
TEST=ci + upcoming dart2wasm CL
Change-Id: Id425dd1ccc5560721034ae83c8cdc1593801a4e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231102
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Missing:
* Function types.
* Type variables in bounds, like "method<T, S extends T>() {}" and
"method<T extends Foo<T>>() {}"
This is in many ways a follow-up to
https://dart-review.googlesource.com/c/sdk/+/212286
TEST=service and (cfe) expression suite tests added.
Change-Id: I20472b59ed73e9845f073e176d73b2c213f9407a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This CL replaces most usages of `.from` (e.g.
`List<String>.from(variable)`) to use `.of` instead.
This is done because code like
`List<String> foo = new List<String>.from([null])`
is valid and gives no warnings or errors.
Using `.of` instead will give an error.
Also `.of` appears to be slightly faster.
Change-Id: I1b4327be228b77e6a3e9faa283f8ce64f0565608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228642
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This CL does two things:
* "Reenable" the skipping of the dart:ffi transformation entirely when
the application does not use dart:ffi. This was originally added in
ad596359a6 but was logically disabled in 4558112105 when dart:core
started depending on it. Here we now ignore (real) dart:* libraries
when looking for dependencies of dart:ffi.
* Find the subset of the just compiled libraries that transitively
depend on dart:ffi and just run the dart:ffi transformation on those
libraries.
For dart2js that doesn't use dart:ffi at all we go from:
```
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v pkg/compiler/bin/dart2js.dart | grep -i "ffi"
0:00:09.003428: Transformed ffi natives in 51ms.
0:00:09.203442: Transformed ffi annotations in 199ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v pkg/compiler/bin/dart2js.dart | grep -i "ffi"
0:00:09.098175: Transformed ffi natives in 52ms.
0:00:09.296847: Transformed ffi annotations in 198ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v pkg/compiler/bin/dart2js.dart | grep -i "ffi"
0:00:08.854341: Transformed ffi natives in 57ms.
0:00:09.061804: Transformed ffi annotations in 207ms.
```
to
```
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v pkg/compiler/bin/dart2js.dart | grep -i "ffi"
0:00:09.138651: Skipped ffi transformation in 1ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v pkg/compiler/bin/dart2js.dart | grep -i "ffi"
0:00:09.242590: Skipped ffi transformation in 1ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v pkg/compiler/bin/dart2js.dart | grep -i "ffi"
0:00:09.163885: Skipped ffi transformation in 1ms.
```
When compiling the flutter gallery app that does depend on dart:ffi we go from:
```
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v --target=flutter --platform=/tmp/tmp.6KV5psVGIG/flutter_patched_sdk/platform_strong.dill /tmp/tmp.6KV5psVGIG/gallery/lib/main.dart | grep -i "ffi"
0:00:16.344955: Transformed ffi natives in 78ms.
0:00:16.777218: Transformed ffi annotations in 432ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v --target=flutter --platform=/tmp/tmp.6KV5psVGIG/flutter_patched_sdk/platform_strong.dill /tmp/tmp.6KV5psVGIG/gallery/lib/main.dart | grep -i "ffi"
0:00:15.994674: Transformed ffi natives in 80ms.
0:00:16.472779: Transformed ffi annotations in 478ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v --target=flutter --platform=/tmp/tmp.6KV5psVGIG/flutter_patched_sdk/platform_strong.dill /tmp/tmp.6KV5psVGIG/gallery/lib/main.dart | grep -i "ffi"
0:00:16.027488: Transformed ffi natives in 81ms.
0:00:16.491362: Transformed ffi annotations in 463ms.
```
to
```
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v --target=flutter --platform=/tmp/tmp.6KV5psVGIG/flutter_patched_sdk/platform_strong.dill /tmp/tmp.6KV5psVGIG/gallery/lib/main.dart | grep -i "ffi"
0:00:15.991628: Transformed ffi natives in 30ms.
0:00:16.226564: Transformed ffi annotations in 234ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v --target=flutter --platform=/tmp/tmp.6KV5psVGIG/flutter_patched_sdk/platform_strong.dill /tmp/tmp.6KV5psVGIG/gallery/lib/main.dart | grep -i "ffi"
0:00:16.184984: Transformed ffi natives in 29ms.
0:00:16.404439: Transformed ffi annotations in 219ms.
$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart -v --target=flutter --platform=/tmp/tmp.6KV5psVGIG/flutter_patched_sdk/platform_strong.dill /tmp/tmp.6KV5psVGIG/gallery/lib/main.dart | grep -i "ffi"
0:00:15.933513: Transformed ffi natives in 27ms.
0:00:16.145640: Transformed ffi annotations in 212ms.
```
TEST=Assuming tests already exists.
Change-Id: Ie13be1924d3439cb710c782af81e1e42cda2a838
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228001
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Some subtype tests are crashing due to infinite recursion. It is a
known issue. An example of such test is FutureOr<T> against
FutureOr<S> where T and S are type variables declared as T extends
FutureOr<T> and S extends FutureOr<S>.
In some cases it's possible to fail early instead of crashing, for
exmaple, by checking Future-branch of the left-hand side first before
checking the type argumennt of FutureOr which would lead to the
infinite recursion. This CL does that, allowing some more type checks
to pass instead of crashing.
Change-Id: I075aa65522510db1a97ac2a8de7278a3ce3f400c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
This CL changes the way dart: libraries are considered supported when
used in conditional imports or bool.fromEnvironment constant using
the "dart.library.*" values.
Library nodes now has an isUnsupported flag which is set according to
the "supported" property in the libraries specification. Furthermore
the Target now supplies a DartLibrarySupport interface that allows
targets to override whether dart: libraries are unsupported.
This allows the JIT/AOT to use the same platform file but still
consider dart:mirrors unsupported in AOT mode, and dart2js to consider
the internal library `dart:_dart2js_runtime_metrics` supported.
Furthermore, the internal handling is changed so that condition imports
and bool.fromEnvironments constants are computed through the same logic
for "dart.library.*" values, avoiding the need for passing these values
through the environment.
TEST=pkg/front_end/testcases/general/supported_libraries/main
Closes https://github.com/dart-lang/sdk/issues/48057
Closes https://github.com/dart-lang/sdk/issues/47814
Closes https://github.com/dart-lang/sdk/issues/47243
Closes https://github.com/dart-lang/sdk/issues/32657
Closes https://github.com/dart-lang/sdk/issues/36460
Change-Id: Ie8f8dff99167de64ced51b71d89918bf0f3bbd13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227020
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
TEST=Standard CQ
Change-Id: I0eba9fa6eaa73bf9da8abdd93645a8e6eb8e601b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226691
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
This separates the reading of entry-points, which do not have an
accessor library, from reading of imports, exports and parts, which must
have an access library.
This change also disallows access to platform private libraries, like
dart:_internal, as entry-points.
Change-Id: I017ca30231eb99dc8463266dca0973a02f6f0e30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223423
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
If tree shaker doesn't visit TypeParameterType.promotedBound which
contains the only reference to a particular class it may remove that
class, leaving a dangling reference from promotedBound. After that
kernel AST serialization would crash with "Missing canonical name for
Reference" error.
This change also fixes TypeParameterType.visitChildren.
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_47878.dart
Fixes https://github.com/dart-lang/sdk/issues/47878
Change-Id: I555261713240bf0be412db27efb68f32cfd8008b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222781
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This CL splits the ClassHierarchyBuilder implementation into two parts:
1) ClassHierarchyBuilder (using ClassHierarchyNode and
ClassHierarchyNodeBuilder) which computes the superclass/
superinterface relations.
2) ClassMembersBuilder (using ClassMembersNode and
ClassMembersNodeBuilder) which computes the class members.
The CL prepares for supporting subtype queries from the macro generation
at point in time where members can still be added to the classes.
Change-Id: Ic28fc6eddd1b651916de46583aeed791ce81e844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222461
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This replaces the previous implementation (and the topological sort of
classes, on which it was based) which was O(|vertices|*|edges|). The new
implementation is O(|vertices|+|edges|).
Change-Id: I4f5f1e63b4c7dd67d6f17c087724c20d4d33bf83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221820
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
ReferenceName is used in equivalence testing to match reference
reguardless of whether the reference have associated nodes or
canonical names. The implementation didn't previously account for
fields, getters and setters with the same simple name, and would
wrongfully equate them.
Change-Id: Iacc8e0eb2c5c04a3cf11c3b5104a8f0441cf3ab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221621
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This CL adds a test for the minimal sequence of compilation steps
that need to be performed to compile the test while ensuring that
macro declarations are compiled before any application.
Change-Id: Icd6b9140e60d35d2b2b034c16e0807262f971418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220768
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Sync generators contain two implicit wrappers (:sync_op_gen
and :sync_op), which do not directly correspond to any user
code - and therefore do not have fileOffsets.
Some tools however rely on fileOffsets to e.g. compute code
coverage, so this change adds fileOffset inherited from the
non-synthetic code to :sync_op_gen and :sync_op.
Bug: https://github.com/dart-lang/sdk/issues/47681
Change-Id: I0c54bc3eaf5892e591fead845b5d31d2dfc9481f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220543
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
TEST=Standard CQ
Change-Id: I8598e2102df2990396afa3e56ad4a41120c5dee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219787
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This config hasn't been running at least since Dart 2.0. This basically
reverts https://codereview.chromium.org/2549793002.
test.py no longer supports these options:
* --skip-compilation (skipped compilation commands)
* --runtime=self-check (ran the self-check tests)
Change-Id: I135c8d488a9319ee3482131cd22eb7cd3dfa3f25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217003
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
The added field holds the interface signature type for a Procedure when
this is different from the class signature type (implied by the function
parameters and return type). This is needed for forwarding semi stubs
when its declared type is different from the called super member.
Closes https://github.com/dart-lang/sdk/issues/47072
TEST=pkg/front_end/testcases/general/implement_semi_stub.dart and more
Change-Id: I4a7cdc9d564fb0a59e7b06e83646b5410d8d82f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216420
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <dmitryas@google.com>
This adds a third reference to Field declaration, so that we know have
three references, one for each use case:
1) fieldReference used for initialization; in FieldInitializer and as
the key in the InstanceConstant.fieldValues map.
2) getterReference used for reading; in InstanceGet, StaticGet and
SuperPropertyGet
3) setterReference used for writing; in InstanceSet, StaticSet and
SuperPropertySet
TEST=existing
Change-Id: I223f130e808e7f19a831c1fe5e3a4725d1bcdc3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203770
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
We use an extension getter instead of an instance getter because
it doesn't conflict with any potential existing or future enums
which want an element named `name`.
Keeping the namespace for enum elements open is a priority.
We currently only reserve `index` and `values`.
BUG: https://github.com/dart-lang/language/issues/1511
Fixes language issue #1511, which is a long-standing request,
and should replace a number of alternative implementations
which are based on parsing the `toString()`.
This version has two fields on the shared superclass, the index
and private name, and has a separate `toString` for each `enum` class
which hard-codes that enum's class name.
An earlier version had both `"name"` and `"ClassName.name"` as fields
to be able to reuse the same `toString` method on all enum classes,
but that cost too much for JS compiled code.
Even having just `ClassName.` as a field and then combining inside
`toString` requires more code to create the enum instances.
Instead this version hardcodes the `ClassName.` string once
in the `toString` method, which means each enum class has its own
toString (which can *potentially* be tree-shaken then.)
This still tree-shakes slightly worse than the previous implementation
where every enum class had its own `index` and `_name` fields
independent of each other, which could then be tree-shaken independently.
However, the `index` was already made an interface member with the
addition of the `Enum` interface, so code which accesses `.index`
on something of the `Enum` supertype could prevent tree-shaking of
all enum classes' `index` fields.
Likewise any general access to the "name" of an enum would necessarily
do the same for the name.
This CL makes up for some of that by sharing more implementation
between enum classes.
DartVM AOT CodeSize impact: ~0.15% regression on gallery (little less on big g3 app)
TEST= New tests added to enum_test.dart
Change-Id: Id25334e6c987f470f558de3c141d0e3ff542b020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210480
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Before this CL:
If a library (say lib.dart) imports a file (say part.dart) that's
actually a part (of some other library (say main.dart)) an error is
given, but the "fake library" shortly representing the part is still
"linked" into the libraries dependency list.
This means that the component returned from a compilation is different
from the combination of libraries one can get to if walking all
LibraryDependency's. This also means that if we serialize the component
we can't load it back in (https://github.com/dart-lang/sdk/issues/46706).
It furthermore means that we have two different entities with the same
fileUri and importUri.
This CL rewrites a such import of a part to instead be an import of the
"parent", i.e. if a library lib.dart imports part.dart that's a part of
main.dart an error is issued, and the import is rewritten to be an import
of main.dart instead. The same thing happens to exports.
This alleviates the problems (i.e. no crashing if trying to load the dill,
no referenec to a otherwise non-existing library etc), and has the added
benefit of probably being what the user wants: Anything defined in
part.dart (that isn't private) is still in scope from lib.dart.
Change-Id: I17aca9db4edbf25b23d3ef301cf65589eeeb1635
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213344
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
- to isCovariantByDeclaration and isCovariantByClass, respectively.
This is done to align the terminology with the spec.
TEST=existing
Change-Id: I96b2e5d6e05caca431aad2b54545e928aee034e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213041
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
As part of deprecating support for native extensions we are also
migrating away from legacy VM-specific `native 'name'` syntax
towards metadata based encoding which does not require any special
syntax.
This CL is a step 1 in migration:
- introduces support for `@pragma('vm:external-name', 'name')`
which serves as a direct replacement for `native 'name'`;
- all core libraries and tests are migrated to use the annotation;
Once this CL lands and rolls we will edit internal and external embedders
to eliminate uses of the native keyword (step 2) and finally remove
support for native keyword across our parsers (step 3).
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/28791
Change-Id: Id6dea878db82dd4fd81149243c425b5c5dc6df86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212461
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This CL changes the frontend to emit map and set constants which are
then processed by the constant reader in the VM.
This CL also introduces support for sending the const maps and sets
in messages between isolates and saving it in snapshots.
TEST=tests/language/const/map_test.dart (et al, for lookups)
TEST=tests/lib/isolate/message3_test.dart (et al, for isolate messages)
TEST=tools/test.py -c dartkp (for consts from clustered snapshot)
TEST=tools/test.py -n app_jitk-linux-debug-x64 (for consts from app
jit snapshots)
TEST=Building the SDK which uses const Maps in clustered snapshots.
Closes: https://github.com/dart-lang/sdk/issues/45908
Change-Id: I1f8150a8aba8298c4e64d2571dd147743526135a
Cq-Include-Trybots: luci.dart.try:analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203765
Reviewed-by: Martin Kustermann <kustermann@google.com>
Tool will try to extract useful information from invalid (e.g. partial
or wrong version) dill.
This is a first stab and could possibly be extended and improved in the
future.
Change-Id: Ib381794a3fe80036bb845800488fa0e1a7f04f83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211241
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
* Force depot_tools to use python3 results (USE_PYTHON3=True).
* Fixes the dart format presubmit check.
* Remove broken DOM tools presubmit check.
TEST=Manually provoked errors and ran git cl presubmit -v -f.
Cq-Include-Trybots: luci.dart.try.shared:presubmit-try
Change-Id: I8ba46e2ae1640f1b2f82e18bc8024e0aa4838b2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210123
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Cloning of InstanceInvocation kernel ast nodes was dropping the
isInvariant and isBoundSafe flags, causing the nested List.generate
expansion to not be as well optimized. `-O3` and `-O4` were 'hiding'
the problem by removing the checks anyway.
Change-Id: Id20f2eb4ef5396691a2dd5cbdd847e2d361a21d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209442
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Replace bogus body created for redirecting factories with a
normal body which calls target factory or constructor and
forwards all arguments. Such a body can be used by back-ends
if they choose to treat redirecting factories as ordinary
factories.
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/41915
Issue https://github.com/dart-lang/sdk/issues/46231
Change-Id: I62c83bcc9005995e85de049d3d929ca86a75297f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208681
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
... and use this to wrap expressions instead of Let
TEST=existing
Change-Id: I6d1f5cfa4693222840d6cb406790c39c6ae63e5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
+ use it to allow discrepancy in incremental_dart2js_load_from_dill_test
Change-Id: I0adad30af1e502d81e870b26eb63a03b70e42333
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205796
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Moves dart2js DebugPrinter and Indentation to pkg/kernel/lib/text
and produces the AST of compiled libraries when ddc is run using
the --summarize-text flag.
Change-Id: I195ff99a0929ac12791b4f7b6c5e755b19065c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208460
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
- to replace internal use of the old method invocation encoding.
Change-Id: I7ca876d28beec265f1a143ce5f29deb9e61616d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208184
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Using top level procedures generated for each constructor in the
targeted class.
Closes#46676
Change-Id: I42e98254e5cdb8922fafd29e0170dd70ef3e693e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207961
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
FunctionNode.computeFunctionType didn't handle constructors for generic
classes and would fail to substitute type parameters from the enclosing
class.
Change-Id: Ia16ea55ce774597590e6e7da7af066b5c66dfe67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207123
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
When we detect that a temporary variable is being reused
with a different type, we change the type of the temp
to dynamic.
This allows us to retain types for any non-reused temps.
For any dynamic temps we still have type information available
for use sites, which we can pass on via unsafeCast.
One drawback of this approach is that we don't know ahead
of time which temps are reused, and get turned into dynamic,
so we have to unsafeCast all uses.
This change is similar to what was done in:
https://dart-review.googlesource.com/c/sdk/+/138500
TEST=Adds tests/language/vm/regress_flutter_85311_test.dart,
updates relevant expect files.
Bug: https://github.com/flutter/flutter/issues/85311
Change-Id: I821c5266327892d5c3fd5bae1bebba7f3fe3931b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205647
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This change concludes switching to the new invocation nodes in the VM.
Support for the old invocation nodes (MethodInvocation, PropertyGet
and PropertySet) is removed from the VM and VM-specific kernel
transformations.
TEST=ci
Closes https://github.com/dart-lang/sdk/issues/45340
Change-Id: I0717732feb1b9c6ebdf0f6079ed42a90d00970a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204741
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This is a first pass at running inlined tests
(seemingly called doctests in for instance python) on internal CFE code.
This is not useful for testing the entire compiler for instance, but
could be useful for utility methods that take simple inputs and provide
simple outputs.
I've added tests to a few tings to try it out.
The syntax for it here is probably overly verbose but we could iterate
on that if need be.
The way it's done is that the test-code is extracted from the comments
and (virtually) "injected" in a weirdly named top level method of the
same file, which is then called from a "fake" main; the whole thing is
compiled to dill and run in an isolate.
(This is an application where making advanced invalidation support
adding top level methods would be great).
Change-Id: I7927822bca0ba68780458c40fe585882330e3b60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203242
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This CL changes the leak finding from using heap dumps to using the
undocumented (/ private?) method '_getInstancesAsArray' to get all
instances of specific clases (i.e. the one(s) we're finding leaks for).
This - I'm hoping - is more stable than the heap dump version (which,
though, seems to have become more stable over the last weeks).
It is also potentially faster: The speed depends on how many different
classes we want to look at to find leaks.
In the flutter compilation leak tests we only look for one and it
finishes in ~78% of the time it did before. That's (rounding at bit)
going from ~6 hours to ~4.5 hours.
In vm_service_for_leak_detection.dart - that looks at four different
classes - it's something like 26% slower though.
Change-Id: Ic8abb1b293137b166ab0935eae423b60e2d4562b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202762
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
As kernel `TreeNode`s have `parent`-pointers we can leak through our
dummy nodes. This CL makes a list of all TreeNode dummys so it's
possible to iterate over them and null out the parent pointer,
making it possible to plug the leak "on demand".
This doesn't feel like a real solution and for now is only used in a
test so those leaks doesn't obscure other leaks should any such surface.
Change-Id: I6c0c60ba58df8d9d5eb6cc1c3a144ea31aa3810c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202682
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This change updates the remaining places in the VM-specific
transformations to generate new invocation nodes (InstanceInvocation,
EqualsNull, LocalFunctionInvocation) instead of old invocation
nodes such as MethodInvocation.
The old nodes will be deleted eventually.
TEST=existing tests
Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I00a845e8191f79584c250f57214dd5fb4d6241ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203443
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This change replaces generation of old invocation AST nodes
(such as PropertyGet, PropertySet and MethodInvocation) in async
transformers with new nodes (InstanceGet, InstanceSet,
InstanceInvocation, LocalFunctionInvocation).
The old nodes will be deleted eventually.
TEST=existing tests
Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I8c2ead9509cfd2def2f75f9d82dc13b2a9490fdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202801
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This feature is gated behind the --experiment-late-instance-variables
flag.
Change-Id: I1ecb2d4d960b58204207ea055361463efa3a0bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200922
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Previously, certain fields of Typedef kernel AST nodes
were omitted from visitChildren(), transformChildren() and
transformOrRemoveChildren() and were not properly visited.
Also, the following related problems are fixed in this CL:
* parents of VariableDeclaration nodes in Typedef were not properly set;
* verifier didn't account for VariableDeclaration nodes in Typedefs.
TEST=existing tests
Change-Id: I4f9cb694ad9cacc9c20fe66e8a49f73f547ca245
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96964
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
New invocation nodes have explicit functionType/resultType fields
which should be also visited by various visitors and transformers.
Without visiting those fields not all types are processed by
certain transformation (e.g. tree shaker) which causes crashes
during AOT compilation if new invocation nodes are enabled.
TEST=runtime/tests/vm/dart/regress_45966_test.dart (with new
invocation nodes).
Fixes https://github.com/dart-lang/sdk/issues/45966
Change-Id: I61d79650984a353d842b58da082a021ab37ab777
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199365
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
In each library where an import is removed, the library uses some elements
provided by the import, BUT there is another import which provides all of the
same elements, and at least one more which the library uses.
In this change, we remove the imports which can be simply removed in favor of
the other already present imports.
See https://github.com/dart-lang/sdk/issues/44569 for more information.
Change-Id: Ifebf11894fd62280b20230aa6d66de41cf6baae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199462
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
In 3c83032c60
(https://dart-review.googlesource.com/c/sdk/+/195517)
a change inadvertently made it in that changed readAnnotationList from
always returning a constant empty list when the size was 0, to only
returning an (almost) constant list if the size was 0 and a non-default
setting was enabled.
In practise that meant that for normal runs we went from returning
a constant list when the size was 0 to returning a new empty list,
and the benchmarking system said
AstFromBinaryLazy (Intel Xeon): +33.2%
AstFromBinaryLazyP90 (Intel Core i5): +87.2%
AstFromBinaryLazyP90 (Intel Xeon): +117%
(i.e. generally much slower).
This CL restore the status quo and my local benchmarks says:
AstFromBinaryLazy(RunTimeRaw): -22.98% +/- 3.91%
AstFromBinaryLazyP50(RunTimeRaw): -6.20% +/- 5.03%
AstFromBinaryLazyP90(RunTimeRaw): -54.25% +/- 3.78%
Change-Id: Ia198cbbb0b2739f49a085435d98efb04740fa593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198280
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This change extends VM-specific kernel transformations to handle
new AST invocation nodes. The transformations may still generate
old nodes, but they should accept and handle new nodes coming from
the front-end.
TEST=Manual testing with new invocation nodes enabled.
Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I2de9f0eb00fcf844ba62fdc93b15a907c2d6b69d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197443
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Previously constants were referenced via there relative binary offset,
i.e. a constant reference saying 42 meant at byte offset 42 relative to
the start of the constant table in the binary. This was done to be able
to (on the VM side) read the needed constants lazily. It meant, though,
that constants had to be stored in a map, mapping from the byte position
to the constant.
This change adds a level of indirection when needing the lazy reading,
but lets the constant references reference the constant number instead
so that a constant reference saying 42 means constant number 42,
i.e. constants can be stored in a list instead of in a map.
This is done on the dart side, but the VM still stores it in a map.
The level of indirection is a tabel next to the constant table where
each entry has constant size (4 bytes) from which one can read the
relative byte offset into the constant table from the constant number,
thus still being able to read needed constants lazily.
This CL also cleans up a leftover where for instance double constants
had their textual representation saved as a string in the string indexer
(and thus the output dill) even though they were never referenced.
File size changes:
* Platform: increses 7,816 bytes.
* Compile of dart2js (including platform): decreases 71,424 bytes.
Speed changes:
* Adding `UserTag`s to the code and looking at observatories cpu profile
on a `pkg/kernel/test/binary_bench.dart --golem AstFromBinaryLazy`
run of a compile of dart2js reading the constant table has gone
from ~10% to ~5%.
* Doing statistics on
`pkg/kernel/test/binary_bench.dart --raw AstFromBinaryLazy` run of a
compile of dart2js says -6.28169% +/- 4.97269%.
* Golem runs has nothing above the noise level.
It does say "AstFromBinaryLazy (Intel Xeon) -4.006% (0.4 noise)" and
"AstFromBinaryEagerP50 (Intel Core i5) -8.929% (0.6 noise)" though.
TEST=All tests running the VM tests this.
Change-Id: I07ead457527a4477de803ee55ba742f5557413d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196925
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Since the VM package isn't opted in, the individual libraries have
been annotated with `@dart=2.12` to opt in to null safety.
TEST=existing
Change-Id: I0bfbcf69cb80d32bb6b80a171f7bdb62fde7ca65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195277
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>