This CL includes changes to BenchMaker and test type parser that
include recent developments in the DartType system, such as extension
types and record types, outstanding existing features, such as
typedefs, and recent changes in the CFE type model, such as structural
parameters.
Change-Id: I16ca13273e83de7942abad67b8a2b67146fb24bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430661
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This remove part of the NameSpace to avoid an overreliance on its implementation. This is done in preparation for hold the name space content in a single map instead of a separate map for getables and setables.
The NamedBuilder interfaces is added to use for Builders that can be mapped in name spaces. This avoids the need for the NameIterator and all the associated methods.
Change-Id: Ia547bdc8ddcb83f47473b51a2059428b352f8916
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428001
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Introduce a helper library to trim components based on what we believe
it is needed for modular bytecode compilation. The script is configured
to accept a set of entry points, so unreachable libraries can be removed
entirely. The contents of the retained libraries is trimmed to remove
method bodies, constructor bodies, and initializers, except for where
they may be needed.
In the near future, this should be expanded to:
* include proper unit testing in the CFE
* review whether additional trimming operations can be made
* consider an explicit representation of trimmed content, to help the
CFE recover when assumptions are not met (e.g. sentinel markers
to establish whether a value has been trimmed)
* CFE produces trimmed data directly if needed, without having to first
produce the full dill.
Tests that specifically stress that we don't over-trim include:
apply_mixin (requires preserving method bodies), const_body (requires
preserving initializers).
TEST=existing and new e2e dynamic module aot tests.
b/394936876
Change-Id: I26db8385bdfe1664b2aea234ec8bb896c7c21230
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418702
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This removes the support running macros in the CFE.
The scanner and package:kernel still have support for the macro modifier. This will be removed in a follow-up.
The metadata expression parser is deliberately left in, since it might serve as the basis for a parser AST.
Change-Id: I06d91eb0fac2e7a71e6afde647b03be3814dbd5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406963
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
## Added --cache to benchmarker.dart
This doubles the amount of runs by running an additional round of `perf
stat` runs outputting low level cache information: L1-icache-load-misses
(instruction load misses), LLC-loads (last level cache loads, i.e.
probably how many loads goes to L3 cache) and LLC-load-misses (last
level cache load misses, i.e. how many loads goes to ram). I don't know
if these are generally available, only that they are available on my
machine.
## Added --silent to benchmarker.dart
Some benchmarks output information to stdout which is great when running
it by hand, but when running it via the benchmarker script it just
pollutes the output: The benchmarker script et al measures what is
supposed to be measured. This CL adds the `--silent` option to the
benchmarker script which then won't print the stdout output from the
benchmarkee.
## Output filename in benchmarker.dart
This CL adds the filenames of the benchmarked snapshots in an attempt to
avoid confusion. Example output before:
```
Comparing snapshot #1 with snapshot #2
```
```
Example output now:
Comparing snapshot #1 (optimization_attempt_41.aot) with snapshot #2 (optimization_attempt_42.aot)
```
## Utility to summarize --verbose-gc output
Takes input from --verbose-gc from stdin and summarizes the time taken
on GC and reports it back. Example:
```
$ out/ReleaseX64/dart --verbose-gc hello.dart 2> /dev/stdout 1> /dev/null | out/ReleaseX64/dart pkg/front_end/tool/verbose_gc_helper.dart
6.1
```
Change-Id: I206f21cd8b42f844e60358aed711e676e453c77c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406845
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Extension methods can no longer be disabled. This CL removes the option
from the scanner config and the parser related specific recovery.
It also removes any specific (triggered) test of the functionality.
A follow-up CL will do the same for NNBD.
Change-Id: Ia385008e5ed1333fb37697b8fe424b8759bce198
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403581
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is the first commit of this effort. It's not polished and mostly
generates nonsense output that, though, should not crash the compiler.
Further work might add options to create less-nonsense output).
Change-Id: Ic7f140ea6f248bfa9a0e62ca37326def1d0a5086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403601
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Autogenerated files was formatted with the new style, so if one for
instance formatted the file via the IDE or by saying
`out/ReleaseX64/dart-sdk/bin/dart format pkg/front_end/lib/` we'd get
*a lot* of changes which isn't great.
This CL sets the formatter version for the auto-generated files,
hopefully avoiding such things.
Change-Id: I4f92aafde7c77e7c78179f78bf821979a25ec12c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398884
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Collects files from `package:async_helper` and `tests/language`
that are generally useful, so that all test-related helpers are
in `package:expect`.
Moves the two libraries from `package:async_helper` into `package:expect`,
and the `tests/language/static_type_helper.dart` file too.
Deprecates `async_minitest.dart`, to follow `minitest.dart`,
expecting the Flutter use of it to have been fixed to not break
on deprecation (I believe Flutter no longer breaks builds on deprecations at all).
Patch 1 is the actual change.
Patch 2+4+8 is changing all existing references to the files.
Patch 6 ignores deprecation in files still using `async_minitest.dart`.
3+5+7+9 are updating this text to make the numbers match.
Then it's just test-expectations and small tweaks from there.
Change-Id: I1b665135b5fef9b9a0c3b340ffe9daf874d0174c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
As far as I can tell, these scripts are all only used internally for
formatting generated code, so it should be safe to just parse the code
at the latest language version.
I didn't migrate:
pkg/front_end/test/fasta/textual_outline_suite.dart
I believe that one may need to pass in a specific language version if it
needs to support formatting code from before Dart 3.0. (In particular
if it needs to handle code using old switch constant expressions that
are not supported in Dart 3.0 and later like `case 1 + 2:`.)
Bug: https://github.com/dart-lang/sdk/issues/56687
Change-Id: Ib5cef82c22fc749223095215d3b692e6c27decc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385341
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
This adds the enclosingDeclarationName to the beginMethod of the
parser listener.
This enables the removal BuilderFactory.currentTypeParameterScopeBuilder.
Change-Id: Ie2bec9432c20b8bdbd62a14e8a65c272179d4698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383182
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This CL primarily adds a lint for fields with `StackTrace.current`
which is often useful for debugging, but shouldn't be left in.
* Add an ast visitor after the "explicit creation test",
finding - for now - `StackTrace.current` calls in fields.
This should have caught the left-in debug such in
https://dart-review.googlesource.com/c/sdk/+/379281.
* Renamed explicit_creation to compile_and_lint
* Remove (for some time) unused "smoke_test_quick" files.
* Add kernel to the compile_and_lint suite, but ignore it for explicit
creation (i.e. kernel will also be checked for fields
with `StackTrace.current`).
Change-Id: Ib886d23a8945e7063dc673a7f99cbb3a6adc1139
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382361
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Previously it wouldn't map back to which test, now we'll get something
like
```
Compilation error:
Test from file://path/to/pkg/front_end/lib/src/kernel/body_builder.dart:10094:7 has errors when compiling:
dartdoctest:tester:13:29: Error: Too many positional arguments: 2 allowed, but 3 found.
Try removing the extra positional arguments.
dartDocTest.test(debugName(
^
pkg/front_end/lib/src/kernel/body_builder.dart:10104:8: Context: Found this candidate, but the arguments don't match.
String debugName(String className, String name) {
^^^^^^^^^
```
Change-Id: I423e0329d37d7c2c27f158385a7514dca5645e92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379601
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
With this CL one could do a test like
```
DartDocTestThrows(LocalStack<int>([]).current)
```
which would then expect the call to throw and fail if it doesn't throw
in which case you might get something like
```
Failure:
Test from [...]/pkg/front_end/lib/src/util/local_stack.dart:19:25 failed with this message:
Expected a crash, but didn't get one.
Processed 19 test(s) in 33 ms.
18 OK; 1 bad; 0 crashed; 0 parse errors.
```
Change-Id: I52deb657cb95b9b1f866a58f7433f0c57162b5c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378480
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Previously to update comments "correctly" one had to
1) Do a coverage run with debug enabled to save the coverage files.
2) Pass the coverage files into the comment removal tool.
3) Do another coverage run with debug enabled to save the coverage files
(for the now changed sources).
4) Pass the coverage files into the comment adding tool.
5) Do a third coverage run, updating the expectation (hopefully, saying
0 missis in all files).
6) Format the changed files.
Now instead one can run
```
out/ReleaseX64/dart-sdk/bin/dart pkg/front_end/test/coverage_suite.dart --add-and-remove-comments --update-expectations
```
and it will all be done with only 1 run.
This CL also adds support for adding coverage igonre comments to `a?[b]`
where `a` is null and the lookup (and `b`) is thus not performed.
This should let the misses go to 0 (in a followup CL).
Change-Id: Ib96f3568f201586efe6f2d178133485d56a28be0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378440
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Compiling like so:
```
$ out/ReleaseX64/dart-sdk/bin/dart compile exe pkg/front_end/tool/format_cl.dart -o ~/bin/format_cl
```
I can format my CL with
```
$ format_cl
```
This isn't new. What's changed is that it now also includes the
not-yet-committed changes.
Previously my workflow has turned out to be format, committing,
then formatting again, then committing again because the files
that I hadn't yet committed wasn't formated. They will be now.
Change-Id: I30c30d7cfa6b885cf9f80bb1a6aa3022e898fd58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378420
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This changes the SourceLibraryBuilder from a chain of 3 generative
constructors to a factory constructor calling an internal generative
constructor, making it much clearer when computations are performed
during creation.
Change-Id: I8251a874831e25aae59775410b8748111cb05f9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377441
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This is a step towards removing the reliance on SourceLibraryBuilder
for supporting augmentation/patch libraries.
Change-Id: I4a2f2ed28d7dda2796a7e6985a5f0c3fb0480b52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375520
Reviewed-by: Jens Johansen <jensj@google.com>