Note, that currently `correctionMessage` is a property of `ErrorCode`,
so we cannot forward from macro diagnostic. Something to discuss.
Change-Id: I6de86f4c16356bbf7bd61c483bad4d039ca67638
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351620
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Setting an error code of -1 on macOS and Linux results in an error code
of 255 being set since negative error codes are subtracted from 256.
However, an error code of -1 on Windows is not converted in the same
way, resulting in a difference of behavior between OSes.
This change updates -1 error codes to be 255 so they're the same on all
OSes.
Fixes https://github.com/dart-lang/sdk/issues/54857
Change-Id: Idcfbfab30d3cc31a9e4ca630b8d94caa03ef07b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351500
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reformats the code to use more newlines and less long lines.
Landing as a separate CL before refactoring to ease reviewing.
TEST=ffi suite
Change-Id: I018be8f27f19c312d36b112118291016b6be0ff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351145
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
For getting the address of `Struct` fields and `Array` elements
it would be useful to access the `_typedDataBase` field in these
'wrappers' in a unified way.
This CL makes `Array` extend `_Compound`.
Since `Array` is not a `SizedNativeType`, the implements clauses
for `Struct` and `Union` are moved to these classes.
Moreover, any references to 'compound' which only apply to struct or
union are updated.
TEST=test/ffi
Bug: https://github.com/dart-lang/sdk/issues/44589
Bug: https://github.com/dart-lang/sdk/issues/54739
Bug: https://github.com/dart-lang/sdk/issues/41237
CoreLibraryReviewExempt: No API change, only refactoring.
Change-Id: Ib9d8bccd4872df04bcc67731e4052f826ab70af4
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350960
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Address all warnings and errors in positive tests.
Move all static checks tests to tests/ffi/static_checks/ so it's
easier to ignore them in the analyzer.
Change-Id: I16ac2c00432a4e1b6750bffd9b03ac8a2e988fe6
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351123
Reviewed-by: Liam Appelbe <liama@google.com>
dart2js already had an external function in foreign_helper called
JS_FALSE. This function is completely opaque until it is lowered to the
constant value `false` in SSA, so one can write `if (JS_FALSE())` in
order to ensure that the guarded code is treated as live and compiled,
but eventually tree-shaken and omitted from SSA and codegen.
This CL adds a JS_TRUE counterpart for completeness, and exposes both
JS_TRUE and JS_FALSE through package:dart2js_runtime_metrics.
Change-Id: I9b375fa37ada1b65fb9183902bb295e05fa6b8c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349704
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
This CL:
* adds empty dart:_dart2js_only and dart:_ddc_only libraries for use in
conditional imports,
* updates pkg/dart2js_runtime_metrics to use the new libraries rather
than dart:_dart2js_runtime_metrics and dart:js,
* and removes some unnecessary libraries, including VM-specific
implementations in pkg/dart2js_runtime_metrics and the DDC
implementation of dart:_dart2js_runtime_metrics.
Change-Id: I9500aa303fa5ad8aba0e1d413f69957c268f3f11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350681
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This reverts commit 244f8cee87.
Reason for revert: Breaks windows builds.
Original change's description:
> [ddc] Fix running d8 with test.py
>
> - Add build targets to compile .dill outlines for common test
> dependencies using kernel_worker.dart.
> - Build ddc modules for common test dependencies and move amd versions
> to a separate subdirectory.
>
> Change-Id: I126b5821f6aea00b753d83560c76f00c6c5edc61
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350081
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
Change-Id: Ic5a17edc323b298eb8d60c82c755c6929e2cacc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351520
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reachability of proto fields is based on the VM's TFA protobuf_handler:
https://github.com/dart-lang/sdk/blob/main/pkg/vm/lib/transformations/type_flow/protobuf_handler.dart
In summary:
Usages of messages' field accessors are detected and registered. If no accessors for a specific field are used then the field is considered unreachable. In this case the metadata initializer for the field is replaced with a placeholder. Any protobuf messages only reachable from erased metadata initializers are also considered unreachable and are erased.
Note: The protobuf library exposes some reflective accessors which this algorithm does not detect usages of. If a field is only accessed reflectively this algorithm will still erase it and therefore users of these reflective accessors should not enable this protobuf shaking.
Protobuf shaking is disabled by default so this change will have no immediate effect on compilations.
Change-Id: I5ddf749bac4ebdcaf364de1cc9a16395a0ad8050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349760
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
All of these methods used to need a `contextType` parameter to pass to
the null safety migration tool. Now that the migration tool no longer
exists, they can be simplified.
Change-Id: Id6b15d88d8b0174022705c00fd524d17007a11e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
(The automated infra to create new D8 versions has some issues atm)
Change-Id: I5a43566f763eb3d9efeba0f0cab0357a802b33b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351061
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: William Hesse <whesse@google.com>
The riscv64 sdk builders build with --no-clang, thereby issuing
different set of warnings from clang.
Change-Id: I8c9a222bd9ea03fb78b5779fc5c652c22afb0543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351085
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: William Hesse <whesse@google.com>
This removes the logic that checks whether `dart:html` was
loaded in order to decide whether or not to show the message
suggesting to load the preamble file.
As described in https://github.com/dart-lang/sdk/issues/54596
this criteria is now obsolete, since we are shifting to use
package:web instead of dart:html in flutter web.
Going forward, the message is shown only when running the
compiler with the `--server-mode` flag.
We still track whether the preamble may be needed, but it may
not be worth doing all that effort in the future.
The alternative would be to show the message always
when using `--server-mode` or never (and rely instead
on documentation).
Fixes https://github.com/dart-lang/sdk/issues/54596
Change-Id: I177184590b4118be333ab93ddf5951e5b01afe7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351320
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Late field inialization stubs don't update field guard state which
causes incorrect optimizations when they rely on that state.
This change disables field guards for late fields in order to fix this
bug.
As an alternative, we could have added the code to update field guard
state from late field initialization stubs. However, it would require
duplicating and generalizing a lot of code used to implement
GuardFieldClass, GuardFieldLength and GuardFieldType instructions.
At the moment it is not clear if field guards provide sufficient
performance improvements to justify this.
Another possible approach would be to outline initializing field
stores from the stubs back to the application code
but that would cause either substantial increase in AOT code size
or an undesired discrenacy between JIT and AOT.
TEST=runtime/tests/vm/dart/regress_flutter142532_test.dart
Fixes https://github.com/flutter/flutter/issues/142532
Change-Id: I15e737aa5d1b73e71e0cb935580a3b9a2dcbb77a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350985
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This will allow these packages to take advantage of private field
promotion.
Change-Id: I35dc57ecd7a0c3afde4713cd60aca86b479393a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351162
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Android is based on Linux, so most of the files were identical
sans some subtle discrepancies caused by drift over time.
This discrepancies were making code base harder to maintain and in fact
were hiding bugs. For example, on Android eventhandler's implementation
of timers which relied on passing timeout to `epoll_wait` contained
a bug which was not present on Linux which used `timerfd` instead.
TEST=ci and manual testing of Flutter app on Android device
Fixes https://github.com/dart-lang/sdk/issues/54868
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-product-arm-try,vm-ffi-android-product-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try
Bug: b/311165013
Change-Id: Ia166f69c14177ec34160805a0983eafee8ea65f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350923
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Changes to `dart:ffi` often lead to expect-file updates. VM engineers
should be able to review and approve these changes.
So, this CL adds the VM engineers as owners of the test cases.
Change-Id: I84609b1bc74e1c15964f00b473a2bd3eed1fdf50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351122
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
The lowering for external calls works in multiple steps:
- we first expand it into a `js_util.callMethod` call (which uses .apply
internally)
- which we later refine in to a `js_util._callMethodUncheckedN` call, if
possible (which calls the member directly)
The second step only happens if we can statically verify the arity of
the method being called and that every argument passed doesn't need a
allow-interop check. The latter is bypassed if we know from the types
that it cannot be a Dart Function.
The new JS interop always satisfies the check, but the second step above
failed to regonize it because it didn't account for extension types. This
CL does the incremental fix to recognize it. Long term, we should
instead change the lowering to use directly the js_interop_unsafe
methods, and tailor the lowering to the new interop.
Fixes https://github.com/dart-lang/sdk/issues/54862
Change-Id: Ieee560e5cd6bd9b6921368477bf8212cae5a1faa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351221
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
- Add build targets to compile .dill outlines for common test
dependencies using kernel_worker.dart.
- Build ddc modules for common test dependencies and move amd versions
to a separate subdirectory.
Change-Id: I126b5821f6aea00b753d83560c76f00c6c5edc61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350081
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This is a fix to not include a null assert when it's
possible the value was null.
Fixes https://github.com/dart-lang/sdk/issues/49972
CoreLibraryReviewExempt: bug fix only affecting html library implementation
Change-Id: I26e6ebf3dc2d1ea3f9f458a32f519c5235e6d273
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350982
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Cleanup this old naming scheme before adding new configs for DDC
that run with assertions enabled in the host compiler.
Change-Id: Icbdee694fac46b3a1d5bab7ee7411c8e9be8c4a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335385
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
It doesn't make sense to build a list type that's not going to be
used. Just track the list's element type instead.
Change-Id: I121b55047a47c13ff8bdedb5d91b9ce6a74e75d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350984
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
These have been replaced with references to static properties on `Variations`.
Change-Id: I3eb725bc68f22e44d73342269a299b7ce84d8495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347385
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Replaces uses of `webNumbers` with `jsNumbers`.
CoreLibraryReviewExempt: no semantic changes - only updates to use new pkg/expect variations properties
Change-Id: I8072b0b1f92d37e756c211b5d0de106a59d0960b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346911
Reviewed-by: Mayank Patke <fishythefish@google.com>
This updates tests to start using `checkedParamters` and
`checkedImplicitDowncasts` instead of `dart2jsProductionMode`
CoreLibraryReviewExempt: no semantic changes - only updates to use new pkg/expect variations properties
Change-Id: Ie717b4fd44590ff1f977142cf5802c4aace34dea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346910
Reviewed-by: Mayank Patke <fishythefish@google.com>
* Allow --minify/--no-minify to override defaults from -O<level>
* Remove the unused(!) --name-section option from pkg/dart2wasm/*
=> Stripping it only makes sense at the binaryen step
* Make pkg/dart2wasm/tool/compile_benchmark support -g/--no-minify
=> Only useful for dart2wasm developers
Issue https://github.com/dart-lang/sdk/issues/54675
Change-Id: I695e985897b212fc345dcfd776553a009723d3b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351121
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Also uses some newer language features to cleanup nearby code.
Change-Id: I542911cd21ac0d77692edd7734b694c92d341ded
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346202
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
New service tests should be added to pkg/vm_service/test/ instead.
Change-Id: I22460753478c21956f56b5c7c29cb3dfbc500c21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350420
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This member cannot be used, as this external doesn't receive
a body.
TEST=ci
Change-Id: I2ed859c5f59b41c061a0dfd24b928696ef57b5bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351041
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This introduces a new library to write fine-grain requirements in individual language tests.
Each requirement is based on potential variations in behavior from existing Dart implementations and testing configurations.
This list will eventually be aligned with the list of requirements exposed in as features in the '// Requirements=' comment.
Change-Id: I320fc5037e2466724441b38a5b951999b58dafce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346909
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>