This is a partial reland of 6673f84d that just fixes the inlining of
_TypedList._getX in AOT without the changes to the base implementation
of the _TypedList._getX and _TypedList._setX functions.
TEST=vm/dart/inline_TypedList_getUint32
Fixes: https://github.com/dart-lang/sdk/issues/53513
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,dart-sdk-linux-riscv64-try,vm-aot-linux-debug-simriscv64-try
Change-Id: I2ef5244d50b2551a2326d6d511b9b720792346a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327840
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This reverts commit 6673f84d59.
Reason for revert: does not honor SupportsUnboxedSimd128(), breaking RISC-V
Original change's description:
> [vm/compiler] Perform inlining of _TypedList._getX in AOT.
>
> Before, the inliner only replaced calls to the _TypedList._getX methods
> with specialized IL if speculation was allowed. This means that the
> inlining would not happen in AOT mode, even though the generated IL
> does not require speculation.
>
> In addition, this CL replaces the native functions used for the
> base definition of _TypedList._getX and _TypedList._setX with
> versions built in the FlowGraphBuilder. With this, the VM avoids
> the overhead of going to the runtime for a native call when these
> methods are not inlined, which should also reduce the impact of
> a failure to inline.
>
> TEST=vm/dart/inline_TypedList_getUint32
>
> Issue: https://github.com/dart-lang/sdk/issues/53513
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-linux-release-x64-try,vm-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try
> Change-Id: I66b6b8634b2b9b413fb745f02433eb58f2ff913e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325703
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
Issue: https://github.com/dart-lang/sdk/issues/53513
Change-Id: If3a224e184f084fbe5d059cf036b2c2fb72cd57b
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-linux-release-x64-try,vm-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327802
Auto-Submit: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Before, the inliner only replaced calls to the _TypedList._getX methods
with specialized IL if speculation was allowed. This means that the
inlining would not happen in AOT mode, even though the generated IL
does not require speculation.
In addition, this CL replaces the native functions used for the
base definition of _TypedList._getX and _TypedList._setX with
versions built in the FlowGraphBuilder. With this, the VM avoids
the overhead of going to the runtime for a native call when these
methods are not inlined, which should also reduce the impact of
a failure to inline.
TEST=vm/dart/inline_TypedList_getUint32
Issue: https://github.com/dart-lang/sdk/issues/53513
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-linux-release-x64-try,vm-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I66b6b8634b2b9b413fb745f02433eb58f2ff913e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325703
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This test uses `dart:cli`s `waitFor` which only works under a flag now.
TEST=ci
Change-Id: I9efe139c868d12c6fa2af1c0d7bfa64a5af5b2a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326100
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This makes elf_loader.cc consistent with the other compilation units containing Dart_* functions. Addresses a Mac linker warning that these functions match the export glob but have hidden visibility.
TEST=build
Change-Id: I868c9940a7027c466c1173aa2db2fbeff6fe8999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325362
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Before running CP find all branches of form `Branch(v eq C)`,
where `eq` is one of `===`, `==`, `!==` or `!=` and `C` is
a constant and insert a redefinition of `v` in the true
successor which captures the information that `v` is equal
to `C` guaranteed by the branch.
SCCP algorithm can then use this information when propagating
constants. After SCCP all redefinitions inserted are removed
again.
We don't actually replace `v` with `C` in the dominated code
because this might lead to issues later, for example
it might result in redundant phis `phi(C, v)` (`C` flowing
from a predecessor where `v == C`) which are complicated
to eliminate again.
TEST=vm/dart/comparison_canonicalization_il_test
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-android-release-arm64c-try
Change-Id: I388dddb97b5e35f09d9904000c585864f27400f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324980
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
`IsTrivial` is supposed to return true iff `ToCompileType` would
produce a trivial (dynamic) type. However `IsTrivial` was taking
some of the irrevant parts of the `InferredTypeMetadata` into
account - meaning that it returned `false` where it should have
returned `true`.
This lead us to assign useless `dynamic` result type to various `StaticCall`, some of these calls can later be lowered to
`LoadIndexed` instructions, which will then also get the `dynamic`
result type. This useless type will then take priority over more
precise element type which could be inferred by
`LoadIndexedInstr::ComputeType`
TEST=vm/dart/load_indexed_trivial_type_il_test
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-android-release-arm64c-try
Change-Id: I69ee965ba0d0ac85ede3989680371f0dda19d8a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325302
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Consider for example the following two functions
f0(int value) => value == 0 ? ... : ...;
f1(List<int> list) => list[0] == 1 ? ... : ...;
before this change we would produce a `BoxInt64(value)` followed by
`StrictCompare` in `f0` and `UnboxInt64` followed by `EqualityCompare`
in `f1`. However the decisions should be reversed: when comparing
unboxed values we should lean on `EqualityCompare` and when
comparing boxed values when smis are involved we should lean
on `StrictCompare`.
This change adjusts specialization and canonicalization rules to achieve
that: we prefer to emit `EqualityCompare` when specializing and then
add rule to collapse it back into `StrictCompare` if we discover that
is going to be more optimal (e.g. allows to avoid boxing).
TEST=vm/dart/aot_prefer_equality_comparison_il_test
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-android-release-arm64c-try
Change-Id: I953a346f22702debc61b84b745d2a9fab58a9ca5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324981
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This lets the sanitizers intercept any symbol. It's not worth trying to track which symbols the sanitizers are interested in. The sanitizer builds are not distributed so concerns about incompatibility, access to internals or size do not apply.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/53440
Change-Id: I59d137f4c15863cd27af857bfca4c53d847f2b90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324566
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
We were exporting all symbols to the dynamic table so that they could be looked up using `dladdr` for the profiler and backtracer. The symbols include our statically-linked libcxx, which can create trouble when another DSO has a different version of libcxx. Now we export only the VM embedding API functions (`Dart_*`) and use a specially produced table to do the symbolization.
TEST=runtime/tests/vm/dart/exported_symbols_test.dart
TEST=runtime/tests/vm/dart/symbolized_crash_test.dart
Bug: https://github.com/dart-lang/sdk/issues/53267
Change-Id: I2ee494fba86f67127ba0f6f402622f01a4662207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323702
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- Avoid Smi tagging for CID checks.
- Use one branch for CID range checks.
dart2js.aot.arm64 20744832 -> 20690216 (-54k)
TEST=ci
Change-Id: I0690bd98774ffc2f24758b1a303c605b57da65b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323231
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This behaves like applying @pragma("vm:keep-name") to the hiearchy.
TEST=ci
Bug: b/285175418
Change-Id: Ibd543d294bebbfbb60f4e5d62d5e83f3aec841e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322582
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- This causes inconsistency between AppJIT trained kernel service including eliminating barriers but the runtime compensation being disabled.
- The barrier elimination in the SuspendState stubs cannot be disabled.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52990
Change-Id: I4c5c7817a51f303d6f3bdbea8c15ad23a3e57735
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319906
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
TEST=ci
Change-Id: I4277a4f4f2c3bd9dedd9e325167b67130b5afc2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319260
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This test is flaky and timing out on hot reload bots.
Change-Id: If0c9574ac80405d14765e4ada4fdee8e6bce9d79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319001
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Allow updating weak handles etc to happen in parallel with work-stealing.
Also make LocalBlockWorklist more symmetric with BlockWorklist.
Cf. 4495c2b30a
TEST=ci
Change-Id: Id58fe16be92028b1aa4dd8f097769b4107f2a3f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316043
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Whether the reordered objects fail to fit depends non-deterministically on the parallel worker speeds and the exact contents of new-space that vary with each VM or core library change.
Bug: https://github.com/dart-lang/sdk/issues/52936
Change-Id: I6e287d42b5ca77d2ffafd9a5a053118617d6fe51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313940
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Retrieval of local names only works in JIT as it relies on availability of LocalVarDescriptors.
For example, for this
```
import 'dart:isolate';
foo() {
final x = RawReceivePort();
RawReceivePort().sendPort.send(() => print("$x"));
}
main() {
foo();
}
```
error message says
```
Unhandled exception:
Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)
<- field x in foo.<anonymous closure> (from file:///usr/local/google/home/aam/p/d/dart-sdk1/sdk/s1.dart)
```
Bug: https://github.com/dart-lang/sdk/issues/52957
TEST=ci
Change-Id: I684014fd19ea82829e7df17a8a67d386551a5a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314501
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
- Don't need to repeatedly verify function fingerprints for each isolate.
- Fix test detecting when it runs under debug mode or a simulator.
Change-Id: Iace0ebc274d4c01561a4b563a420e80535b1ff59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313243
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Makes the TSAN skips apply to
`test.py -mrelease --sanitizer=tsan`
and not just
`test.py -n vm-tsan-linux-release-x64`.
Also makes the timeouts agree.
Change-Id: I10315e754a4ebb3020f3c2f6cecfac6b77e77a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311828
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
The timeout multipiler for linux-arm64 was originally 4, then lowered to
1 (see [0]), then increased again to 2 (see [1]).
Though it seems that service tests are still flakily timing out, so
let's try restoring the original multilier.
[0] https://dart-review.googlesource.com/c/sdk/+/306662
[1] https://dart-review.googlesource.com/c/sdk/+/307972
Also special case `ia32` in timeout calculations due to not using
an AppJIT trained `kernel-isolate` snapshot and therefore being
very slow, especially in ia32-debug mode.
Issue https://github.com/dart-lang/sdk/issues/52589
TEST=ci
Change-Id: Iab8c768866aec9e77bb83c7a3242cc5de8fb4e2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312905
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
It's not supported, as it would prevent the value from being
garbage collected, defeating the purpose of Finalizer.
Not sure if an exception is worth it, so added the assert
as suggested in the bug tracker.
TEST=vm/dart{,_2}/finalizer/finalizer_attach_checks_token_test
Bug: #52731
Change-Id: Id7b457ca1a95e71c1a43d2d2c8569c35659952b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311020
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
The main contribution of this CL is unification of disparate
handling of various functions like `Future.timeout`,
`Future.wait`, `_SuspendState.createAsyncCallbacks` and
`_SuspendState._createAsyncStarCallback` into a single
`@pragma('vm:awaiter-link')` which allows Dart developers
to specify where awaiter unwinder should look for the next
awaiter.
For example this allows unwinding to succeed for the code like this:
Future<int> outer(Future<int> inner) {
@pragma('vm:awaiter-link')
final completer = Completer<int>();
inner.then((v) => completer.complete(v));
return completer.future;
}
This refactoring also ensures that we preserve information
(including Function & Code objects) required for awaiter
unwinding across all modes (JIT, AOT and AOT with DWARF stack
traces). This guarantees users will get the same information
no matter which mode they are running in. Previously
we have been disabling awaiter_stacks tests in some AOT
modes - which led to regressions in the quality of produced
stacks.
This CL also cleans up relationship between debugger and awaiter
stack returned by StackTrace.current - which makes stack trace
displayed by debugger (used for stepping out and determinining
whether exception is caught or not) and `StackTrace.current`
consistent.
Finally we make one user visible change to the stack trace:
awaiter stack will no always include intermediate listeners
created through `Future.then`. Previously we would sometimes
include these listeners at the tail of the stack trace,
which was inconsistent.
Ultimately this means that code like this:
Future<int> inner() async {
await null; // asynchronous gap
print(StackTrace.current); // (*)
return 0;
}
Future<int> outer() async {
int process(int v) {
return v + 1;
}
return await inner().then(process);
}
void main() async {
await outer();
}
Produces stack trace like this:
inner
<asynchronous suspension>
outer.process
<asynchronous suspension>
outer
<asynchronous suspension>
main
<asynchronous suspension>
And when stepping out of `inner` execution will stop at `outer.process`
first and the next step out will bring execution to `outer` next.
Fixes https://github.com/dart-lang/sdk/issues/52797
Fixes https://github.com/dart-lang/sdk/issues/52203
Issue https://github.com/dart-lang/sdk/issues/47985
TEST=ci
Bug: b/279929839
CoreLibraryReviewExempt: CL just adds @pragma to facilitate unwinding
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try
Change-Id: If377d5329d6a11c86effb9369dc603a7ae616fe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311680
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
The makes it possible to run just these tests with `test.py vm/gc/`.
Change-Id: Ied4aa0b2fb045c19b1aced68f58a1ef195a5df8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311145
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Previously, inliner was able to inline closure calls only when closure
was allocated in the current function (or in a function which was
inlined so far). This is not true for local functions declared in outer
functions (they are allocated at declaration site).
Now, when calling local functions, target of closure call is always
known regardless of where the function is declared, so calls to local
functions can be inlined.
TEST=runtime/tests/vm/dart/inline_local_functions_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52695
Fixes https://github.com/dart-lang/sdk/issues/15558
Change-Id: I0e51dbaf63a6d4427bff366b40414ca5fac3d418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311465
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>