The ICData::AssertInvariantsAreSatisfied() method will grab a snapshot
of the ICData's entrie()s backing store array and does verifications
on it.
Though the place when we check for the last entry (which is a back-ref)
we re-load the entries() array which could be updated at this point.
This causes us to possibly fail an assertion which checks that for empty
ic data arrays it should be a cached empty array.
Closes https://github.com/dart-lang/sdk/issues/48787
TEST=Should fix flaky assertion hit.
Change-Id: I45cf57bd13a7c2e49c395eb25a2f6789c5140bf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242109
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This change will append the name of the associated function
to the name of FFI trampolines.
Previously the name of all FFI trampolines was "FfiTrampoline",
which made them difficult to keep track of when there was
more than one trampoline (i.e. more than one FFI function).
TEST=Existing
Change-Id: I7b5efa25dc9064d5615309331e2cfeaa01e4c9f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242100
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Dead since cf1de7d46c.
TEST=ci
Change-Id: I6dd42a62a8bfc8ff71bae8f1e33930c1bacfe103
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242040
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This change includes kernel-related changes:
* --compact-async option is added to kernel compilers (front-end
server and gen_kernel). This option disables desugaring of async
and await on kernel AST. Note that 'await for' is still desugared.
* File offset of the 'await' is now written for AwaitExpression nodes
in the kernel binaries (will be used for async stack traces).
* Async/async*/sync* functions and AwaitExpression nodes are supported
in TFA.
Design doc: go/compact-async-await.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I4233086b7434bc48347f4220645b0be5f9133456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241842
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Labels starting with L are treated as local by the assembler
and cause problems down the line. When targeting ARM64 Mach-O
having local labels cause linker to break when trying to
generate compact unwinding information with a cryptic error
ld: too many compact unwind infos in function <...>
This happens because local labels are not seen as function
boundaries and multiple .cfi_startproc/.cfi_endproc are
mashed into a single function.
Fixes https://github.com/flutter/flutter/issues/102281
TEST=runtime/tests/vm/dart{,_2}/no_local_labels_test.dart
Change-Id: I0171dc08f49c71ccb1ca02b398e01ac241efd9a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241962
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
If the popular store buffer targets are copied instead of promoted, the store buffer won't shrink and a second scavenge will occur that does promote them.
TEST=ci
Change-Id: I09fd7f263a2a9e99179af7ee58bc93335c4f5d05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241203
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This CL adds an assert to check we're not writing beyond the allocated
stack space. This assert triggers at compile-time, rather than at
runtime, and it catches cases which would sometimes go correct at
runtime because the stack is also 16-byte aligned.
This only occurred on MacOS/iOS Arm64 because structs are word-aligned
on the stack in the other ABIs.
The fix in this CL is to always add 4 bytes extra in this ABI.
The alternative fix would be to stop copying word-size chunks and use
smaller moves. However, this would require a major re-engineering of
the marshaller because it breaks structs up in word-size definitions
currently.
TEST=tests/ffi/function_structs_by_value_generated_test.dart
(would trigger the assert without the fix on MacOS arm64)
Fixed: https://github.com/dart-lang/sdk/issues/48806
Change-Id: Ia590be76919a192fed144520ee28b1abaf3aa485
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,dart-sdk-mac-arm64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241607
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Forked process should use _exit() rather than exit()
when exiting without exec-ing otherwise it risks
to hit an issue (e.g. deadlock) in an atexit handler.
Additionally `man fork` states:
> After a fork() in a multithreaded program, the child can
> safely call only async-signal-safe functions (see
> signal-safety(7)) until such time as it calls execve(2).
_exit is on the list of async-signal-safe functions, but
exit is not.
Fixes b/216834909
TEST=runtime/tests/vm/dart{,_2}/regress_b_216834909_test.dart
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-android-release-arm64c-try,vm-kernel-mac-release-x64-try
Change-Id: Ia67f23825fc0ee1c1918faf2d4ef3b81033263eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241608
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Even if the main program disables executable stacks, dlopen'ing a library that doesn't itself disable executable stack will switch the stack to executable. (Presumably in the name of compatability with GNU nested functions.)
Dart does not need executable stacks, and executable stacks are an additional attack surface.
TEST=readelf
Bug: b/229648756
Change-Id: Ia8c234ebc6178a26528d37b1359a10dd42039a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241540
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Adjust TimelineEvent::PrintJSON to use JSONWriter for compatibility with PRODUCT mode.
TEST=ci
Change-Id: I694889c655719371364012b4324b7947d7b2d5e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240911
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
LLVM seems to prefer generating __unwind_info instead of __eh_frame
on certain targets. Unfortunately the way we use CFI directives
in assembly snapshots results in incomplete __unwind_info:
only the first function in the instruction snapshot gets unwinding
information recorded properly.
To fix this we change assembly writer to emit CFI directives
inside each individual function.
TEST=manually via `objdump -u`
Fixes https://github.com/flutter/flutter/issues/101708
Change-Id: I027bfe6483dcd7f7e39ab23154abfe12ebc478da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241282
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This reverts commit 398ef5d693.
Reason for revert: Failures on Android and Fuchsia product builds
Original change's description:
> [vm] Add a timeline recorder that streams to a file.
>
> TEST=ci
> Change-Id: If527a7c7f5dfa11fe6572452e382779b76b16638
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241100
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
TBR=bkonyi@google.com,rmacnak@google.com
Change-Id: Iccbcc9084a6a4a7e530f3f53c0b6c0fd424a8cdd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240910
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit de6ed2e9a3.
Reason for revert: More accurate Scavenge::UsedInWords has unexpected effects on growth policy
Original change's description:
> [vm] Tweak --verbose_gc.
>
> - Make flag available in product mode.
> - Stop including times for subphases. Better information is available in the timeline.
> - Include the size of the store buffer.
> - Include used delta.
>
> TEST=--verbose_gc
> Change-Id: I0aa71ffab5b08611e8cef118c1a77ecba61f3482
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241101
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I090224ed2c4ecdc2fb3b5bdfe90d5a2ad9f69f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241212
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This hopefully makes things less surprising to folks seeing this runtime entry when looking a profile because most programs don't have real stack overflows.
TEST=ci
Change-Id: I6ef610177ad745f5be7a44854e72ebda183f33da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235040
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- Make flag available in product mode.
- Stop including times for subphases. Better information is available in the timeline.
- Include the size of the store buffer.
- Include used delta.
TEST=--verbose_gc
Change-Id: I0aa71ffab5b08611e8cef118c1a77ecba61f3482
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241101
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Currently running official dart `linux/arm/v7` container image on x86_64 with QEMU results in `Unrecognized ARM CPU architecture`.
This is due to QEMU reporting host `/proc/cpuinfo` instead of the emulated architecture.
Checking `uname` in addition to `/proc/cpuinfo` would make `linux/arm/v7` build work consistently regardless of whether `--use-qemu` is supplied during SDK build time.
TEST=running the qemu bot
TEST=ran the ffi/hardfp_test.dart locally both in AOT and JIT mode.
Closes https://github.com/dart-lang/sdk/pull/48665https://github.com/dart-lang/sdk/pull/48665
GitOrigin-RevId: d1414d747152d048f3ecaadfd0cd3356ce7a2205
Change-Id: If8b42a700d55e83fea0ee0035848308a3211ec43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238841
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Finalizer is not guaranteed to run if it becomes unreachable.
The test vm/dart/finalizer/finalizer_zone_run_gc_test incorrectly
assumed that Finalizer stored in a local variable is still reachable
after the last use of variable, but that is not guaranteed.
(Previously, async functions captured local variables into the
context and objects stored in local variables in async functions were
reachable even after variables become unused.
With the new async/await implementation, local variables in async
functions are handled in the same way as in ordinary functions and
not stored into the context, so this test started failing as
Finalizer was garbage collected and not executed.)
TEST=vm/dart/finalizer/finalizer_zone_run_gc_test
Change-Id: Id025556c68c5fc1cf08b06d44cb9d5bbd21dd916
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239860
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
4 instances of the following issue: redundant get() call on smart pointer
Tested: Only through CI. There are no changes in behavior, all possible problems would be found through a compilation failure.
Change-Id: Ib11432baef83d3daebd800b365183e1ea6621136
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240540
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
The test throws 1 million exceptions which can, especially in debug mode
can take very long.
This addresses flaky timeouts of this test in debug mode.
TEST=ci
Change-Id: Ibfa9108d49303d62aa4267c07e03499d0a831292
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240700
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Tested: Default CQ run; Dart VM changes were generated.
Change-Id: If0ea7b9fd2bb0de8459c9d4b39b9cc91cec73e23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240542
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This reverts commit 837ee17b43.
Reason for revert: Please see https://github.com/flutter/flutter/issues/101514
Original change's description:
> [vm] Fix some async* semantics issues: Only run generator if there's active subscription (not paused/cancelled)
>
> This fixes an issue where VM would run the async* generator after a
> `yield` / `yield*` even though the subscription may be paused or
> cancelled.
>
> Furthermore this fixes an issue where `StackTrace.current` used
> in async* generator crashes VM and/or produces truncated stack
> trace.
>
> This fixes the following existing tests that were failing before:
>
> * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
> * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
> * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
> * language/async_star/async_star_cancel_test
> * language/async_star/pause_test
>
> Issue https://github.com/flutter/flutter/issues/100441
> Issue https://github.com/dart-lang/sdk/issues/48695
> Issue https://github.com/dart-lang/sdk/issues/34775
>
> TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test
>
> Change-Id: I73f7d0b70937a3e3766b992740fa6fe6e6d57cec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239421
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Ic3d9c0508310a33a2aaee67860c0bb2ec83bab4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240506
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
EmitNativeMove is also used during NativeParamterInstr, not just FfiCallInstr, so the trick with WithIntermediateMarshalling doesn't work. Instead, move arguments to their final register in the prologue of FfiCallInstr and remove conflicting uses within FfiCallInstr.
TEST=ffi_2/function_callbacks_test
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: I652ab714dbfcb092dc5a23e4596f77136d91ffde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240324
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Clears up confusion around function/field owner locations not
necessarily representing where the function/field was actually declared
(e.g., for functions and fields brought into a class via a mixin
application).
Fixes https://github.com/dart-lang/sdk/issues/45093
TEST=Documentation change
Change-Id: Ideaf17ec99d005459c60a2dd88f72b3485b32664
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240481
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
The computation of default values on super parameters requires the
notion of a declared initializer. By adding this as a flag to
VariableDeclarations the implementation can now be normalized across
parameter from source and dill.
TEST=existing
Change-Id: Ic980e68b569e3bdab38d2c7c7e4374e0c931a87b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240403
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
1. Run native finalizers before sending isolate exit message. This way
users can rely on the isolate exit message for both (1) no Dart code
executing anymore on that isolate _and_ (2) all native finalizers
having run. Alternatively, we could opt to not provide this second
guarantee and document this.
2. Fix UBSAN error by making SetArgumentTo42's argument a `void*`.
3. Fix bug in debug mode, stop reading tags from forwarding addresses.
4. Small optimization: Don't promote 0 bytes from new to old space.
5. Skip finalizer_isolate_groups_run_gc_test in optcounter mode.
In hot reload mode, GC is guaranteed to run. On all other bots GC
does not run (nothing happens in the other isolate group). However,
in optcounter mode enough happens in the other isolate group to
trigger GCs. Alternatively, we could loosen the test to allow either
a GC to happen or not.
TEST=runtime/tests/vm/dart(_2)/finalizer/*
TEST=runtime/tests/vm/dart(_2)/isolates/fast_object_copy_test.dart
TEST=runtime/vm/object_test.cc
TEST=tests/ffi(_2)/vmspecific_native_finalizer_*
Closes: https://github.com/dart-lang/sdk/issues/48740
Closes: https://github.com/dart-lang/sdk/issues/48715
Closes: https://github.com/dart-lang/sdk/issues/48674
Change-Id: I5e260e087aef48524f2214f5b332caeda18f2e37
Cq-Include-Trybots: luci.dart.try:vm-kernel-ubsan-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try,vm-canary-linux-debug-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-optcounter-threshold-linux-release-ia32-try,app-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240043
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This fixes an issue where VM would run the async* generator after a
`yield` / `yield*` even though the subscription may be paused or
cancelled.
Furthermore this fixes an issue where `StackTrace.current` used
in async* generator crashes VM and/or produces truncated stack
trace.
This fixes the following existing tests that were failing before:
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
* language/async_star/async_star_cancel_test
* language/async_star/pause_test
Issue https://github.com/flutter/flutter/issues/100441
Issue https://github.com/dart-lang/sdk/issues/48695
Issue https://github.com/dart-lang/sdk/issues/34775
TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test
Change-Id: I73f7d0b70937a3e3766b992740fa6fe6e6d57cec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239421
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This CL refactors some ICData code to no longer do O(n) operations.
Instead we maintain strong invariant that ICData's backing store is
always Copy-on-Write modified and sentinenl is always at the end.
This fixes an issue for this code:
intptr_t ICData::NumberOfChecks() const {
const intptr_t length = Length();
for (intptr_t i = 0; i < length; i++) {
if (IsSentinelAt(i)) {
return i;
}
}
UNREACHABLE();
return -1;
}
Where the `Length()` was cached and another thread could update backing
store.
Issue https://github.com/dart-lang/sdk/issues/46679
TEST=Should fix iso-stress issue.
Change-Id: I25f7d96258c108214032cf485246d3710f820b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240044
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This test of safepoint operations has some probability of failing due to
dependence on timing of events.
This CL will lower probability of test failure by ensuring the helper
threads will try hard to join in normal way (and fail to do so if
expected) before unblocking main thread to continue.
Issue https://github.com/dart-lang/sdk/issues/48716
TEST=ci
Change-Id: Ibd9b8573248bd2efc0c45525affa640adb7517a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239665
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
AMOs are more efficient than a LR/SC pair.
TEST=ci
Change-Id: I74915669bf4d13b92c04ed6ef21d61dd58df36ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240142
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit dbe6d1d574.
Reason for revert: One of the new tests spawns a process and runs the script from source and so this test will fail on all AOT configurations, In addition it is failing on mac builds and needs investigation.
Original change's description:
> [VM/io] - Set correct file type for files backing unix domain sockets
>
> The file type of file backing unix domain sockets was being incorrectly
> set as kDoesNotExist resulting in errors when operations like delete
> on the file was done. File::Exists on the other hand returned true.
> File rename and copyfile functionality have been fixed too.
>
> TEST=new tests added
>
> Please see https://github.com/dart-lang/sdk/issues/48569 for the original issue.
> Change-Id: Ie9c716c84b1d818c906ecdb622ba930125f9ee30
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237745
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
TBR=rmacnak@google.com,asiva@google.com
Change-Id: I517896fb90b013af1ce9a6754442a922e2b7cda5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240149
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
The file type of file backing unix domain sockets was being incorrectly
set as kDoesNotExist resulting in errors when operations like delete
on the file was done. File::Exists on the other hand returned true.
File rename and copyfile functionality have been fixed too.
TEST=new tests added
Please see https://github.com/dart-lang/sdk/issues/48569 for the original issue.
Change-Id: Ie9c716c84b1d818c906ecdb622ba930125f9ee30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237745
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
OSError code of 0
One such example was _SecurityContext.setTrustedCertificatesBytes
TEST=new tests added
Change-Id: Ibc5d06b83bb1bb93e12f79100acc60546554c268
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239863
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This reverts commit dc8002cc42.
Reason for revert: crashes internally (b/227727791) and externally (dartbug.com/48721)
Original change's description:
> [VM / IO] - Reland : Assert when an OSError exception is reported with no error
>
> 1. Add a Fatal assert when an OSError is reported with no error code (0).
> This is to ensure we get a coredum pwhen this happens so we can analyze
> it. (Please see https://github.com/flutter/flutter/issues/90921 for more
> details)
>
> TEST=ci
>
> Change-Id: I7146ac69ef8b1833f28bed8a23f0c27a2ece4bbf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239726
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
TBR=aam@google.com,asiva@google.com
Change-Id: Ic9302e7922b0ce2ea5ab81357804c3cd822a8052
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239664
Reviewed-by: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
1. Add a Fatal assert when an OSError is reported with no error code (0).
This is to ensure we get a coredum pwhen this happens so we can analyze
it. (Please see https://github.com/flutter/flutter/issues/90921 for more
details)
TEST=ci
Change-Id: I7146ac69ef8b1833f28bed8a23f0c27a2ece4bbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239726
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
PP is a volatile register on RISC-V to take advantage of compressed instructions, and a preserved register on the other architectures.
TEST=ffi_2/function_structs_test
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: I947d6fd8171b8c0c7aa8eb524537038655177e27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238720
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit 9038f5e1f7.
Reason for revert: broke g3 bot blocking dart->engine roll
Original change's description:
> [VM / IO] - Assert when an OSError exception is reported with no error
>
> Add a Fatal assert when an OSError is reported with no error code (0).
> This is to ensure we get a coredum pwhen this happens so we can analyze
> it. (Please see https://github.com/flutter/flutter/issues/90921 for more
> details)
>
> TEST=ci
>
> Change-Id: I7f4609c2431e6ddc4eacc753356c807d7338b0a9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239541
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
TBR=rmacnak@google.com,asiva@google.com
Change-Id: I87df53a7d81802ad1a88f54a90a49f88db44108b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239602
Reviewed-by: Alexander Aprelev <aam@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Add a Fatal assert when an OSError is reported with no error code (0).
This is to ensure we get a coredum pwhen this happens so we can analyze
it. (Please see https://github.com/flutter/flutter/issues/90921 for more
details)
TEST=ci
Change-Id: I7f4609c2431e6ddc4eacc753356c807d7338b0a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239541
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Adds an additional `contains_call` mode specifying that the
register allocator should block all non-callee-save ABI registers.
As opposed to `kCall`, this frees the use of callee-save registers
across FfiCallInstr, meaning that live values do not always have
to be spilled.
For architectures with sufficient free callee-save registers
this should result in less overhead for each FfiCall.
This change also removes RequiresStackSlot as it was only being
used for FfiCall's TypedData, and wasn't implemented in the
Register Allocator.
Since FfiCall no longer blocks all registers TypedData can now
live in a register, so the previous assumptions about it always
being on stack have to be relaxed.
This change also works around an issue where the register allocator
might allocate an FPU register that does not have an associated S
register. This causes problems when FFI tries to pass 32 bit floats
in said register.
As a work around we block all FPU regs. above the 8 that have S regs.
for FFI calls in VFPv3-D32 mode.
This change also adds an additional temp registers which was previous
used but not being reserved in FfiCall IL on Arm64.
Some additional prereq. fixes were branched out into:
https://dart-review.googlesource.com/c/sdk/+/237690
TEST=Adds IRTest_FfiCallInstrLeafDoesntSpill.
Bug: https://github.com/dart-lang/sdk/issues/45468
Change-Id: Icdeccb0de77e46f5bc34dd5bd4e308d27bc1ef99
Cq-Do-Not-Cancel-Tryjobs: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-win-release-x64-try, vm-precomp-ffi-qemu-linux-release-arm-try, vm-kernel-mac-release-arm64-try, vm-kernel-nnbd-mac-debug-arm64-try, vm-kernel-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221624
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Now GenerateCidRangesCheck in the flow graph compiler returns
whether the class id register was clobbered, so users that
make multiple calls to it for the same cid know whether the cid
needs reloading after the generated check.
Also unifies FlowGraphCompiler::EmitTestAndCheckCid across
architectures, since the non-Intel versions would have
always forced reloading.
TEST=vm/cc/TTS
Change-Id: I08835dc97ba457b7dc8dfa51206b4741a607db22
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-linux-debug-simriscv64-try,vm-kernel-precomp-linux-debug-simriscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238583
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
When generating a type testing stub (TTS) for implemented classes,
multiple cid range check blocks may be generated, each of which
requires reloading the cid. This CL makes it so that only a single
Smi check will be generated the first time the cid is loaded, so
later checks can just load the cid directly without the Smi case.
TEST=vm/cc/TTS
Change-Id: I4d76ee34a03cf4a0def268e9f74a096e3c0deb58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238702
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Check the right register set when deciding if there is a leftover pop single. This worked by accident on non-Fuchsia ARM64 because there is an even number for both CPU and FPU registers, but Fuchsia has a different number of preserved CPU registers due to the shadow call stack.
TEST=no Fuchsia ARM64 bots; inspect disassembly of the entry stub
Bug: b/226647006
Change-Id: Ie0c7fa4a3b713d5b9fb21e9e778d620c7728bc39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239160
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Since we're adding the classes in a known order, we can calculate
how many unrelated classes are needed to align the cids from
the next cid to be allocated.
TEST=TTS_Regress_CidRangeChecks
Fixes https://github.com/dart-lang/sdk/issues/48673
Change-Id: I04b750c64cf739bc6ba0bda2a93373a6443cedaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239025
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
The diff from
https://dart-review.googlesource.com/c/sdk/+/229156/1..3
This was blocked by https://github.com/timsneath/win32/issues/349
earlier. Now that that has been resolved, we should be able to land
this.
We should land this to make package:ffigen be able to bind to `char` in
Dart 2.17.
https://github.com/dart-lang/ffigen/pull/287#discussion_r835734993
TEST=tests/ffi/c_types_test.dart
Change-Id: Ia3bc3785a3d5c0c9f7475106eb77f944f2d0a838
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239020
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Fixed in: https://dart-review.googlesource.com/c/sdk/+/237690
Adds MoveByteRunTest, testing that we emit the correct assembly
for movb so that we are able to run it.
This includes a fix for the issue the cause this same change to
previously get reverted:
https://github.com/dart-lang/sdk/issues/48661
Namely, the test now saves RDI since it is non-volatile on Windows.
TEST=Adds cc/vm/MoveByteRunTest
Cq-Include-Trybots: luci.dart.try:dart-sdk-win-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-win-debug-x64-try
Change-Id: I97cad1367a5d33cfca36a880260e1771052af003
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238701
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
This CL implements `NativeFinalizer` in the GC.
`FinalizerEntry`s are extended to track `external_size` and in which
`Heap::Space` the finalizable value is.
On attaching a native finalizer, the external size is added to the
relevant heap. When the finalizable value is promoted from new to old
space, the external size is promoted as well. And when a native
finalizer is run or is detached, the external size is removed from the
relevant heap again.
In contrast to Dart `Finalizer`s, `NativeFinalizer`s are run on isolate
shutdown.
When the `NativeFinalizer`s themselves are collected, the finalizers are
not run. Users should stick the native finalizer in a global variable to
ensure finalization. We will revisit this design when we add send and
exit support, because there is a design space to explore what to do in
that case. This current solution promises the least to users.
In this implementation native finalizers have a Dart entry to clean up
the entries from the `all_entries` field of the finalizer. We should
consider using another data structure that avoids the need for this Dart
entry. See the TODO left in the code.
Bug: https://github.com/dart-lang/sdk/issues/47777
TEST=runtime/tests/vm/dart(_2)/isolates/fast_object_copy_test.dart
TEST=runtime/vm/object_test.cc
TEST=tests/ffi(_2)/vmspecific_native_finalizer_*
Change-Id: I8f594c80c3c344ad83e1f2de10de028eb8456121
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64c-try,dart-sdk-mac-arm64-try,vm-kernel-mac-release-arm64-try,pkg-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-nnbd-win-release-ia32-try,vm-ffi-android-debug-arm-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,benchmark-linux-try,flutter-frontend-try,pkg-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Have manually tested that the test crashes if the fix in that commit
is reverted.
TEST=TTS_Regress_CidRangeChecks
Change-Id: Id53892e4bdefbf52fba630bf6cb73743128ad5f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238704
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Original CL in patchset 1.
Split-off https://dart-review.googlesource.com/c/sdk/+/238341
And pulled in fix https://dart-review.googlesource.com/c/sdk/+/238582
(Should merge cleanly when this lands later.)
This CL implements the `Finalizer` in the GC.
The GC is specially aware of two types of objects for the purposes of
running finalizers.
1) `FinalizerEntry`
2) `Finalizer` (`FinalizerBase`, `_FinalizerImpl`)
A `FinalizerEntry` contains the `value`, the optional `detach` key, and
the `token`, and a reference to the `finalizer`.
An entry only holds on weakly to the value, detach key, and finalizer.
(Similar to how `WeakReference` only holds on weakly to target).
A `Finalizer` contains all entries, a list of entries of which the value
is collected, and a reference to the isolate.
When a the value of an entry is GCed, the enry is added over to the
collected list.
If any entry is moved to the collected list, a message is sent that
invokes the finalizer to call the callback on all entries in that list.
When a finalizer is detached by the user, the entry token is set to the
entry itself and is removed from the all entries set.
This ensures that if the entry was already moved to the collected list,
the finalizer is not executed.
To speed up detaching, we use a weak map from detach keys to list of
entries. This ensures entries can be GCed.
Both the scavenger and marker tasks process finalizer entries in
parallel.
Parallel tasks use an atomic exchange on the head of the collected
entries list, ensuring no entries get lost.
The mutator thread is guaranteed to be stopped when processing entries.
This ensures that we do not need barriers for moving entries into the
finalizers collected list.
Dart reads and replaces the collected entries list also with an atomic
exchange, ensuring the GC doesn't run in between a load/store.
When a finalizer gets posted a message to process finalized objects, it
is being kept alive by the message.
An alternative design would be to pre-allocate a `WeakReference` in the
finalizer pointing to the finalizer, and send that itself.
This would be at the cost of an extra object.
Send and exit is not supported in this CL, support will be added in a
follow up CL. Trying to send will throw.
Bug: https://github.com/dart-lang/sdk/issues/47777
TEST=runtime/tests/vm/dart/finalizer/*
TEST=runtime/tests/vm/dart_2/isolates/fast_object_copy_test.dart
TEST=runtime/vm/object_test.cc
Change-Id: Ibdfeadc16d5d69ade50aae5b9f794284c4c4dbab
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64c-try,dart-sdk-mac-arm64-try,vm-kernel-mac-release-arm64-try,pkg-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-nnbd-win-release-ia32-try,vm-ffi-android-debug-arm-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,benchmark-linux-try,flutter-analyze-try,flutter-frontend-try,pkg-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238086
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
We must load the class id from the instance prior to _each_
subtype range check, as GenerateCidRangesCheck can clobber that
register during the check.
TEST=Manually tested by @dcharkes using repro from CL 238480.
Will add regression test on separate CL.
Change-Id: I1de6f4fdd9011f241d785082b4b4866d8b24fcfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238582
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This reverts commit d0c65801c0.
Reason for revert: https://github.com/dart-lang/sdk/issues/48661
TEST=N/A, revert
Original change's description:
> [vm/test] Adds regression test for movb on x64.
>
> Fixed in: https://dart-review.googlesource.com/c/sdk/+/237690
>
> Adds MoveByteRunTest, testing that we emit the correct assembly
> for movb so that we are able to run it.
>
> TEST=Adds cc/vm/MoveByteRunTest
> Change-Id: I97a854119c5abbca79f3fb55e208a3169b64b9d9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238040
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>
TBR=kustermann@google.com,cskau@google.com
Change-Id: Ifd5962b256b530bebf7684ec63d9f6201e1eb91c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238664
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
- Fix bad frame walk from assuming kSavedCallerFpSlotFromFp is 0.
- Fix sign of WChar.
- Fix missing sign-extension in some cases of passing uint32.
TEST=qemu
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: Idc1699d473a115153b4b4e6fdc9f84519055de00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238386
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
In 67f93d3840, the simulator was extended to simulate signal handlers clobbering below CSP, but Simulator::JumpToFrame didn't kick CSP back near the stack limit.
TEST=fuzzer (anything with exceptions in debug simarm64)
Change-Id: I233388c9a73181521d6760e7a2f9c9dfe57e33ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238463
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
TEST=comment only change
Change-Id: I4e943046b67ed9708bc95bf72890c65ea49167c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238602
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Fixed in: https://dart-review.googlesource.com/c/sdk/+/237690
Adds MoveByteRunTest, testing that we emit the correct assembly
for movb so that we are able to run it.
TEST=Adds cc/vm/MoveByteRunTest
Change-Id: I97a854119c5abbca79f3fb55e208a3169b64b9d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Instead of simply concatenating the dartaotruntime executable and the
ELF snapshot, we instead insert the ELF snapshot as a COFF section,
so the resulting PE file can be signed.
TEST=pkg/dartdev/test/commands/compile_test
Bug: https://github.com/dart-lang/sdk/issues/39106
Change-Id: Iaafb5833fcb9c69c0dd374b64769f22b8b9f53a2
Cq-Include-Trybots: luci.dart.try:pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236100
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This refactors the delayed lists in the marker and scavenger, but does
not have any behavior changes.
Split off https://dart-review.googlesource.com/c/sdk/+/238086
TEST=running test suites will trigger GC.
Change-Id: I82ca4c3dca3351b6543bafaee1318b8e0da75f1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238341
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Building an empty CPU profile is still costly as function tables are
populated whether or not there's samples in the profile. This change
checks to see if any sample in the list of SampleBlocks was collected
under a UserTag with streaming enabled before building the profile.
TEST=CQ, manual testing
Change-Id: Ib526f9999a8b2bf48a7df1488c7dcf959031cf5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238183
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
We were generating unwinding information using host word size
instead of target word size.
TEST=manually
Bug: b/220804295
Change-Id: I5adacf2b7ecdf8af90ed6e7b25ae76e12b76124f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238085
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
- Fixes SIMD registers clobbered by write barrier on ARM64.
- Moves code generation out of non-compiler directory.
- Removes unnecessary building of Dart frames on leaf runtime calls.
- Removes unnecessary Threads slots for write barrier Code objects.
- Removes duplicate saves of SP in leaf runtime calls on ARM64 and RISC-V.
- Avoids some redundant SP updates on RISC-V.
TEST=ci
Change-Id: Idb92127658edc90b320923ef3d882a7219a450ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236842
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- refactor designated initializers as they are c++20
- unwrap #if/#endif in macro arguments
- remove taking pointer on purely intrinsic function (setjmp_)
- use DART_WARN_UNUSED_RESULT which is msvc/clang friendly
- provide StringRAII copying constructor
Bug: https://github.com/dart-lang/sdk/issues/48544
TEST=ci,msvc build
Change-Id: I1049589c96dc0cdf49e1d31d320b6804bf6e4558
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237929
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This reverts commit 7dca34c235.
Reason for revert: b/226085355 dart_vm_test crashing. Unclear what
the cause is. Reverting so we can triage the issue.
TEST=This is a revert.
Original change's description:
> [vm] Implement `Finalizer`
>
> This CL implements the `Finalizer` in the GC.
>
> (This CL does not yet implement `NativeFinalizer`.)
>
> The GC is specially aware of two types of objects for the purposes of
> running finalizers.
>
> 1) `FinalizerEntry`
> 2) `Finalizer` (`FinalizerBase`, `_FinalizerImpl`)
>
> A `FinalizerEntry` contains the `value`, the optional `detach` key, and
> the `token`, and a reference to the `finalizer`.
> An entry only holds on weakly to the value, detach key, and finalizer.
> (Similar to how `WeakReference` only holds on weakly to target).
>
> A `Finalizer` contains all entries, a list of entries of which the value
> is collected, and a reference to the isolate.
>
> When a the value of an entry is GCed, the enry is added over to the
> collected list.
> If any entry is moved to the collected list, a message is sent that
> invokes the finalizer to call the callback on all entries in that list.
>
> When a finalizer is detached by the user, the entry token is set to the
> entry itself and is removed from the all entries set.
> This ensures that if the entry was already moved to the collected list,
> the finalizer is not executed.
>
> To speed up detaching, we use a weak map from detach keys to list of
> entries. This ensures entries can be GCed.
>
> Both the scavenger and marker tasks process finalizer entries in
> parallel.
> Parallel tasks use an atomic exchange on the head of the collected
> entries list, ensuring no entries get lost.
> The mutator thread is guaranteed to be stopped when processing entries.
> This ensures that we do not need barriers for moving entries into the
> finalizers collected list.
> Dart reads and replaces the collected entries list also with an atomic
> exchange, ensuring the GC doesn't run in between a load/store.
>
> When a finalizer gets posted a message to process finalized objects, it
> is being kept alive by the message.
> An alternative design would be to pre-allocate a `WeakReference` in the
> finalizer pointing to the finalizer, and send that itself.
> This would be at the cost of an extra object.
>
> Send and exit is not supported in this CL, support will be added in a
> follow up CL. Trying to send will throw.
>
> Bug: https://github.com/dart-lang/sdk/issues/47777
>
> TEST=runtime/tests/vm/dart/finalizer/*
> TEST=runtime/tests/vm/dart_2/isolates/fast_object_copy_test.dart
> TEST=runtime/vm/object_test.cc
>
> Change-Id: I03e6b4a46212316254bf46ba3f2df333abaa686c
> Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64c-try,dart-sdk-mac-arm64-try,vm-kernel-mac-release-arm64-try,pkg-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-nnbd-win-release-ia32-try,vm-ffi-android-debug-arm-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,benchmark-linux-try,flutter-analyze-try,flutter-frontend-try,pkg-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229544
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
TBR=lrn@google.com,vegorov@google.com,kustermann@google.com,rmacnak@google.com,dacoharkes@google.com
Change-Id: I991f6e49896d18a8d70210cf315d858b462d66c9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/47777
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64c-try,dart-sdk-mac-arm64-try,vm-kernel-mac-release-arm64-try,pkg-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-nnbd-win-release-ia32-try,vm-ffi-android-debug-arm-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,benchmark-linux-try,flutter-analyze-try,flutter-frontend-try,pkg-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238080
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>