Commit graph

22234 commits

Author SHA1 Message Date
Daco Harkes 732e4a43d5 Revert "[vm/ffi] Disallow nullable struct fields"
Revert submission 279511

Reason for revert: Flutter dependencies are using nullable struct
fields and need to be migrated first
https://github.com/flutter/flutter/issues/120260

Reverted changes: /q/submissionid:279510 /q/submissionid:279511

Change-Id: I7ab66ef6c6b5f21303804b2930af4ad6aa000413
Tested: Revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281600
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-08 08:51:28 +00:00
Daco Harkes c95d1fc1ad [test/ffi] Fix test
Closes: https://github.com/dart-lang/sdk/issues/51301
Change-Id: I1dba254b0e396003448ba24c1c676f3dde04a861
Cq-Include-Trybots: luci.dart.try:vm-asan-linux-release-x64-try,vm-aot-asan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281422
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-02-08 08:44:57 +00:00
Mayank Patke 397ed8673c [dart2js] Add phase 1 kernel transformer to simplify const conditionals.
Suppose we have code like

if (isDevMode) {
  // do foo
} else {
  // do bar
}

where isDevMode is const (or can be evaluated as const). In particular,
isDevMode can be controlled by compile-time options, like
bool.fromEnvironment.

We currently eliminate the dead branch during SSA, but that means we do
the work of compiling dead code in the previous phases. Instead, we can
recognize that the condition is const (or effectively const) and
eliminate the dead AST subtree directly.

Change-Id: Ia91da5ebc7fa496a1b963308c6e02d572cab936e
Bug: b/254543452
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270281
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-02-07 20:07:57 +00:00
Srujan Gaddam ff01414b8f [dart:_js_interop] Add support for statically resolvable inline class interop members
Amends lowerings on dart2wasm and JS backends to work for external
constructors/factories and static members. Tests members with and
without renaming of members/classes/libraries. Note that this does
not add support for object literal factories yet.

Change-Id: I149bef7249c1a13a31eed9f3510256d407b1d3e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280056
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-07 18:47:23 +00:00
Paul Berry a242875197 Test legacy flow analysis behaviour of case null.
I will be soon be implementing flow analysis for constant patterns.
This test is to ensure that when the language version doesn't include
support for patterns, we reproduce the legacy behaviour of `case null`
(which is not to draw any conclusions about type promotion or
reachability).

Bug: https://github.com/dart-lang/sdk/issues/50419
Change-Id: I2336a0e2cc30f5edf38d2b8da6bcd63fc62b30fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281282
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-02-07 17:10:10 +00:00
Kallen Tu 9c86cb80bb [tests] Update language tests with base/final subtyping loophole fixed and a few enum tests.
Change-Id: Id30bbdc4b6eedf0751f725024acbed812a07a4fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280860
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-02-07 03:01:27 +00:00
Daco Harkes c42d356199 [test/ffi] Skip self-invoking tests in appjit
Closes: https://github.com/dart-lang/sdk/issues/51265
Closes: https://github.com/dart-lang/sdk/issues/51266
Change-Id: If52adcce9b3d72fd6097e7d7c9f1f9aa1ffc3bc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281183
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-06 19:11:47 +00:00
Daco Harkes 4e7d71b593 [vm/ffi] Disallow nullable struct fields
TEST=tests/ffi/regress_51041_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51041
Change-Id: I44d82c5f378c5d001bfb7526be87c179b8160be1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279511
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-06 16:29:42 +00:00
Aske Simon Christensen 91fe18c4e3 [dart2wasm] Skip flaky lib/async/stream_periodic3_test
Issue: https://github.com/dart-lang/sdk/issues/50901

Change-Id: Idcfa9970eaeff39ed986085f453bb176fb986243
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281100
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-02-06 12:22:28 +00:00
Chloe Stefantsova 5cff200999 [cfe] Don't join unused same-name variables in pattern switch cases
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I245a68f48a217e26ad2e1a74a8996a8fef128da0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-02-06 10:24:35 +00:00
Nicholas Shahan d00acae4ae [ddc] Remove old dwds versions fallback support
The dart:developer APIs `registerExtension()` and `postEvent()` no
longer write directly to the console.

Fixes: https://github.com/dart-lang/sdk/issues/48103
Change-Id: I41ee807eb376abbac87d0f353dde22bebd732faa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279233
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-02-04 04:09:48 +00:00
Ryan Macnak 8236fad86a [test] Synchronize status entries for fragmentation_test.
Was marked in standalone_2 but not standalone.

Change-Id: I2c20c64f7d472d94642a3ada595c33412ef3bc3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280800
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-03 20:43:10 +00:00
Kallen Tu b7d0a982b6 [cfe] Report errors for final class and mixin subtyping outside of its library.
Change-Id: I958fd30e2ed37ae3ca4311967575c8176ca2cd48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280249
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-03 01:17:41 +00:00
Kallen Tu aa7a150bcd [cfe] Report an error when extending an interface class or mixing in an interface mixin.
Change-Id: I23019c69f74f2405f196eac5d58048138bc6408a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280244
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-02 23:23:13 +00:00
Joshua Litt 99a9f3d516 [js_types] MVP of JS types.
Change-Id: Ic329146a270ff32fc2cdb32febc6f574bc81792f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280131
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-02 21:29:01 +00:00
Aske Simon Christensen bc31fe4903 [dart2wasm] Enable values to be returned from void functions.
Since Dart `void` can actually carry values, functions with `void`
return type are translated into Wasm functions returning the Dart
object top type instead of an empty output type list.

Only constructors, setters and imports/exports with void return type
are now given empty output type lists in their Wasm signatures. A new
low-level `WasmVoid` type is added to the internal Wasm types for
specifying explicitly that a Wasm function should have an empty list
of outputs.

Fixes https://github.com/dart-lang/sdk/issues/50458

CoreLibraryReviewExempt: Only changes Wasm-specific libraries.
Change-Id: I9562248f94e75a60142fd1af0136183aa288b98b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279971
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-02-02 12:08:30 +00:00
Kallen Tu 8cce064bf1 [analyzer] Report errors for final class and mixin subtyping outside of its library.
Change-Id: I7fbd0d0e36d360ce1a02cf7c4ecd6ccd2a29c999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280206
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-01 22:11:39 +00:00
Kallen Tu 6ee64808ce [cfe] Refactor error handling for all existing class modifier behaviour.
Change-Id: I925f008ef3a1522c4e60f283dbdbd0fb5b1e290c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280049
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-01 20:08:50 +00:00
Johnni Winther 93ebb9a852 [cfe] Handle general types in object pattern
Closes #50872

Change-Id: If1a8225b85e70bedb1391d6ee8d6d34a70015553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280118
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-01 10:24:44 +00:00
Johnni Winther e77907f755 [test] Extract test for "native"
This move the test of the "native" syntax, support by the CFE, to
a separate test. The test (expecting the syntax to _not_ be supported)
fails on the CFE but that has nothing to with the records/patterns
features which the remaining tests in syntax_test.dart require.

Change-Id: Idef0d8b58b24488bcd4e3318eac9638152056b2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280111
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-01 10:06:37 +00:00
Stephen Adams 5164ecd5ec [dart2js] Add test for issue 51179
http://dartbug.com/51179 - the defaulted value of `s1` is `null` instead of the correct string `'default value'`.

Bug: 51179
Change-Id: I437d95d8a4a273fd014a005f6c40a9be05f45d2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280138
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-02-01 03:29:49 +00:00
Kallen Tu 95c1899b43 [analyzer] Report an error when extending an interface class or mixing in an interface mixin.
Change-Id: I868b8c89fa52edbcd05d7f06e3246196bbf3d952
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279910
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-31 19:18:40 +00:00
Brian Quinlan 252015b30b [io] Fix a bug where large reads would return partial data.
Bug: https://github.com/dart-lang/sdk/issues/51071
Change-Id: Ia64d803c9709b106e52a1c671c1c3288c051bd85
Tested: ci + new test
CoreLibraryReviewExempt: bug fix only for vm
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279204
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-31 18:41:39 +00:00
Aske Simon Christensen 5aae8f9688 [dart2wasm] Skip VM-specific co19 Finalizer tests
Change-Id: I6ba56c089362bf6c36a7f7cd918862d72cb68991
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280089
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-31 10:28:36 +00:00
Kallen Tu 83a9a0a3f4 [analyzer/cfe] Make sealed and mixin class errors more precise and synced between the CFE and analyzer.
Updated corresponding language tests. No new behaviour, updated test messages and location.

Change-Id: Ib3c7e2d701bdfbb68757c532b945348f6cbebad0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280062
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-31 01:53:09 +00:00
Srujan Gaddam 821d85e661 [dart:_js_interop] Expose a interop type for JS objects
Moves JSObject to dart:_js_helper, so that JavaScript objects
can be used with that type in the JS backends. The type then
gets reexported in dart:_js_interop with a typedef.

This is purely for experimentation. This class needs to be sealed
before we can publish this library.

Change-Id: I16093165deaa5bc5d7940eb0cb98da32c36e485a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278894
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-30 20:01:37 +00:00
Josh Soref 77978889eb Spelling
Closes https://github.com/dart-lang/sdk/pull/51143

GitOrigin-RevId: 9e21c99a222d588e4fc95980725a2f8c9784965c
Change-Id: If0870e8936c7649935dce7e23cd783d62aa5610c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279916
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-30 18:29:59 +00:00
Ahmed Ashour 63180b95ed Remove superfluous words.
Fixes #51095

TEST=ci

CoreLibraryReviewExempt: There are no API changes, just removal of superfluous words in the comments.
Change-Id: Ib1020c62fe6baed5ca68f0074323f025cc90e9f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279500
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-01-30 15:58:38 +00:00
Aske Simon Christensen e805b776bc [dart2wasm] Use status files for defining which tests to run
This makes it easier to run tests locally, just specifying the suites
`co19 corelib language lib web` to `test.py`.

It also make it easier to change which tests we run going forward.

Change-Id: I3a4765c18ee105055fdb9a6b59036da11b956e1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279973
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-01-30 10:42:22 +00:00
Lasse R.H. Nielsen bee7ab2b32 Make record positional field getters start at $1.
An update for co19 is available at https://github.com/dart-lang/co19/pull/1759

TEST=Existing tests run after change, two new tests for edge cases.

Change-Id: I408e398d532ba2c2e8e60777bb4f7bd0057e27fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278912
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-30 08:14:28 +00:00
Jackson Gardner 4dff36345e [dart2wasm] Use the asset in @Native annotations to specify the module name.
Change-Id: I5e3644a904917a375486acd47830f311fe19a5ce
Tested: Running unit tests in this repo as well as running against coming web engine changes that use the @Native annotation: https://github.com/flutter/engine/pull/39072
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279479
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-28 00:03:07 +00:00
Srujan Gaddam 70f1858700 Filter trusttypes_test from being run on CSP bot
Change-Id: Ie241d1eabbcb28ef4e50661a2afda2d832317c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279909
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-27 03:13:07 +00:00
Kallen Tu f48a1fb3da [analyzer] Report error when implementing a base class.
Change-Id: Ia55354350451849a112a32bb048a4fcbe5afe1b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279655
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-26 22:15:57 +00:00
Srujan Gaddam 812d26f7b1 [pkg:js] Amend lowerings tests to use @JS on all top-levels and refactory trustTypes tests out
dart2wasm does not allow top-level externals to not be annotated
with @JS, even if the library is. trustTypes also is not supported
on dart2wasm.

Change-Id: I8c1d146dcf5d9f97559e854be690bb98726513b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279757
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-26 21:20:27 +00:00
Joshua Litt a64b34d3f3 [dart2wasm] Use static interop to implement regexp helpers.
This CL also adds changes how static interop objects are interpreted at the interop boundary. Previously, static interop objects were dartified / jsified like everything else. Now, they are simply boxed.

With this approach, users can now use `Object` when they want conversions and static interop objects when they don't(assuming these objects originate in JS, Dart objects are always fully converted).

Change-Id: I40b31bfb826e4963a34eaa373574c136e13b9009
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279451
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-26 17:03:40 +00:00
Kallen Tu 7cf49ba433 [cfe] Report error when implementing a base class.
Change-Id: Iff3c31b4883d3d4fc4c392c6ac8207617ce65761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279648
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-26 16:01:55 +00:00
Josh Soref 01b28894e7 Spelling pkg dev compiler
Closes https://github.com/dart-lang/sdk/pull/50861

GitOrigin-RevId: 71005e6f5bf5a151cb5c1aefb6a2a300fc40f592
Change-Id: Iadfafb5787a62e9a379437f6a3763d31f99ba7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277743
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-26 09:12:41 +00:00
Srujan Gaddam 45817fd9c7 [Reland][pkg:js] Lower @staticInterop non-anonymous constructors
This is a reland of https://dart-review.googlesource.com/c/sdk/+/279180.
This removes the anonymous constructor lowering, as the jsify
semantics are not the same as what we have today, since we do no
conversions today. This avoids the breakage in Flutter where we
convert a Uint8List in jsify.

Change-Id: I7eb4ffbd3258abdf6c1aea2035f7dab0336d4851
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279231
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-01-25 18:50:27 +00:00
Josh Soref ef42a0b110 Spelling pkg analyzer lib
Closes https://github.com/dart-lang/sdk/pull/50860

GitOrigin-RevId: b27066c37f93c8c6d1123d6ebd6a4c0afcf59844
Change-Id: I15fa4aea1dad45daf168e34d1c4450320ec9b40a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277742
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-25 14:08:27 +00:00
Daco Harkes 90668fba0c [tests/ffi] Folder deletion on Windows
On windows we do have a crashpad handler we use to capture coredumps.
This functionality is initialized in `runtime/bin/main_impl.cc` /
`runtime/bin/crashpad.cc`. That may start a subprocess. If that
subprocess has the tempdir as working directory (or inherit handles
referring to it / subdirs/subfiles) it may prevent it from being
deleted.
Adding '--suppress-core-dump' to the Dart process invocations prevents
this.

TEST=ffi/native_assets/infer_native_assets_yaml_dart_kernel_snapshot
TEST=ffi/native_assets/infer_native_assets_yaml_process_run

Closes: https://github.com/dart-lang/sdk/issues/51067

Change-Id: I75807e65e9911653983158a238194968aaedb51f
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279399
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-24 16:15:21 +00:00
Johnni Winther 3184f2224b [_fe_analyzer_shared][cfe][analyzer] Initial implementation of exhaustiveness checking
This adds the initial implementation of exhaustiveness checking in
the analyzer and CFE. The checking is currently only performed in
switch statements and only handle a subset of the patterns.

Change-Id: Ia0050c2c80fbefe3e22615599136f9d919ebe4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279173
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-01-24 13:34:46 +00:00
Erik Ernst 4f8af109af Correct primitive equality error test
Implicitly induced noSuchMethod forwarders cannot eliminate primitive

equality: They are not generated at all if they would override an
explicit member declaration (here: `Object.hashCode` and `Object.[]`).
Hence, the classes `Secret...` that we used to have (which were intended
to do just that) were simply compile-time errors, and hence those
classes and the locations where they were used are being removed in
this CL.
Change-Id: Id1a1f9bc1a2f7ce1886388d6938d0d0a4da45d84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279394
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2023-01-23 22:24:35 +00:00
Josh Soref b3df0a4bd5 Spelling tests standalone
Closes https://github.com/dart-lang/sdk/pull/50863

GitOrigin-RevId: e514be37c7f3b48cbce1048c359df00be7d2b18a
Change-Id: I45ad308db60a5935f18a877f5480874acfef0efd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277780
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-23 12:55:22 +00:00
Josh Soref ba15a61271 Spelling build
Closes https://github.com/dart-lang/sdk/pull/50859

GitOrigin-RevId: 7b056018c2925745701bdecdd7da325d9458204d
Change-Id: Iff037d773713bf73efde6951599becfd7297b921
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277740
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-23 08:56:14 +00:00
Alexander Markov 573625c5bc [tests] Swap Expect.equals arguments in language/records/simple/runtime_type_test
Addresses comment https://dart-review.googlesource.com/c/sdk/+/259621/comment/ecb5a789_1efbef0d/

Change-Id: I6825827d034d3f247511084636876af2e3a67361
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279442
Reviewed-by: Stephen Adams <sra@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-01-20 19:24:09 +00:00
Daco Harkes 17f4198cfe [vm/ffi] Native assets Windows fixes
Some artifacts are .exe instead of .bat.

Library uris with file schemes use the Uri.path (using forward slashes
on Windows), so the tests emitting native asset mappings should use
Uri.path as well. (Not Uri.toFilePath() which uses backwards slashes.)
The paths of the dynamic libraries in the assets should use the
toFilePath(), as these are passed to the system API which expects
correct paths.

The Platform.script Uri has a path with file:///C: and back slashes.
The uri RFC does not support back slashes, and our ResolveUri does
neither. So for Windows we replace backslashes with forward slashes.

TEST=tests/ffi/native_assets/

Bug: https://github.com/dart-lang/sdk/issues/51066
Bug: https://github.com/dart-lang/sdk/issues/51067
Change-Id: I2e168e0549fe80d9a5366d636c6f1ef971942130
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-win-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-msvc-windows-try,dart-sdk-win-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279356
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-01-20 18:20:17 +00:00
Daco Harkes c087340a8a [gardening] Skip asset tests on RISC-V QEMU bot
The test tries to invoke itself with the Dart executable.
On QEMU, this is hard to find. (It would make more sense to compute
things on the host OS rather than doing self-invokes for QEMU, but
requires a significant refactoring of these tests.)

Test is already skipped on ARM QEMU.

Bug: https://github.com/dart-lang/sdk/issues/51067
Change-Id: I65d47141728223b835ac79d99c243baddb7ddcb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279346
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-01-20 14:24:52 +00:00
Alexander Thomas b9b6511ca6 Spelling sdk
Closes https://github.com/dart-lang/sdk/pull/50918

Co-authored-by: Josh Soref <jsoref@gmail.com>
GitOrigin-RevId: 1fd275051c561b63d374fb47e76a22424c4a12a9
Change-Id: I97790d9c79ff659f2c1fa2d2d46d041fe67957cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278530
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-01-20 12:37:49 +00:00
Daco Harkes 6ef57b86c1 [vm/ffi] Support varargs
This CL introduces `VarArgs` to `NativeFunction` signatures. The
`VarArgs` type takes a single type argument. This type argument is a
subtype of `NativeType` if there is a single variadic argument, and a
record with native types if there are multiple variadic arguments.
For example:
`NativeFunction<Void Function(Pointer<Char>, VarArgs<(Int32,Int32)>)>`
for calling refering to a `printf` binding with two `int32_t` arguments
passed as variadic arguments.

The logic of the native calling conventions are detailed in
https://dart-review.googlesource.com/c/sdk/+/278342.
Here we explain how this influences the FFI pipeline.

First, now that `VarArgs` is part of signatures, we have to unwrap
that when with the C types in the CFE transform and checking (analyzer
is in a separate CL), and also in the marshaller when looking up the
C type of arguments.

Second, we have to deal with `BothNativeLocations`. On windows x64,
floating point arguments must be passed both in FPU _and_ CPU
registers. For FFI calls, we solve this in the argument moves by just
copying to both locations. For FFI callbacks, we just take the FPU
register location (which avoids an extra bitcast).

Third, on System-V, we have to pass an upper bound of the number of
XMM registers used in AL. This means we instead RAX, we use R13 for the
target address. For variadic calls, we always pass 8 in AL as the valid
upper bound. We could consider passing the actual number of XMM
registers used.
We keep using RAX as default register for the function address on non-
variadic calls, because changing to R13 (the first free) register
creates more spilling in leaf calls. R13 is callee-saved while RAX is
not, so using R13 instead of RAX causes us to have to spill the value
from RAX on leaf calls.

Fourth, on both x64 and RISC-V, we pass floats in integer locations.
`EmitNativeMove` has been modified to deal with this, so that we do not
have to insert more `BitCastInstr`s.

The tests are generated by a test generator: `tests/ffi/generator/`.

The formatter doesn't support records yet, so the tests are not properly
formatted.
Bug: https://github.com/dart-lang/sdk/issues/50798

TEST=tests/ffi/*_varargs_*

Closes: https://github.com/dart-lang/sdk/issues/38578
Closes: https://github.com/dart-lang/sdk/issues/49460
Closes: https://github.com/dart-lang/sdk/issues/50858

Change-Id: I6a6296fe972527f8a54ac75a630131769e3cc540
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-debug-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,app-kernel-linux-debug-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276921
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-01-20 10:30:41 +00:00
Konstantin Shcheglov 8a28d75184 Update language/patterns/shared_case_variable_test
Change-Id: I5a6caeda972a588e39ff50b525d0f84f34c54c34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279321
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-01-19 21:10:09 +00:00