Commit Graph

3777 Commits

Author SHA1 Message Date
Ryan Macnak 0e9676ea1f [vm, compiler] Some shorter load immediate sequences for RISC-V.
TEST=ci
Change-Id: I34e72727b5560da88916f996f92b33ddc1ff6dff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468980
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-01-05 16:31:30 -08:00
Alexander Aprelev a949c74530 [vm/shared] Ensure stores into shared static variables are checked.
Closures going into shared variables in particular have to be confirmed to capture appropriate values.

BUG=https://github.com/dart-lang/sdk/issues/62179
TEST=run_isolate_group_run_test

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-aot-dyn-linux-debug-x64-try
Change-Id: I27416773fd77077018739ea4dbcc6e4695e67be8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469103
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-12-22 07:53:44 -08:00
Ryan Macnak 674a42d292 [vm, compiler] Check for ASAN and MSAN violations from Dart generated code.
Inform ASAN and MSAN about reads and writes through FFI pointers or external typed data. Previously we only informed MSAN about writes, which was enough to prevent false positives in foreign code, but gave false negatives for Dart code. This mostly uses the same machinery used for TSAN, and replaces some of the existing MSAN unpoison calls.

Also fixes some marshalling of compounds by value that generate loads extending past the end of the compound.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/62221
Change-Id: Ia3573edb5a0aec32b6a57035a63e8f323a655ecc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467401
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-17 07:37:29 -08:00
Alexander Markov ecf78ee1ae [vm/corelib] Cleanup obsolete null checks from the VM patch files
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/40614
Change-Id: I019f4e1fb54adaa585c234a6e806ac50213c6d80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468640
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-12-16 15:07:39 -08:00
Alexander Aprelev 011f0259f9 [vm/shared] Ensure that shared fields initialization is mutex-guarded even without experimental flag.
Shared fields have to be properly initialized even when experiment is not enabled.

TEST=shared_finalthreadlocal_init_test on a loop
BUG=https://github.com/dart-lang/sdk/issues/62238

Change-Id: Ib8d32bd2553cdcbefeea657e4dd2b75db18d31d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467921
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-12-15 08:22:10 -08:00
Alexander Markov 3c99ae9b68 [vm] Fix incorrect assumption about co-location of leaf and non-leaf runtime entries in Thread
Thread::OffsetFromThread from runtime_api.cc assumed that all fields
between leaf and non-leaf runtime entries in Thread have word size,
so the delta between runtime entries can be translated from host to
target by multiplying by the ratio between target and host word size.

Since leaf and non-leaf runtime entries are not co-located in Thread,
this assumption is incorrect. It is now fixed by using separate
bases when calculating offsets of leaf and non-leaf runtime entries.

Also, add FatalError runtime entry which is useful for
bootstrapping of the new compiler.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Iea4762b21285aa6423876b34328c863227ee1434
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467900
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-12-15 08:00:53 -08:00
Alexander Markov 07c7c4ea50 [vm] Generate Dart declarations for runtime offsets
TEST=dart tools/run_offsets_extractor.dart
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ic24111aa923214cfc332a8fb4677d8941a2999d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446700
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-11 08:23:57 -08:00
Ryan Macnak 94942874b2 [vm] Nicer disassembly for RISC-V hints.
Add missing byte and halfword compare-and-swap.
Add missing clear of reservation after SC.
Define XLEN aliases for the AMOs.
Add wait-on-reservation-set.
More systematically print state on fault.

TEST=ci
Change-Id: Ia07e638a6e08cd40eecc1f8f7d242fd94ef2f2d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467200
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-12-10 11:19:19 -08:00
Tess Strickland 702b0250ac [vm,dyn_modules] Print jump targets as absolute or relative PC.
Previously, the jump target was printed as the value of the offset
from the current PC. Instead, print it as the absolute or relative
PC corresponding to the jump target, depending on the value of
FLAG_disassemble_relative.

To facilitate this, pipe the base PC for relative outputs through
the various formatting functions.

TEST=ci (tested manually while debugging)

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: I9db6baa845bf89df70b36635277893686d73d842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465921
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-12-04 03:13:53 -08:00
Ryan Macnak f19440c37b [vm, compiler] Use Zicond for IfThenElse.
TEST=locally increase baseline to RVA23
Change-Id: Ib28ee2edeea087b19b2cd146134d0dcf93c3fe0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465482
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-12-03 10:16:04 -08:00
Alexander Aprelev 6b72a9c0bc Reapply "[vm] Add graph intrinsics for ThreadLocal hasValue and getValue methods."
This reverts commit 4d7467abd6.

The fix for the failure that caused revert is in patchset 2.

TEST=ci
Change-Id: I9b7ff0dd049062b086ad43c8368c6ede130edf35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465781
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-12-03 06:30:20 -08:00
Alexander Aprelev 4d7467abd6 Revert "[vm] Add graph intrinsics for ThreadLocal hasValue and getValue methods."
This reverts commit 3a4d3681d7.

Reason for revert: broke vm-aot-android-release-arm_x64 lib/math/pi_test, https://github.com/dart-lang/sdk/issues/62149

Original change's description:
> [vm] Add graph intrinsics for ThreadLocal hasValue and getValue methods.
>
> This gets rid of native calls for ThreadLocal hasValue/getValue
>
> ===
> - 51.34%     4.46%  DartWorker       JsonEncode.dart.bin   [.] double.toString
>  - 46.89% double.toString
>   - 43.06% double._toString
>    - 42.48% stub CallBootstrapNative
>     - 41.52% dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*
>      + 27.38% dart::Number::ToString(dart::Heap::Space) const
>      + 5.79% dart::OneByteString::New(unsigned char const*, long, dart::Heap::Space)
>      + 1.79% dart::BootstrapNatives::DN_Double_toString(dart::Thread*, dart::Zone*, dart::NativeArguments*)
>        1.27% __strlen_evex
>        0.92% dart::TransitionGeneratedToVM::TransitionGeneratedToVM(dart::Thread*)
>        0.88% dart::StackZone::StackZone(dart::ThreadState*)
>        0.72% __memmove_evex_unaligned_erms
>        0.71% dart::StackZone::~StackZone()
>     1.47% _DoubleToStringCache.store
>  + 4.44% start_thread
> ===
>
> Benchmark improvements:
> - JsonEncode.Numbers.FromString (Raspberry Pi 4) 50.25%
> - JsonEncode.Numbers.FromBytes  (Raspberry Pi 4) 48.69%
>
> BUG=https://github.com/dart-lang/sdk/issues/62046
> TEST=ci
>
> Change-Id: I3cdbaf085dfc23fcad4544be8a299b7520c7d825
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464320
> Commit-Queue: Alexander Aprelev <aam@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

Bug: https://github.com/dart-lang/sdk/issues/62046
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I06db44ff6b7eb5021c2a2f4d5af6ff659205cb2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465641
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2025-12-02 09:34:58 -08:00
Alexander Aprelev 3a4d3681d7 [vm] Add graph intrinsics for ThreadLocal hasValue and getValue methods.
This gets rid of native calls for ThreadLocal hasValue/getValue

===
- 51.34%     4.46%  DartWorker       JsonEncode.dart.bin   [.] double.toString
 - 46.89% double.toString
  - 43.06% double._toString
   - 42.48% stub CallBootstrapNative
    - 41.52% dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*
     + 27.38% dart::Number::ToString(dart::Heap::Space) const
     + 5.79% dart::OneByteString::New(unsigned char const*, long, dart::Heap::Space)
     + 1.79% dart::BootstrapNatives::DN_Double_toString(dart::Thread*, dart::Zone*, dart::NativeArguments*)
       1.27% __strlen_evex
       0.92% dart::TransitionGeneratedToVM::TransitionGeneratedToVM(dart::Thread*)
       0.88% dart::StackZone::StackZone(dart::ThreadState*)
       0.72% __memmove_evex_unaligned_erms
       0.71% dart::StackZone::~StackZone()
    1.47% _DoubleToStringCache.store
 + 4.44% start_thread
===

Benchmark improvements:
- JsonEncode.Numbers.FromString (Raspberry Pi 4) 50.25%
- JsonEncode.Numbers.FromBytes  (Raspberry Pi 4) 48.69%

BUG=https://github.com/dart-lang/sdk/issues/62046
TEST=ci

Change-Id: I3cdbaf085dfc23fcad4544be8a299b7520c7d825
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464320
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-12-02 07:55:25 -08:00
Ryan Macnak e1ea898cbf [vm] Fix Fuchsia RISC-V build.
TEST=local build
Change-Id: If21f38e98d76c962519434504dfc5003332831ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464783
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-01 12:47:18 -08:00
Ryan Macnak 6d4cfab927 [vm, compiler] Combine cset+sub into csetm for ARM64 IfThenElse.
TEST=ci
Change-Id: I64f70325ceca589ee93663f651a784c9c833ce36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464763
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-01 11:15:43 -08:00
Johnni Winther 5bc2037cb0 [kernel] Implement InvalidInitializer
This updates the Initializer classes such that InvalidInitializer has a message and will throw at runtime, similar to InvalidExpression. All initializers have positions and only FieldInitializer and SuperInitializer have an isSynthetic field.

TEST=pkg/front_end/testcases/general/invalid_initializer.dart

Change-Id: Ic444bb1dc273b433ac70249240527d115deaa332
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463661
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2025-11-27 01:53:23 -08:00
Ryan Macnak 4e4fc120c1 [vm] Add Zimop and Zcmop.
TEST=ci, local QEMU
Change-Id: I5946292a1442336882edc947107e28cd2c7c9baf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464461
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-11-25 11:04:06 -08:00
Ryan Macnak 144b3955e8 [vm] Add Zacas.
TEST=ci, local qemu
Change-Id: If1a2d187107da9fda6bfe7c94925960e6d351205
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464322
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-11-25 08:14:02 -08:00
Liam Appelbe 7b422f440d [vm] Fix branch coverage finally edge cases
StreamingFlowGraphBuilder::BuildTryFinally talks about 5 different
cases where a finally block needs to be executed:
1) break/continue in a loop
2) continue in a switch
3) return statement
4) try body is an open fragment
5) exception is thrown inside try

StreamingFlowGraphBuilder::BuildTryFinally itself only handles cases
4 and 5. So when we added branch coverage to the finally inside
BuildTryFinally, we missed cases 1, 2, and 3, which go through
TranslateFinallyFinalizers instead.

Bug: https://github.com/dart-lang/tools/issues/2241
Change-Id: I02b38a18452be709d5fabd9945d6570a2f1b5120
Fixes: https://github.com/dart-lang/tools/issues/2241
TEST=SourceReport_BranchCoverage_finallyEdgeCases
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463220
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-11-24 15:59:56 -08:00
Alexander Markov ea75975e03 [vm,ia32] Avoid clobbering callee-save register in assembler test
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/62061

Change-Id: I453a7f30927562dace1d0189f29a7bd91646e3a0
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-ia32-try,vm-linux-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463702
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-11-24 09:59:27 -08:00
Ryan Macnak a6f0afcecb [vm, compiler] Vector initialization loops.
TEST=ci, local qemu
Change-Id: I54ab2fa1a830c925e4bbd633f229d68341bbaa10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462745
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-11-19 11:21:31 -08:00
Tess Strickland b8ad514530 [pkg,dyn_modules] Use bytecode payload start for relative disassembly.
Add an additional argument to the base implementation of KernelBytecodeDisassembler::Disassemble that is the base address to use
when FLAG_disassemble_relative is enabled.

For the delegating versions of KernelBytecodeDisassembler::Disassemble
that take a Bytecode object, the payload start of the bytecode object
is retrieved and used as the base.

For the delegating versions of KernelBytecodeDisassembler::Disassemble
that take neither a base or a bytecode object, the start is used as
the base.

When tracing instructions in the interpreter, the bytecode is retrieved
via the frame pointer and then its payload start is passed in as the
base, so that the relative offset printed with the instructions match
the relative offsets printed when dumping function bytecode.

TEST=manual use of --disassemble-relative while tracing/dumping bytecode

Change-Id: I7f931037970acd950a330fa6be024df5beb144a7
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463022
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-11-19 07:56:49 -08:00
Ryan Macnak 61fff77154 [vm, compiler] Add just enough of the vector extension to implement memcpy and memset.
TEST=ci, local qemu
Change-Id: I9518049ca927fa42d3c04e9e045c6cec1342c789
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462462
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-11-18 14:33:11 -08:00
Alexander Aprelev de77c6b766 [vm/shared] Introduce ScopedThreadLocal to allow keeping state on
thread, outside of isolate, on isolate-group bound callback.

Fixes https://github.com/dart-lang/sdk/issues/61523
TEST=scoped_thread_local_test

Change-Id: I0c8280d2808d940a5fb0d628db191932400a5edb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451402
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-11-13 09:50:34 -08:00
Ryan Macnak b0c305b8e4 [vm] Fix unused variable warning on GCC.
TEST=ci
Change-Id: I19740707337e437d7135d9b6803c01cad59097ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461541
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-11-12 12:48:59 -08:00
Ryan Macnak 3125f46f5b [vm] Add Zicfiss.
TEST=ci, local qemu
Change-Id: Iea22fff14362a6eef937f22ab9121376c7e27014
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460883
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-11-11 11:21:46 -08:00
Ryan Macnak 7d7f461ad9 [vm] Improve packing of Thread.
Fix dart_stream_ and service_extension_stream_ appearing after the end-of-accessed-from-generated-code comment.

TEST=ci
Change-Id: I8f10d32b082125d7ed090cd118089309022c0f3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459700
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-11-10 13:04:31 -08:00
Slava Egorov b5e4f412ab [vm] Fix quadratic behavior in AssignSafepoints
Rework register allocator to assign safepoints eagerly
as live ranges are being built and safepoint instruction
is being visited instead of doing it post-factum when 
each range is being finalized.

Fixes https://github.com/flutter/flutter/issues/176619

TEST=ci, manually tested equivalence of safepoint lists

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-mac-debug-x64-try,vm-aot-mac-debug-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-debug-x64-try
Change-Id: Ieebda2796c2397a701b9184f6b8675fe6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460100
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-11-10 02:29:41 -08:00
Ryan Macnak 8c73b534f5 [vm] Use dmb ishst instead of dmb ish for store-store fence.
TEST=ci
Change-Id: Id7fb33bb4d9626ad420fd5aac2df86b47bd5c7bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459662
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-11-05 13:29:00 -08:00
Johnni Winther 6d70657fad [kernel] Add RedirectingFactoryInvocation
This adds an internal wrapper expression for redirecting factory invocations. This holds a reference to the original redirecting factory constructor along with the resulting invocation of the generative or factory constructor. The node is removed during constant evaluation and only available to backends through the pre-modular transformations.

TEST=existing

Change-Id: I35c19766117ab2942aefddb4ccebcd2df66babf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454820
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-10-28 03:03:44 -07:00
Alexander Aprelev 2532cf395a [vm] Grab read program lock when querying Class functions.
Fixes https://github.com/dart-lang/sdk/issues/61734
TEST=tsan ci

Change-Id: Id0c905109ad88f9a0e4abc302b7ad90b8239a86a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457140
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-10-27 09:57:36 -07:00
Alexander Markov d16ce70617 [vm] Improve inline 'is' tests against Function and Record
Testing for kClosureCid/kRecordCid is exhaustive in those cases,
so we do not need a subsequent STC type test.

Follow-up to https://dart-review.googlesource.com/c/sdk/+/456406.

TEST=ci

Change-Id: I7cb4487408b3b181f1f5384966340cc4c9a9a86f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456720
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-10-22 14:10:49 -07:00
Alexander Markov 2626836f36 [aot,dyn_modules] Fix inlined 'is' tests for classes which can be extended in dynamic modules
Bug: b/453914353
Change-Id: I5739913010b9331f6e060150680a0051ed580a2d
TEST=pkg/dynamic_modules/test/data/extend_class3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456406
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-10-22 08:51:48 -07:00
Ryan Macnak fca41fa22f [vm, compiler] Refactor IA32 leaf runtime calls to be more like the other architectures.
TEST=ci
Change-Id: I2e5902649df3a09c83240ecda26d0f514755e56d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456101
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-10-21 10:22:01 -07:00
Ryan Macnak 16dac1c61d Roll Clang from 9d7449a82b83 to 8b93f27cf7e6
TEST=build
Change-Id: I4c7ad19d9b5d9a7f329516296c1cd01dd64053b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456160
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-10-21 09:22:50 -07:00
Ryan Macnak 0a1678c06c [vm] Record stack for JIT TSAN.
The main interesting thing is that deopt can expand one optimized frame to multiple unoptimized frames, so deopt needs to call  __tsan_func_entry enough times to rebalance the stack.

Also fixes stack balance for throw error slow paths for AOT.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/61352
Change-Id: I3fdc8481bc8db7a3aec0fa1938ac3e0e96ac13a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452943
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-10-20 10:49:20 -07:00
Ryan Macnak c59549e957 [vm, compiler] More specific assembly comments for runtime calls.
TEST=ci
Change-Id: Iaabdbceedbddffd2f980fb0828a8fc211524a3d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455180
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-10-15 09:21:52 -07:00
Ryan Macnak f80d794475 [vm] Fixes for TSAN in debug mode.
TEST=local build
Change-Id: I99550b012531717dd942f397495a25599154ec69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454180
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-10-13 13:24:35 -07:00
Tess Strickland df693c20b0 [vm,dyn_modules] Add flags to bytecode source positions.
There are two possible flags for each source position currently:
a flag that marks the source position as synthetic and a flag that
marks the source position as within a yield point.

Synthetic source positions in bytecode are treated the same as synthetic
source positions in compiled code. That is, they encode the source
position in the text that caused them to be synthesized, but denote that
the covered instructions are internal and not to be used for debugger
pause points or for call site/branch coverage information.

Adding these flags allow us to mark appropriate parts of the async
machinery as synthetic, and also allow us to mark all the bytecode
involved in yield points as having the same token position.

The latter fixes tests where the code would step over a previous
expression, thus being paused at the start of the await bytecode,
and would record the fp and token position there as the ones to
ignore. However, since a new source position wasn't emitted until the
direct call to the await method, the recorded token position would
be the token position prior to the await call, and so the change
in token position at the await call would trigger an early pause.

TEST=pkg/vm_service/test/async_single_step_exception_test
     pkg/vm_service/test/async_single_step_into_test
     pkg/vm_service/test/async_single_step_out_test
     pkg/vm_service/test/async_star_single_step_into_test
     pkg/vm_service/test/async_step_out_test
     pkg/vm_service/test/positive_token_pos_test
     pkg/vm_service/test/step_into_async_no_await_test

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-mac-debug-arm64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-product-x64-try
Change-Id: Ic7642a74fb76227a473f461f360e84dd3d5a45a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453322
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-10-09 09:15:42 -07:00
Tess Strickland 3c26fcf597 [vm] Delimit and escape string constants when disassembling to stdout.
TEST=ci (only affects output used for debugging the VM)

Change-Id: If9732db5695a19943ecf88362deb96a93a2bd843
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454000
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-10-09 02:19:50 -07:00
Ryan Macnak f1aa58931d [vm] Remove Isolate, IsolateGroup and global Random.
The per Thread instance is sufficient.

TEST=ci
Change-Id: Iff2c4279937637089f7ae4194cb1097b5e6eef67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452881
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-10-07 15:13:14 -07:00
Ryan Macnak f1ba8ceacf [vm] Make some IgnoreRace functions inlinable.
Fix GCC TSAN build.
Cleanup sanitizer includes.

TEST=ci
Change-Id: Ib68bbfa701b4309c03514ed689391051094208e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452226
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-10-01 09:41:26 -07:00
Ryan Macnak 305189ec8f [vm] Fix IA32.
TEST=ci
Change-Id: I5559a1cf11d8ec5ae96deb87d098cf7ee9caac8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451401
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-09-24 15:14:32 -07:00
Ryan Macnak 78d280a2df [vm] Symbolize JIT Dart frames for TSAN.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/61352
Change-Id: I0e64e563b19bbd7b67e6f275dbc373db08b9d2c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449980
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-09-24 13:14:32 -07:00
Tess Strickland e01fad78df [vm,dyn_modules] Fix Scope check in ActivationFrame::ContextLevel.
The end PC offset for the scope is inclusive, not exclusive.

Also rename PrintDescriptorsError -> PrintContextLevelError and
print the Bytecode local variable information since that is what
is searched for the context level for interpreted frames.

TEST=pkg/vm_service/test/step_through_closure
     pkg/vm_service/test/step_through_function_expression

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: Ib53d0a7cff81de16c957b73ce9ec7dcb0e4aaa34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449740
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-09-16 05:52:51 -07:00
Alexander Markov 0d75724ebc [vm,dyn_modules] Support compound pointers in FFI call arguments
TEST=ci (ffi/address_of_test)

Change-Id: If87231c5c9dabb49a904dedd0cc8ef034c16dfe3
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try,vm-ffi-dyn-mac-release-simarm64_arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449069
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-09-15 14:45:12 -07:00
Ryan Macnak 285b11070f [vm, compiler] Reduce spilling needed to call __tsan_read/write for array access.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/61352
Change-Id: Ia3dc1a057f96e2c9e695a28824882a76e4893c69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449143
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-09-15 10:16:37 -07:00
Ryan Macnak 496a2bdc9b Roll clang to 49f39b349db181ca516eb0253462105ff0e2c634.
TEST=ci
Change-Id: I38e9ad7b16ffb0a9d380c3ed23b17854dca5a32f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447440
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-09-15 10:00:29 -07:00
Tess Strickland 827551f8e0 [vm,dyn_modules] Fix ActivationFrame::ContextLevel for bytecode frames.
Instead of using the computed LocalVarDescriptors when the
frame is interpreted, use the LocalVariableInfo in the serialized
bytecode to find which Scope is currently active.

Add printing of local variable information to the bytecode
disassembler.

TEST=pkg/vm_service/test

Change-Id: I7bd15056e4e2a947ad16ffb83a50447c2ba59994
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-mac-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449340
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-09-15 08:14:47 -07:00
Tess Strickland 74f753f32d [vm,dyn_modules] More work on bytecode debugger support.
Detects yield points in Debugger::IsAtAsyncJump for bytecode by seeing
if the currently executing instruction is a direct call to an await
or yield compiled stub.

Adds a ResumptionBreakpointHandler runtime entry that is called
during Interpreter::Resume() if the current isolate has resumption
breakpoints.

Similarly, all the places where a DebugCheck could be emitted if
debugging stops are requested now include an explicit source position
emission when source positions are requested but debugger stops are not,
to ensure the debugger has appropriate information.

Fixes CompareTopDartFrameTo returning kSelf for non-top frames when
the top frame was interpreted but the stepping frame was not or
vice versa.

TEST=pkg/vm_service/test

Change-Id: I88cdc37cf745f30e8dfb6b14c19fc9b2c4cbaf2d
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-mac-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446300
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-09-12 04:19:40 -07:00