Update some other methods to be more performant than the default
inherited from `MapMixin`.
Change argument validation to `map.[]=`, `map.putIfAbsent` and `set.add`
checks that the key/element is allowed by the `compare` function.
Previously the map methods just checked `key != null` (which was wrong),
and compare did nothing special, both just relied on the `splay` call
doing a `compare` call. That was not true for an empty map, which means
that you could add a key/element which wasn't a valid comparable,
as long as you did it as the *first* key/element.
That is now caught.
Bug: https://github.com/dart-lang/sdk/issues/45296
Change-Id: I8ba49a7892ed27daa4434f5fb7be3e777ef32bc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190883
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Closes: https://github.com/dart-lang/sdk/issues/38158
This CL implements unaligned access for float/double on arm32, but does
not expose it in an API. Rather it only uses these loads/stores inside
the getters and setters of packed structs.
Bug: https://github.com/dart-lang/sdk/issues/45009
Besides unaligned access for float/double, this CL is mostly a CFE
change. The only VM change is reading the packing in the
`_FfiStructLayout` annotation.
The implementation of using the packing in the VM, and analyzer changes
have landed separately in earlier CLs.
tools/test.py ffi ffi_2
TEST=tests/ffi(_2)/(.*)by_value_(*.)_test.dart
Change-Id: Ic3106ecc626d2e30674a49bf03f65ae12d2b3502
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186143
Reviewed-by: Aske Simon Christensen <askesc@google.com>
There are also skips for these tests in the legacy (*_2) suites.
I'm leaving those as skips because I think they will never be
expected to work since you have to opt into a newer language
version to get the feature.
Change-Id: I1631b1523c6a9be9a14c69c8cf772ea58309c706
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191482
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This test failed because it had a test outcome expectation comment in
a library which is not the entry point (cf. #44990). This CL changes
the test such that said comment is located in the entry point. The
trade-off is that this test now has a "reverse" import: A library
with null safety enabled imports a legacy library (but, apparently,
this does not cause the test to fail).
PS: This means that we don't have a test that will go green when #44990 is resolved.
Change-Id: Ie94bff22ce75bd662752c5814917e141fafc72ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191365
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This CL validates the hypothesis that the only misaligned reads/writes
which are not supported are double and float, and only on arm32.
Running these on the CI and Golem will validate this hypothesis.
Bug: https://github.com/dart-lang/sdk/issues/45009
Change-Id: I0a77fd1f47a388d1f454c1ded50cd7ecaeadb0f0
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190523
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
1. Replace unintended '>>' with '>>>'
2. If infinity is an int, it is a large shift count and not an error.
3. Improve web coverage: Put the dynamic validation tests their own
(multi)parts so that failures of validation are separate to incorrect
results so can't mask incorrect results.
Change-Id: I569135507f1f23a01bde1f85f7ce91dec2bd8df4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189960
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This CL only changes dart:ffi API, CFE, and analyzer. No VM changes
were needed because the dimensions of inline arrays can be flattened
before passing them to the VM. The multi-dimensionality does not
impact the ABI.
Closes: https://github.com/dart-lang/sdk/issues/45023
TEST=pkg/analyzer/test/src/diagnostics/size_annotation_dimensions_test.dart
TEST=pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart
TEST=tests/ffi/function_structs_by_value_generated_test.dart
TEST=tests/ffi/inline_array_multi_dimensional_test.dart
Change-Id: Ica2c01fccbea7e513879365b34086d8968b54c5b
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188286
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Altered the structure of the statement visitors now that ConstantEvaluator is an expression visitor. Currently uses the environment from the prior exprEvaluator, but will change in the future when needed.
No new const functionality, just set up for future ones.
Tests renamed so they actually run now.
Change-Id: Ic5914b0fc700aadeb0dcb28c08593f88e38582a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189220
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
When the CFE encounters an ill-typed spread element in an ambiguous
set/map literal, it replaces it with a synthetic MapEntry object
pointing to an InvalidExpression. If there is no non-synthetic
MapEntry in the set/map, and it is decided to disambiguate to a set,
then all of the entries are fed into the `convertToElement` method.
Before this CL, this method would see the synthetic MapEntry and
assume the user had explicitly written a key-value pair in a set
literal, so it would try to report the error `Expected ',' before
this` at the location of the `:` in the key-value pair. But since the
MapEntry was synthetic, there was no `:` and the message was very
confusing.
This CL changes `convertToElement` so that it detects when a MapEntry
has arisen from an error, and avoids creating a follow-on error.
Fixes#45174.
Bug: https://github.com/dart-lang/sdk/issues/45174
Change-Id: I37dc82a130b4bf858b3fb7411bb9c64f7450bd16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188940
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL extends language/metadata/metadata_location_test.dart with a
couple of extra test cases, covering the situation where the metadata
occurs on a type paramater or value parameter of a function type.
Change-Id: I9b225e8c3d72aa5ddd8893526e65ab4d1b5ab2a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187922
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
If the test runs in AOT mode the executable is
`dart_precompiled_runtime` and the script is the AOT snapshot.
If the AOT snapshot was compiled with `--enable-assert` then the
subprocess has to be launched with the same flag.
TEST=Fixes current test failure in dartkp-weak-asserts-mac-release-simarm64 mode.
Change-Id: I69a17f9a355f8729e9047f98c920a5c7c2480293
Fixed: 3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187920
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>