The rules are:
1. Arguments annotated with `@Optional` must be nullable (that part
worked before this change).
2. Arguments annotated with `@Attribute` must be nullable if it's
a constructor of a component (`@Attribute` can also appear on
arguments of directives constructors, it doesn't provide any signal
in the latter case).
3. Arguments of constructors of components or `@Injectable` classes,
that have neither `@Optional` nor `@Attribute`, must be non-nullable.
Tested:
Added new test cases to `api_test.dart`
Change-Id: I0f06a128e0f6ec49d39cc6bf025fe1796938f1f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272900
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Allows embedders to programmatically request heap snapshot from a
running isolate group instead of relying on a vm-service or hidden
internal Dart APIs
Additionally we allow to include snapshot writing functionality into
PRODUCT builds using DART_ENABLE_HEAP_SNAPSHOT_WRITER define.
TEST=vm/cc/DartAPI_WriteHeapSnapshot
Bug: b/259115846
Change-Id: Ic3ef76e5fb9adcf8f23a1959f5238742b64ecde2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273181
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
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>
Lower the threshold for converting from a linear to a hash-based cache
on most architectures from 500 to 10.
Due to register pressure, the InstantiateTypeArguments stub on IA32
continues to go to the runtime for hash caches, and so we do not
lower the threshold for converting to a hash-based cache there.
The following are benchmark results for those benchmark that use enough
Instantiations to trigger the use of hash-based caches. In the following
tables, "Results 1" denotes the benchmark results from only this change,
whereas "Results 2" include from comparing to the results prior to
4f925105cf, when only linear caches were used.
Dart AOT:
* InstantiateTypeArguments.Instantiate100
Arch | CPU | Results 1 | Results 2
-------|----------------|-----------------------
ARM | Odroid-C2 | 382.8% | 381.5%
ARM | Raspberry Pi 4 | 486.7% | 449.2%
ARM64 | Odroid-C2 | 328.1% | 372.8%
ARM64 | Raspberry Pi 4 | 1283% | 1281%
ARM64C | Raspberry Pi 4 | 2353% | 2811%
X64 | Intel Xeon | 568.7% | 584.9%
* InstantiateTypeArguments.Instantiate1000
Arch | CPU | Results 1 | Results 2
-------|----------------|------------------------
ARM | Odroid-C2 | 743.7% | 3821%
ARM | Raspberry Pi 4 | 486.7% | 3218%
ARM64 | Odroid-C2 | 584.7% | 3222%
ARM64 | Raspberry Pi 4 | 430.7% | 8172%
ARM64C | Raspberry Pi 4 | 491.4% | 16699%
X64 | Intel Xeon | 954.1% | 5528%
Dart JIT:
* InstantiateTypeArguments.Instantiate100
Arch | CPU | Results 1 | Results 2
-------|----------------|-----------------------
ARM | Raspberry Pi 4 | 315.7% | 295.1%
ARM64 | Raspberry Pi 4 | 1070% | 1058%
ARM64C | Raspberry Pi 4 | 1769% | 2095%
X64 | Intel Xeon | 507.4% | 496.2%
* InstantiateTypeArguments.Instantiate1000
Arch | CPU | Results 1 | Results 2
-------|----------------|-----------------------
ARM | Raspberry Pi 4 | 565.2% | 2550%
ARM64 | Raspberry Pi 4 | 406.8% | 7375%
ARM64C | Raspberry Pi 4 | 379.6% | 12996%
X64 | Intel Xeon | 807.9% | 4459%
During work on this change, an issue was found where cache lookups
in the stub on ARM64C always failed and went to runtime, even with
the old linear-only caches, hence the much larger performance gains
in those rows above.
TEST=vm/cc/TypeArguments_Cache_{Some,Many}Instantiations
Fixes: https://github.com/dart-lang/sdk/issues/48344
Change-Id: I3d29566ba0582502954c9fc59626ceb8fd40317a
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-debug-simriscv64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-nnbd-linux-debug-simriscv64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270702
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
These were previously only needed to support calling 'replaceWith' on
TypeAliasedConstructorInvocation, TypeAliasedFactoryInvocation and
FactoryConstructorInvocation. Instead of calling 'replaceWith' on the
nodes themselves, we call 'replaceChild' on the parent, if present.
The 'replaceChild' method on the internal node is overridden to be a
no-op. Since all these internal nodes are not supported in the
external AST and therefore must be replaced during inference, these
can only be found in subtrees that have been removed, typically in
erroneous code, and it is therefore safe to make the replacement a
no-op.
Change-Id: I597d955075dfae51b04bce08b1d499c90dd4d673
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272621
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This reverts commit 86233b55bc.
Reason for revert: https://github.com/flutter/flutter/issues/115719
Original change's description:
> [vm] Skip filtered class earlier in source report.
>
> The main benefit of this is that it avoids cls.EnsureIsFinalized for
> skipped classes. In some cases (eg very small tests with dependencies
> on very large 3rd party packages, such as flutter) this can reduce
> coverage collection time by 20%.
>
> Change-Id: Id756af7f2d2ecdd07a5d1d05a400cea4de7ec408
> Bug: https://github.com/flutter/flutter/issues/100751
> TEST=CI
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266640
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: https://github.com/flutter/flutter/issues/100751
Change-Id: Ie1e9f29fa6e3966f25040aebad8cb1d55b50a745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273100
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This reverts commit c870932e45.
Reason for revert: We have a build failure on arm64c
../../third_party/dart/runtime/vm/virtual_memory_compressed.cc:143:35: error: out-of-line definition of 'Contains' does not match any declaration in 'dart::VirtualMemoryCompressedHeap'
TEST=ci
Original change's description:
> [vm, gc] Assert the whole object is in to-space, not just its beginning.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/50564
> Change-Id: I60e7637600a1a7a99d546e8c674901175a119ba5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272863
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
TBR=bkonyi@google.com,rmacnak@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: I62c83c8e8fa5b263bdc53d2afcf27b1fdd07c087
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/50564
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273060
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Auto-Submit: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Implements the behaviour discussed in dart-lang/language#2600. All other mixin application or implementing behaviour for sealed families should be unaffected.
Change-Id: I95577d8b2bc69e6c1a365ec43fb156f5d5d9a259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272461
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
These elements were unintialized in the uncommon case that the new array was large enough to get its own page.
Broken in 188dfbd52b.
TEST=ci
Change-Id: I8b07da992aa11eed9c80b6eac3a7fd6716cb3abc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272961
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Previously, the implementation used `&` and `|` for logical-and and
logical-or patterns. That is being changed to `&&` and `||`.
As a first step, we add support for `&&` and `||`, without removing
support for `&` and `|`. In a follow-up CL I'll update existing
tests, and then after a day or two I'll remove support for `&` and
`|`. This should avoid conflicts with other patterns work that's in
progress.
Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I2d5dc158248160d84e9f0889f5de390b999cbc7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272861
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Add sealed modifier to element builder summaries and to_source_visitor.
Enable sealed_class experiement in tests to test the changes.
Change-Id: I2929a5a38360c73abfcdb26d1e9b786058ea9335
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272351
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Change-Id: Ic2109e242b72875079aff635470eb82f309b0d76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272483
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
When a FinalizerEntry's target gets promoted, the associated external size needs to also get promoted. We were handling the cases where the FinalizerEntry itself was either already old or remained new, but not the case where it was promoted. Failing to promote the external size meant that when the finalizer was collected, external size was subtraced from old space that was still being attributed to new space, so the old space total external size became negative.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50537
Change-Id: Id2fe2d748311de73f04de367c9cd153d87b74ad1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272350
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
package:markdown was updated to follow CommonMark's rules for encoding
certain special characters as HTMLEntities.
See 43bafebbe8/lib/src/util.dart (L15)
This CL updates the package:vm_service generators to handle these
changes.
Change-Id: I4e2e4c1c800a44ff1f3b9e7e163d60876cd6b013
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272522
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Change-Id: Ie0946865371d9e35de0fff1c972732f96ea09e8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272662
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Change-Id: Idd0aaec42e1a92f57515dbb6bda27f1011c7d77d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272782
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Makes test pass when there's snapshots in the current processes.
Makes test pass when there's more digits in the Memory column, the
header is aligned right.
Closes: https://github.com/dart-lang/sdk/issues/50583
Change-Id: Ia0445c38795b60a403b8cba26c0444e829955973
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272820
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Closes https://github.com/dart-lang/sdk/pull/50567
Co-authored-by: Jakub Vrána <jakub@vrana.cz>
Tested: Standard CQ
GitOrigin-RevId: b916722ddc03d2b57bae6f51122ee1e7af2486b4
Change-Id: I4f638e7262009744504f0b263bf7a8e23549e5bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272380
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Issue 50383 is the breaking change whereby all cyclic dependencies are
reported as an error during top-level inference.
Change-Id: I669276c2e356aeed261287a0b295971d11357950
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272781
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
TL;DR:
56c416430e vs this CL:
textDocument/implementation (non-first runs):
```
Difference at 95.0% confidence
-3.6465 +/- 0.307413
-82.3689% +/- 6.94398%
(Student's t, pooled s = 0.238983)
```
I.e. from ~4.4s to ~0.78s on non-first runs.
textDocument/references (non-first runs):
```
Difference at 95.0% confidence
-33.1856 +/- 0.789512
-91.4283% +/- 2.17515%
(Student's t, pooled s = 0.613768)
```
I.e. from ~36.2s to ~3.11s on non-first runs.
Raw data below.
Details:
When having multiple workspace folders open, sometimes the drivers
representing these folders will have overlapping files.
For instance in my "analyzer" workspace there are a total of ~7000
unique files but if just adding each drives known files there’s
40,000+ files.
When asking for all direct subtypes of a class the a
`_FilesReferencingNameTask` does a lookup in a set for every known file
of that drive, meaning that in practice, often the same set is queried
for the same thing many times.
This CL instead assigns each `Drive` the files it was to look at,
each set will therefore only be querues once per type.
This takes the number of operations (per type) from `N*M` where `N` and
`M` are number of drives and number of files respectively (as each drive
could know all the same files) to just `M`, i.e. number of files.
This CL takes the runtime for asking for implementations of 'ToJsonable'
from package:analysis_server/lsp_protocol/protocol_special.dart in my
analyzer workspace (with 8 workspace folders / drivers) from ~4.4 seconds
to ~0.8 seconds (see below for details).
It also takes a call for "find all references" ("textDocument/references")
on method "newFile" in class "AbstractSingleUnitTest" in
"analysis_server/test/abstract_single_unit.dart" from ~36 seconds
to ~3.2 seconds (see below for details).
Raw data:
HEAD as of 56c416430e
textDocument/implementation
===========================
(notice the first query taking a long time)
(restart analyzer process)
Got answer to query in 0:00:28.921389
Got answer to query in 0:00:04.270255
Got answer to query in 0:00:04.248489
(restart analyzer process)
Got answer to query in 0:00:08.319562
Got answer to query in 0:00:04.232582
Got answer to query in 0:00:04.102793
(restart analyzer process)
Got answer to query in 0:00:09.186371
Got answer to query in 0:00:04.867653
Got answer to query in 0:00:04.840468
textDocument/references
=======================
(notice the first query taking slightly longer)
(restart analyzer process)
Got answer to query in 0:00:41.916106
Got answer to query in 0:00:36.619501
Got answer to query in 0:00:36.502156
(restart analyzer process)
Got answer to query in 0:00:40.353819
Got answer to query in 0:00:37.709369
Got answer to query in 0:00:36.086530
(restart analyzer process)
Got answer to query in 0:00:40.052997
Got answer to query in 0:00:35.273826
Got answer to query in 0:00:35.589722
WITH CL
textDocument/implementation
===========================
(notice the first query taking a long time)
(restart analyzer process)
Got answer to query in 0:00:11.902654
Got answer to query in 0:00:00.742324
Got answer to query in 0:00:00.730748
(restart analyzer process)
Got answer to query in 0:00:04.966440
Got answer to query in 0:00:00.795087
Got answer to query in 0:00:00.820526
(restart analyzer process)
Got answer to query in 0:00:04.838173
Got answer to query in 0:00:00.810417
Got answer to query in 0:00:00.784124
textDocument/references
=======================
(notice the first query taking a long time)
(restart analyzer process)
Got answer to query in 0:00:07.632822
Got answer to query in 0:00:03.098794
Got answer to query in 0:00:03.008570
(restart analyzer process)
Got answer to query in 0:00:07.690932
Got answer to query in 0:00:03.062484
Got answer to query in 0:00:03.088793
(restart analyzer process)
Got answer to query in 0:00:07.786218
Got answer to query in 0:00:03.160477
Got answer to query in 0:00:03.248359
Change-Id: I18a3cbd870f62e87937f92942460baccf8bce088
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
These tests should the in the options file to enable them, but they should only be regenerated from the non-kernel dump info tests.
Change-Id: I4baf7459eb0ffce88363f1a791a585c78af73dbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272701
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Previously, we boosted the precedence of `as` inside patterns, to make
it higher than `|` and `&`. Now, we reduce the precedence of `|` and
`&` to match that of `||` and `&&`.
The new approach should make it easier to transition to using `||` and
`&&` in patterns.
Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I6658484860ef809bc9029fa75747fdd7ce986836
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272700
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>