Commit graph

21572 commits

Author SHA1 Message Date
Alexander Markov 0c9067c626 [vm,aot] Preliminary support for dynamic interface in AOT
TEST=runtime/tests/vm/dart/dynamic_module_pragmas_il_test.dart

Change-Id: I6efd24f55726db858711d5f77beabf5659e288a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371563
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-06-18 14:31:24 +00:00
Jens Johansen 9b67562b4d Add 'coverage' flag, defaulting to true, but let the gn application_snapshot default it to false
Automatic set coverage when loading snapshot

TEST=Existing tests, manual inspection of reduction in sdk snapshot sizes (see data in comments in https://dart-review.googlesource.com/c/sdk/+/370501)

Change-Id: I044616144c2defeed252a6715eba1abcabffc86d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371700
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-06-18 09:10:00 +00:00
Alexander Markov 4d3689138e [vm] Remove obsolete --[no-]unbox_doubles flag
All our target platforms support unboxed doubles and this obsolete
option is no longer used.

TEST=ci

Change-Id: I1d9214b49e875bc52e4f25650dacf8446a2e40a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371980
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-06-17 22:45:59 +00:00
Ryan Macnak 6226568fa5 [vm, gc] Separate marking stack by generation.
Allows the scavenger to avoid pruning work, which can be significant if the marking stack becomes very deep.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/55713
Change-Id: Icb6c15d07034bc79573af1bf30f31cbf30c59717
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369123
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-06-17 21:43:32 +00:00
Jens Johansen 856139bfc3 [VM] Add RecordCoverage to InstanceCall and StaticCall
Before this CL, becase of optimizations, coverage of some of these goes
away, making coverage unreliable.

I believe this fixes the issues for "regular" runs (at least it seems to
be stable on the CFE coverage tests).

If setting `--optimization-counter-threshold=-1` there'll still be
trouble though and we would have to also insert these calls in the start
of FunctionBody and the start of FieldInitializer for it to produce the
same results.

TEST=pkg/vm_service/test/coverage_instance_call_after_optimization_test.dart,pkg/vm_service/test/coverage_static_call_after_optimization_test.dart

Bug: https://github.com/dart-lang/sdk/issues/42061
Bug: https://github.com/dart-lang/sdk/issues/55959
Bug: https://github.com/dart-lang/sdk/issues/56018

Change-Id: I34947f0d4b123e52ce67b71a195782d31e4bda16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370501
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-06-17 10:47:58 +00:00
Alexander Aprelev 4138277ee6 [vm/shared] Introduce 'vm:shared' pragma.
Decorating a field with 'vm:shared' pragma makes values in this field accessible to all isolates in an isolate group.

Introduce `channel` to the `Version` class so that the pragma can only be enabled on main and dev channels.

TEST=shared_test, shared_fail_without_flag_test
BUG=https://github.com/dart-lang/sdk/issues/55991

Change-Id: I843c9f0d2ffc9f2ced7ddc4006bb6f9ca4e2ddf4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370064
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-06-14 23:24:19 +00:00
なつき bde8d28217 Fix build regression on alpine linux
Closes https://github.com/dart-lang/sdk/pull/55993

GitOrigin-RevId: 0a4d00914442f6be1bce949ca7a234fbd04952cd
Change-Id: I1cb1ad381111853c03ac3a39854a0c0a75a3d31a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371262
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-06-14 07:39:30 +00:00
Daco Harkes 47cb48e415 [vm] Native asset relative path resolution with symlinks - fix
The fallback mechanism wasn't working because the embedded struct by
value wasn't nullptr initialized.

TEST=tested by commenting out `Dart_InitializeNativeAssetsResolver`
in `main_impl.cc`. Without this CL it segfaults, with this CL it works
as expected.

Closes: https://github.com/dart-lang/sdk/issues/56006
Change-Id: If93cf9b077a2791a8385bdc8e75708dd95c8ead6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371620
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-06-14 07:05:15 +00:00
Stephen Adams 18994e6e46 [typed_data] Remove UnmodifiableXXXView classes
In most cases, the (now removed) SDK class was patched so that the constructor redirected to a platform-specific implementation of the unmodifiable view. Uses of the SDK class in the platform code could be rewritten to the more direct use of the implementation class.

The big +/- file changes are from moving the implementation classes from the patch file (typed_data_patch.dart), where they are no longer needed, to the internal file (typed_data.dart).

TEST=ci
Bug: #53785
Change-Id: Iaa7370de25b7fc2d26b24f7733c2892868e593cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370661
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2024-06-13 22:18:29 +00:00
Derek Xu 92b744d1b2 Fix iso-stress job by preventing --sound-null-safety flag from getting passed to the VM
Runs of this job are currently failing and logging the message "Setting
VM flags failed: Unrecognized flags: sound_null_safety".
e.g. https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/iso-stress-linux/6150/overview

Change-Id: I2fe541dc801794b2e0c12c98bf1bcf6d774e41de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371380
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-06-13 17:02:03 +00:00
asiva e23e032406 [test] Fix isolate concurrency test to not pass in sound-null-safety flag
Change-Id: I57f252e427e35fcf4ad5e96465f3ad4e88ababea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371203
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-06-12 22:26:35 +00:00
Ryan Macnak 0713bce1fe [vm, gc] Check for pause requests when marking large arrays.
This was sometimes responsible for the largest GC pause in IsolateSendExitLatency, with a scavenge waiting for a concurrent marker to finish a whole array and pause.

TEST=ci
Change-Id: Ib2d8417ffe6cee3e8436a8c382d2db660e1eef41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371180
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-06-12 20:53:18 +00:00
asiva 418858b725 [VM/Runtime] - Remove unused sound_null_safety command line option.
TEST=ci
Change-Id: I9c471e809b2c218e75be5e938479ee8b6a76908b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365621
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-06-12 20:51:31 +00:00
Ryan Macnak f3cc30ab41 [vm, profiler] Fix sample representation to account for the change to 20-bit class ids.
TEST=ci
Change-Id: I6ba060d250069d71dcf38e4f7ab1a1ca240ce23d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371200
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-06-12 20:22:41 +00:00
Ryan Macnak 622afbfbe7 [vm, gc] Prefer the incremental compactor over the full compactor during idle GC.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52513
Change-Id: I85d861b2eb2ab4b461ae981bf094596af02d4df1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370702
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-06-12 17:23:02 +00:00
Daco Harkes 9588927faf [vm] Native asset relative path resolution with symlinks
This CL moves native assets resolution to the embedder.

The Dart VM looks up the asset path (for example
`['relative', 'foo.so']`) with the asset id. The embedder defines
callbacks for asset loading, and returns a handle to the dylib.
Then the VM calls the embedder again with `dlsym` to lookup the symbol.

The Dart VM & kernel compiler are responsible for the asset id to
asset path mapping. The kernel compiler compiles it into the snapshot
and the VM looks it up in the snapshot.

Relative paths are resolved relative to the isolate script uri (kernel
snapshot, jit snapshot, aot snapshot, or `dart compile exe` result).
The embedder is responsible for remembering the script uri it set when
spawning the isolate group.

This CL does not add `dlclose` or `dladdr` embedder callbacks yet.
Bug: https://github.com/dart-lang/sdk/issues/55521
Bug: https://github.com/dart-lang/sdk/issues/55966

TEST=pkg/dartdev/test/native_assets/build_test.dart
TEST=tests/ffi/native_assets/asset_relative_test.dart

Bug: https://github.com/dart-lang/sdk/issues/55410
Bug: https://github.com/dart-lang/sdk/issues/55523
Bug: https://github.com/dart-lang/sdk/issues/55207
Change-Id: I75ec4a368c5fb3d2f76b03771e796ff56bcac941
Cq-Include-Trybots: dart/try:vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,vm-aot-asan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-msan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361881
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-06-12 16:45:19 +00:00
Daco Harkes 4b2906cdc1 [vm] Move ResolveUri to platform
This will enable the standalone embedder to resolve uris in a follow
up CL:
https://dart-review.googlesource.com/c/sdk/+/361881

The implementation was using zones for allocation, this CL switches
that to using `malloc`. The caller is responsible for freeing the
memory if resolving succeeds.

This CL removes `Dart_DefaultCanonicalizeUrl`.

We don't have a run_platform_tests, so this CL keeps the tests in
run_vm_tests.

TEST=vm/cc/ParseUri
TEST=vm/cc/ResolveUri
TEST=tests/ffi/native_assets/asset_relative_test.dart

Bug: https://github.com/dart-lang/sdk/issues/55523
Change-Id: Ifb300d8164eb50506f22ce619fad0811f74ef34c
Cq-Include-Trybots: luci.dart.try:vm-aot-asan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-win-release-try,vm-aot-linux-debug-x64-try,vm-linux-debug-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-aot-win-debug-x64-try,vm-win-debug-arm64-try,vm-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368423
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-06-12 16:45:19 +00:00
Jens Johansen c15466034e [status_files] Cleanup status files
Make tool (by default) give error when test entry specified in status
file does not exist. Make -w (by default) remove such entries.

Cleanup most status files, fixing a few entries containing `.dart` and
removing obsolete entries (i.e. entries pointing to nonexisting tests).

This should for instance have given an error in
https://dart-review.googlesource.com/c/sdk/+/370600 saying that the file
I specified didn't exist (in that I shouldn't have specified the `.dart`
part).

TEST=No tests, this is status file maintenance.

Change-Id: Ie977bf15dea2e3dad8d771fd3e99917317e975f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370886
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-06-12 10:21:23 +00:00
Ryan Macnak 4242ff536f [vm, compiler] Fix clobbered register on strex failure path when dirtying cards.
Add spurious store-conditional failures to the simulators.

TEST=golem
Change-Id: Ice3d18145cbb883cf868ad4ee077a2d1e56b15ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370962
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-06-11 18:00:35 +00:00
Tess Strickland 324ba0c11f [vm/compiler] Extend Assembler::AddScaled to take a base register.
Add an additional base argument to Assembler::AddScaled so it now
computes:
  dest <- base + (index << scale) + offset

If base is kNoRegister (or ZR when available), then it emits
instructions optimized for computing:
  dest <- (index << scale) + offset
(i.e., its previous implementation)

Add AddScaled to AssemblerBase to ensure the same interface across all
architectures.

Rework the backend of CalculateElementAddress to use AddScaled
appropriately, which unifies it across architectures.

TEST=ci (refactoring)

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-debug-simriscv64-try,vm-mac-debug-arm64-try,vm-aot-mac-release-arm64-try
Change-Id: I33c8f99604b68360f10b79050bd66ceb9d65ac9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370504
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-06-11 08:33:29 +00:00
Ryan Macnak ea9eb67d54 Roll Clang to 3809e20afc68d7d03821f0ec59b928dcf9befbf4.
Re-run clang-format.

TEST=ci
Change-Id: Ic277ea6baefa42bcc49ebce4f1099b910066cd4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370680
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-06-10 20:38:30 +00:00
Kallen Tu 141bb5417b [kernel] Add isWildcard flag to VariableDeclaration.
Adds the `isWildcard` flag to variables. Will be using this for producing better errors.

TEST= Existing expectations tests for wildcards pass with new flag.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: If2f7a5555e7cc26e84d1b1e63e4261c81a157d78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370062
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-06-10 19:33:39 +00:00
Jens Johansen 911b8d11a7 [vm] RecordCoverageInstr isn't dead code
Dead Code Elimination can remove `RecordCoverageInstr`, but shouldn't.
This CL makes it stay by returning true in `HasUnknownSideEffects`
making `MayHaveVisibleEffect` return true, making Dead Code Elimination
keep it.
Note that `RecordCoverageInstr::Canonicalize` will still let it go away
if the position is already covered which is what we want.

Bug: https://github.com/dart-lang/sdk/issues/42061

TEST=pkg/vm_service/test/coverage_closure_call_after_optimization_test.dart,vm/cc/IL_RecordCoverageSurvivesOptimizations

Change-Id: Ifd72f9071a51924fd71f3dae91687acb1467047d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370220
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-06-10 13:02:28 +00:00
Ben Konyi 8e00ebc689 [ CLI ] Fix snapshot detection logic for google3
google3 makes heavy use of symlinks, with no guarantee that the relative
location of files with respect to each other will be maintained after
the symlinks are resolved. This causes issues when trying to locate the
DartDev snapshot using the VM executables resolved path as a base.

This change updates the DartDev snapshot detection logic to first try to
find the snapshot using the resolved executable path before falling back
to using the unresolved path used to launch the VM (e.g., the path
specified by argv[0]).

TEST=pkg/dartdev/test/

Change-Id: I19a41c440ac82cbc671dafb3bda23a31fb4cdc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370000
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-06-06 19:10:19 +00:00
Tess Strickland d06d627c79 [vm] Remove --[no-]lazy-dispatchers flag.
No client of the VM uses this flag, only tests, and this flag was always
set to false in AOT mode. Thus, remove uses of this flag and instead
always lazily create dispatchers as needed when resolving method names
in JIT mode.

Remove the implicit value of `allow_add` for some Resolver
static methods. For callers that previously depended on the implicit
`true` value (which includes the AOT precompilier), pass `true` for
uses in the compiler and pass `!FLAG_precompiled_mode` for uses in the
runtime. Assert that `allow_add` is false when these methods are invoked
from the precompiled runtime.

Remove Resolver static methods that are no longer used.

TEST=ci

Change-Id: Ib6a7354f7a859e86743c381513a4129c14895753
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-mac-debug-arm64-try,vm-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366668
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-06-06 10:56:12 +00:00
Tess Strickland d7e6e0e8c3 [vm/compiler] Fix dart fuzzer CalculateElementAddress crash on X64C.
In the backend, handle the following cases that were assumed not to
happen before:
* If the index and offset are both 0, then the operation is a no-op
  and so the output register should be the same as the first input.
  (Should only happen if the instruction is used in a non-optimizing
  context, as otherwise it is removed by canonicalization.)
* If the scaled index can be used as an instruction immediate and the
  offset is 0, then emit the appropriate instruction(s).
* If the scaled index and offset can both be used as immediates to
  instructions, but their sum (the total offset in bytes) cannot, then
  allocate a register for the index and fall back to the non-constant
  index case.

CalculateElementAddress::Canonicalize now only performs removal of
no-op instructions.

This CL also fixes a switch on the instruction tag in
FlowGraph::RenameRecursive to appropriately convert UnboxedConstant
instructions to initial definitions of the FlowGraph as it already does
for Constant instructions.

TEST=vm/dart/regress_55877

Issue: https://github.com/dart-lang/sdk/issues/55877
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-debug-simriscv64-try,vm-mac-debug-arm64-try,vm-aot-mac-release-arm64-try
Change-Id: I613d6c8770fe02facf6bbdb3d2b11f842b51540d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369642
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-06-06 09:14:18 +00:00
Ryan Macnak 42270748b5 [vm, io] Remove dead Windows 7 code.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54509
Change-Id: I488f01e43faccf6f9f2dd58fcd55ca33a7f1f55d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369860
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-06-05 23:08:15 +00:00
Ryan Macnak b11c932a29 [vm, gc] Work-steal the store buffer during scavenging.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/55713
Change-Id: Ie198a94c43f6ba8048695204eb716049bf8b23e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369740
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-06-05 17:45:19 +00:00
Vyacheslav Egorov e0710a5cc6 [vm/compiler] Support SIMD arrays in TypedDataSpecializer
TEST=vm/cc/IRTest_TypedDataAOT_FunctionalGetSet

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try
Change-Id: I64a050acffaec5228828876b6da998687b5e432b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369762
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-06-05 15:08:10 +00:00
Alexander Markov 43ba8eb388 [vm] Add index checks to Array handle class
Index checks in debug mode are useful to catch bugs earlier.

Also remove stale declaration of PcDescriptors::PrintHeaderString.

TEST=ci

Change-Id: I4a149c3516a6627b3d4d254b9b7eed403f8aea1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369721
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-06-04 20:21:26 +00:00
Derek Xu 30b0796c8c [VM/Debugger] Fix bug where breakpoints set in compiled field initializers do not resolve immediately
TEST=verified that
pkg/vm_service/test/breakpoint_resolves_immediately_in_compiled_field_initializer_test.dart
fails without the changes in this CL and passes with them, verified that
none of the existing debugger tests got broken by this CL

Change-Id: I6acb5576a80e5d633b012c866fe90bf13d2c1ba6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369162
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-06-04 15:06:28 +00:00
Brian Quinlan 51ea22f13f [vm/io] Explain why the return of inflateReset can be ignored
Change-Id: I9e2bda9786f15118b422db2d6dc9c2b4aee3e272
Tested: comment-only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369180
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2024-05-31 22:29:07 +00:00
Ryan Macnak 3bf8f35014 [standalone] Remove dead VM sections from blob container format.
TEST=ci
Change-Id: I78940e2c617c33983748e7532cec305b1ecd1c18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369101
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-31 21:12:28 +00:00
Brian Quinlan ea44765874 [vm/io] Add support for decompressing concatenated zip/gzip blocks.
Bug:https://github.com/dart-lang/sdk/issues/55469
Change-Id: I030e22cafba9164b305972c53d3ba9342503a836
Tested: unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363964
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2024-05-31 20:23:53 +00:00
Ryan Macnak 6694cae4d7 [vm, gc] Incremental compaction, take 3.
- Use atomics to mark remembered cards in the write barrier stub.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52513
Bug: https://github.com/dart-lang/sdk/issues/55754
Change-Id: I1f78c6b680a6ae9170613ba328a244335a6343e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368480
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-30 21:01:39 +00:00
Ryan Macnak 16f3ad9078 [vm, compiler] Assert against unpredictable forms of load/store exclusive on ARM.
Make ARM64 disassembly closer to the standard form.

TEST=ci
Change-Id: I459093abe049835c6597b80c8020566054a12b48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368824
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-30 20:09:29 +00:00
Tess Strickland 6e5bb2cd5d [vm/compiler] Mark the base impl of PrintBlockHeaderTo as UNIMPLEMENTED.
The previous CL made it a pure virtual method, but if the IL printer
is not included, this implementation never gets overridden in
non-abstract subclasses.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-ffi-android-release-arm-try
Change-Id: I904ff6facc94ff03f604f250a35de390212c2d31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368780
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-05-30 10:46:21 +00:00
Tess Strickland 5aca47f3f3 [gardening] Remove erroneous ASSERT in AddressCanHoldConstantIndex.
The ASSERT checks that there will be no overflow in computing the byte
offset from the index. However, any instruction that uses this method is
preceded by a bounds check of the index, and an index that would cause
the byte offset calculation to overflow is guaranteed to fail the bounds
check. Thus, this is dead code that will never be executed at runtime
and it is okay to emit code to perform the erroneous offset calculation.

TEST=vm/dart/regress_55864

Fixes: https://github.com/dart-lang/sdk/issues/55864
Change-Id: If4126e412368b8307be3c787ccb6bd451764c73f
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368563
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-05-30 10:09:46 +00:00
Tess Strickland 38680a7c29 [vm] Avoid truncated initial definitions in FlowGraphPrinter.
FlowGraphPrinter::PrintOneInstruction uses a stack-allocated
statically-sized buffer to print the instruction. If the instruction is
a block entry with initial definitions, then that buffer would need to
be large enough to hold the printed information for the block entry and
all of its initial definitions. However, in some pathological cases,
like the Dart fuzzer, graphs are created where the initial definitions
can end up truncated due to the use of a large number of constants.

Instead, add the following protected methods to
BlockEntryWithInitialDefs:

* PrintBlockHeaderTo, a pure virtual method that specifies how to print
  the block header information, overridden in each subclass.

* PrintInitialDefinitionsTo, a non-virtual method that prints the
  initial definitions. It takes an additional argument, a callback which
  takes the buffer being used for printing, and invokes the callback
  after printing each initial definition.

Also adds BlockEntryWithInitialDefs::PrintTo, which calls
PrintBlockHeaderTo and PrintInitialDefinitionsTo in sequence, providing
a no-op callback to the latter, and removes the PrintTo overrides in
the subclasses in favor of this base implementation.

Adjusts FlowGraphPrinter::PrintOneInstruction to call PrintBlockHeaderTo
and PrintInitialDefinitionsTo for BlockEntryWithInitialDefs
instructions, providing a callback that prints the current contents of
the buffer and then clears it. With this, it is unlikely using a
statically-sized stack-allocated buffer as an intermediate will cause
truncation, as each initial definition usually fits on a single line.

TEST=ci (internal debugging-only output, tested manually)

Issue: https://github.com/dart-lang/sdk/issues/55864
Change-Id: I7a7919cd6d76a22e018603240fe0ba6a09c2e6d3
Cq-Include-Trybots: luci.dart.try:vm-aot-mac-release-arm64-try,vm-aot-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368580
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-05-30 09:33:29 +00:00
Ryan Macnak f72f43096c [standalone] Increase AppJIT alignment to 64k.
Linux ARM64 may have a page size of 4k, 16k, or 64k.

Cf. 935b69e676.

TEST=no 64k device available
Bug: https://github.com/flutter/flutter/issues/148659
Change-Id: I1894db74bc61719f7deb2537bc3ff17168644ed1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368525
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-29 19:35:29 +00:00
Martin Kustermann 698bf0846b [vm] Hoist CStringUniquePtr out of Utils, add CAllocUniquePtr` to simplify code
Hoist `CStringUniquePtr` out of the `Utils` class as there
is no reason it has to be nested inside a class - it just makes
code more verbose.

This simplifies code of the form
   std::unique_ptr<T, decltype(std::free)> a = { nullptr, std::free };
to
   CAllocUniquePtr<T> a;

TEST=ci

Change-Id: Ice42c1b16dfa5b20b321c13fbe5b28b3918581cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368425
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-05-29 10:16:28 +00:00
Daco Harkes a8dcef9173 [vm/ffi] Fix callback void returns
The void case was removed in
https://dart-review.googlesource.com/c/sdk/+/353101/68/runtime/vm/compiler/frontend/kernel_to_il.cc#b5594

The void case is handled in `FfiConvertPrimitiveToNative`, but the
null check should not happen for void.

It doesn't seem to reproduce for me locally, but the bug report and
workaround are clear about what error is thrown.
TEST=No idea why it's not reproducing.

Bug: https://github.com/flutter/flutter/issues/149017
Change-Id: Ifbffa501af904a0d2268d0e4e19a9145e6c694cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368341
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2024-05-29 09:58:02 +00:00
Ryan Macnak 1a9acb9171 [vm, ffi] Make callbacks profiler-safe.
Delay changing Thread::vm_tag on callback entry and restore the tag early on callback return so that the profiler doesn't see the "running Dart" tag unless it can also see the fake return address marking the entry frame.

TEST=ffi/async_void_function_callbacks, ffi/function_callbacks_subtype, ffi/function_callbacks, ffi/isolate_local_function_callbacks
Bug: https://github.com/dart-lang/sdk/issues/52814
Change-Id: I40d80ec7c44063d078db0e211565e2d127c6b81e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367460
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-28 21:16:41 +00:00
Johnni Winther a3f83a9e44 [vm] Generate VM platform dill in strong mode
This changes the VM platform dill from agnostic to strong. The
VM no longer supports weak mode, so agnostic is not needed.

TEST=existing

Change-Id: I85defb6aec15262b71b4f1c199e77bd356826332
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366670
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-27 07:52:24 +00:00
Daco Harkes b732c96e8a Revert "[vm, gc] Incremental compaction, take 2."
This reverts commit 9077bf991f.

Reason for revert: CBuild and TGP crashes in random Dart code which
look a lot like arbitrary memory corruption.

Original change's description:
> [vm, gc] Incremental compaction, take 2.
>
> - Fix missing store buffer flush when --marker_tasks=0.
> - Fix passing untagged pointer to store barrier check on ARM/ARM64 (6bc417dd17).
> - Fix passing uninitialized header to store barrier check on ARM64/RISCV (1447193053).
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/52513
> Bug: https://github.com/dart-lang/sdk/issues/55754
> Change-Id: Id2aa95b6d776b82d83464cde0d00e6f3b29b7b77
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367202
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

Bug: https://github.com/dart-lang/sdk/issues/52513
Bug: https://github.com/dart-lang/sdk/issues/55754
Change-Id: I1d70d33c65fe6bf7089b8c1422d59f9146ae7ebf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367962
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-05-23 19:00:50 +00:00
Ben Konyi 0c547d2833 [ CLI ] Fix DART_VM_OPTIONS usage only resulting in printing of help message
Fixes https://github.com/dart-lang/sdk/issues/55767

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I6a773acbd9fc21c086fc459c7cb983ea1ff11fcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367720
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-05-22 20:06:49 +00:00
Ryan Macnak 53f1ed4095 [build] Fix ARM32 GCC build.
TEST=vm-gcc-linux
Bug: https://github.com/dart-lang/sdk/issues/52080
Bug: https://github.com/dart-lang/sdk/issues/55669
Change-Id: I94ecf1b7c74c23d0609844a1163d14454e80eebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367502
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-22 18:06:01 +00:00
Ryan Macnak ffbbdb5a10 [vm, service] Treat the object id ring as strong during major GC.
The id ring was treated as a strong root during minor GC and a weak root during major GC. Before mark-through-new-space, new-space objects could not be collected during a major GC, so in practice the policy was that the id ring was strong for all new-space objects. After mark-through-new-space, new-space object can be collected during a major GC, so service ids could expire very quickly, especially for object just created using the service protocol and not otherwise reachable from the Dart program. Given that service id zones have still not been implemented, this makes it impossible to reliably interact with such an object.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/148704
Change-Id: I0f15c00414f996fad49bcb137c7f1c15bb4955c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367440
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-21 21:29:49 +00:00
Ryan Macnak 9077bf991f [vm, gc] Incremental compaction, take 2.
- Fix missing store buffer flush when --marker_tasks=0.
- Fix passing untagged pointer to store barrier check on ARM/ARM64 (6bc417dd17).
- Fix passing uninitialized header to store barrier check on ARM64/RISCV (1447193053).

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52513
Bug: https://github.com/dart-lang/sdk/issues/55754
Change-Id: Id2aa95b6d776b82d83464cde0d00e6f3b29b7b77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367202
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-21 16:33:00 +00:00
Ryan Macnak 1447193053 [vm, compiler] Fix use of StoreIntoObjectNoBarrier before header initialization.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/55754
Change-Id: Ie516be52a8edf620019f60b2ea0fd4f3eeeba533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367203
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-20 20:56:20 +00:00