This reverts commit d9ea7207e8.
Reason for revert: b/261854137
Original change's description:
> [ddc] Wrapping loadLibrary checks in a future to obey eval order rules
>
> These checks are cosmetic right now in DDC, but the load check was happening synchronously rather than after the future returned by loadLibrary completed.
>
> Change-Id: I867779605ddfe4f63b83b47418994e0c5e68572a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274087
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Mark Zhou <markzipan@google.com>
> Reviewed-by: Anna Gringauze <annagrin@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: If7e19644498835d0f77569ce11a2438f4d012f6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274362
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This CL adds support for flow analysis with variable patterns and
guards, and integrates it with if-case elements, if-case statements,
pattern variable declarations, switch expressions, and switch
statements. It includes support for guards.
No other types of patterns are handled yet.
Bug: https://github.com/dart-lang/sdk/issues/50419
Change-Id: Iacad82b472cba0e2e670981847258e4046017576
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274162
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The timeouts are crashing the test infra when trying to deflake
the failures and preventing more results from getting uploaded.
These tests are timing out right now on the canary bot because
support for the new runtime types hasn't been fully landed. They
should be enabled again after all the support has landed and
should have results at parity with the non-canary configurations.
Change-Id: Ia8814c02445acccb906c4b376c82da88480155b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274483
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Revisions updated by `dart tools/rev_sdk_deps.dart`.
dartdoc (4d7dc93..f2bb6e9):
f2bb6e92 2022-12-07 Sam Rawlins Bump to 6.1.4 (#3266)
fixnum (62916f2..e4f5e97):
e4f5e97 2022-12-08 Michael Thomsen Change IntegerDivisionByZeroException to UnsupportedError (#100)
3bd726f 2022-12-08 Devon Carew rev the sdk min to 2.19.0-0 (#99)
logging (f322480..0373ef8):
0373ef8 2022-12-07 Mushaheed Syed Add a check that throws if a logger name ends with '.' (#123)
6d46d71 2022-12-06 Devon Carew Create no-response.yml (#124)
protobuf (4f3e328..2706b53):
2706b53 2022-12-07 Mahdi K. Fard Add type to a method parameter (#782)
a57c16a 2022-12-07 Mahdi K. Fard Fix a typo (#781)
shelf (1c21047..32e342d):
32e342d 2022-12-08 István Soós Prepare the release of shelf_router_generator (#316)
06e2fe6 2022-12-08 Kevin Moore shelf: drop non-null-safe tests (#317)
98363fd 2022-12-06 Kevin Moore lint: sort pub dependencies
ad6af2a 2022-12-06 Kevin Moore shelf_static: move RegExp creation out of every request
test (4dceb87..73cd754):
73cd7540 2022-12-07 Nate Bosch Record the working directory for VM platform (#1804)
e40274a6 2022-12-07 Nate Bosch Restore mono_repo config (#1810)
02d8764e 2022-12-07 Sigurd Meldgaard Use Future for return type in runner `main()`. (#1809)
3d6039b3 2022-12-05 Nate Bosch Merge test selections by path (#1806)
webdev (e39506e..3e2364e):
3e2364e 2022-12-07 Elliott Brooks (she/her) Add the Dart Debugger / Flutter Inspector panels in Chrome DevTools (#1812)
c164231 2022-12-07 Elliott Brooks (she/her) Small fix to the extension test (#1811)
4bbb4d0 2022-12-06 Elliott Brooks (she/her) Gracefully handle debugger disconnect events (#1808)
d3892cf 2022-12-05 Elliott Brooks (she/her) Refactor puppeteer tests to use `Worker` type (#1809)
Change-Id: I42033e849f40f209831cfb344247b24ad7731ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274580
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This saves space for the constant values, since the same value will
use the same constant box object, and it avoids runtime allocation of
boxes for literal values that are boxed directly.
New passing tests:
- language/super/bound_closure_test/01
- co19/LanguageFeatures/Patterns/constant_A05_t01
- co19/LibTest/collection/ListBase/ListBase_class_A01_t03
- co19/LibTest/collection/ListBase/ListBase_class_A01_t04
- co19/LibTest/collection/ListBase/ListBase_class_A01_t05
- co19/LibTest/collection/ListBase/ListBase_class_A01_t06
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t03
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t04
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t05
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t06
- co19/LibTest/core/List/List_all_t03
- co19/LibTest/core/List/List_all_t04
- co19/LibTest/core/List/List_all_t05
- co19/LibTest/core/List/List_all_t06
Change-Id: Id7570a2dd16f02590e722115e4d7168c4a741d99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273843
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This recovers the accuracy of types that were previously being widened and even performs better than today's algorithm for some specific cases.
Change-Id: I0139a0fd662a91315282ba94e4c1a29d44056b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273501
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This will be used to allow multiple top-level declarations to be moved
together.
Change-Id: Ib1c59e9ff3e01891f8cb29b74e78183c36b1f02d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273828
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This should look for `dyn:call` instead of `call`. If it was a non-dynamic call, we would hit an invoke-field-dispatcher instead.
TEST=ci
Bug: https://github.com/flutter/flutter/issues/116405
Change-Id: I98c441fec2eb53ab23ac1dd52db3aa4eaa5cbc6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274265
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
These will fail unless the current stack frame happens to be in the library that declares them, which results in a lot of exceptions being shown in variable views.
Fixes https://github.com/Dart-Code/Dart-Code/issues/4296.
Change-Id: I5919e391f25a08920dcdf1bf648526d175af00f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274040
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Running tests under qemu simulator are slow. To prevent tests from
flakily going over the timeout limit, we give them 2x the time.
Change-Id: I41f771d5b958d11d073fd9808663b0b9f298ad9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274384
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
The static type of a tear-off is the signature type of the method.
The runtime type is the same with the types of all covariant
parameters replaced by `Object?`.
Change-Id: I9bb36a36ec04e27deab2b31c977fadac515ad561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273845
Reviewed-by: Joshua Litt <joshualitt@google.com>
The current two-level indexing scheme for function type parameters
(depth and index) breaks down in the case of type substitution when
the substituted type is a generic function type, since its internal
type parameter types have been encoded assuming that the function type
had nesting depth zero, but after substitution its nesting depth can
be higher.
Relative indexing schemes such as De Bruijn indices will also not
work, since function type parameter types are constant types, and the
constant infrastructure assumes that the same constant always has the
same representation.
This change introduces a flat indexing scheme where function type
parameters are indexed using a single index which is independent of
the context in which the type parameter type appears. To avoid
collisions in the case of nested generic function types, every function
type has a type parameter offset, which conceptually shifts the
indexing range of its type parameters so it doesn't necessarily start
at zero.
Looking up a function type parameter in its environment thus involves
searching outwards until a function type is found whose type parameter
index range contains the index encoded in the function type parameter
type.
Change-Id: I544056d52711ff829b170f78a7274a93871825a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272361
Reviewed-by: Joshua Litt <joshualitt@google.com>
AsmIntrinsifier::OneByteString_getHashCode now uses the CombineHashes
and FinalizeHash Assembler methods introduced in 49f998dc31.
To avoid having to check for 0 again after masking the result of
FinalizeHash to fit the desired bit size, we create a more general
FinalizeHashForSize that also takes the desired bit size of the result.
The intrinsified versions for ARM/ARM64/RISCV are also modified to
remove the special casing for the empty string, and instead just check
the size of the string against the loop counter at the start of the
loop, similarly to X64/IA32. This is less efficient for the empty
string case, but avoids the need to create a version of FinalizeHash
that elides the zero check.
TEST=ci
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-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
Change-Id: I53db731acb8bf35d16efb55fa2c5a79d8302399f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272800
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This version contains a `--closed-world` flag that we want to provide
to `wasm-opt` in the dart2wasm benchmarking script from the start.
Change-Id: I5f97cd1911dad9946ac17fa25f9b11b0ed48bed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273221
Reviewed-by: Martin Kustermann <kustermann@google.com>
Since Dart 2.0 we can never have FallThroughErrors.
The CFE does not synthesize breaks unterminated cases which never
reach the end of the block. For example:
* Call to something that returns never.
* Nested complete switch which returns from every branch.
In these cases we need to construct a correct control flow in the VM,
even though it is dead code. Because the CFE does not make the outer
switch a labelled statement, we cannot find a jump target in the VM.
Therefore, throw something (just not a FallThroughError). This should
never be hit at runtime, because it's dead code.
When the CFE emits synthetic breaks, we can remove this workaround.
TEST=build SDK and run default suites.
Bug: https://github.com/dart-lang/sdk/issues/50595
Change-Id: I595dd3baf7253b0ac4931445bd5b6da49e84cae4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273740
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
This reimplements dynamic call code generation to add support for type
checking, named parameters (optional and required), and fixes a few
related bugs on the way.
Currently we do not try to be as efficient as possible. The goal with
this patch is to implement it correctly.
Summary of the changes:
- For every dynamic access kind and member name, we generate a new
"forwarder" function. Dynamic gets, sets, and invocations are compiled
to calls to the forwarders with the right access kind (invocation,
get, set) and member name.
For example, if the program has dynamic invocation of a member "f", we
create an "invocation forwarder for f". If it has a dynamic get of a
member "x", we generate "getter forwarder for x".
- Forwarder functions take 4 arguments:
- Receiver of the invocation, get, or set.
- A Dart list for type arguments in the invocation. For gets and sets
the list is empty.
- A Dart list for positional arguments in the invocation. For gets the
list is empty. For sets, the list only has one element.
- A Dart list for named arguments. For gets and sets the list is
empty. The list has alternating elements of type `Symbol` and
`Object?`, for the name and value of the named parameters.
- A forwarder function compares receiver class ID with the potential
targets of the call. When it finds a match, it compares the callee
"shape" with the parameters passed in the call site.
As it compares the shapes it adjusts argument lists:
- Creates default values for missing optional positional and named
arguments
- Reorders the named argument list to match order expected by the
callee
If it can't find a matching class ID and a member with the right name
and shape, it calls `noSuchMethod` on the receiver.
If it finds a matching class ID and a member, it calls the "type
checker" for the member, passing the original receiver and adjusted
argument lists.
- A "type checker" implements argument type checking for a member, and
it's a member of the same class as the member it's checking types
for. This is to allow accessing class-bound type parameters when
generating type checking code.
- Type checking is implemented using `_isSubtype` on arguments in the
lists.
- When type checking is successful a type checker calls the original
member, passing the arguments as expected by the member.
If type checking is unsuccessful it throws a type error.
Most of the changes are for generating Wasm functions that compare
shapes, adjusts argument lists, and checks types.
Changes to members:
- `Translator.dynamics` fields is renamed to
`Translator.dynamicForwarders`
- New field `Translator.dynamicForwarderFunctionType` added for the Wasm
function type of forwarder and type checker functions.
- Two new code gen utilities added:
- `Translator.indexList`: generates code that indexes a Dart list
- `Translator.getListLength`: generates code that gets length of a
Dart list
- New `Reference` extensions added to get type checker function
references of members
- New runtime library `named_parameters` implements two helper functions
for dealing with named argument lists
- The library `dynamic_dispatch` is replaced by `dynamic_forwarders`,
which consists of two classes:
- `DynamicForwarders`: maintains mapping from call kind (get, set,
invocation) and member name to forwarder functions.
- `Forwarder`: a single forwarder, implements code generation for
forwarder functions.
- `CodeGenerator` gets 3 new members:
- `_callForwader` generates call to a forwarder
- `_generateFieldSetterTypeCheckerMethod` generates code for a type
checker of a setter function.
- `_generateProcedureTypeCheckerMethod` generates code for a type
checker of a method.
Fixes#50367
Change-Id: I2b9d84237c8517bd217166d8acb67e025f0498fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272261
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This CL removes some duplication of Strings:
* Most duplication in `relevanceTagsInFile` (`ElementKind.CLASS`, etc)
when loaded from file.
* Usage of `()` for `parameters`.
* Empty string return type.
* Known type return type.
On the analyzer instance I've measured on (8 folders with analyzer etc
open) this saves:
Before CL: 161851 kb 2158725 _OneByteString dart:core
1: 154622 kb 2001695 _OneByteString dart:core // removes most practical duplication from relevanceTagsInFile
2: 153247 kb 1957751 _OneByteString dart:core // Removes () parameters
3: 152970 kb 1939890 _OneByteString dart:core // Removes empty string return type
3: 151287 kb 1886063 _OneByteString dart:core // removes void, String, bool, int, Future<void> return type
That's a total of 10,564 kb or 272,662 instances.
This is also ~1.7% of total ram usage.
Change-Id: Ide2ae55ae052d9f8bc382805a204dce48bf2b263
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Fixes https://github.com/dart-lang/sdk/issues/46967
Creates classes for non-external factories and static members, and
modifies invocations to point to these members instead. Tear-offs of
interop constructors (external or otherwise) are now supported since
they're just non-external static methods.
Change-Id: Id754fb4bc872051a8df4169aefd4bdc078452fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270501
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
In the new runtime type system when running with weak null safety,
perform type tests multiple times to produce optional warnings or
errors when a test passes but would fail in sound null safety.
This is the same technique DDC uses with the current type system.
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ic1514987a6f4ffeb127a0d2be5ec15b606016212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266543
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Variable patterns behave so differently inside a patternAssignment
that we may want to represent them using different AST nodes inside
the analyzer/CFE. This change adds a boolean flag allowing the
implementation to know what kind of variable pattern it's looking at
when parsing occurs.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I60adf2865bbe24f85b72a79b1360833bf823bd67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273829
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
```
import 'dart:typed_data';
@pragma("vm:never-inline")
fetch(l, i) => l[i];
main() {
const n = 16*1024*1024;
final l = ByteData(16 * n).buffer.asFloat64x2List();
for (int i = 0; i < n; i++) {
fetch(l, i);
}
final sw = Stopwatch()..start();
for (int i = 0; i < n; i++) {
fetch(l, i);
}
print(sw.elapsedMilliseconds);
}
```
on x64
before 1137ms
after 101ms
BUG=https://github.com/dart-lang/sdk/issues/50636
TEST=ci
Change-Id: I90ef8ccfa1161d4d8bb076a3c1a0e3c7d6521289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274263
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>