Commit graph

21555 commits

Author SHA1 Message Date
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
Ryan Macnak 6bc417dd17 [vm, compiler] Fix passing untagged pointer to store barrier check on ARM/ARM64.
Add missing store barrier check for RISCV.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/55754
Change-Id: I90156c5fbb9f49b26ef19319dde7899b512670d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366894
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-17 22:21:20 +00:00
Ryan Macnak 42ec219908 Revert "[vm, gc] Incremental compaction."
This reverts commit bc0f02e4c8.

Reason for revert: https://github.com/dart-lang/sdk/issues/55754

Original change's description:
> [vm, gc] Incremental compaction.
>
> At the beginning of a major GC cycle, select some mostly-empty pages to be evacuated. Mark the pages and the objects on these pages. Apply a write barrier for stores creating old -> evacuation candidate pointers, and discover any such pointers that already exist during marking.
>
> At the end of a major GC cycle, evacuate objects from these pages. Forward pointers of objects in the remembered set and new-space. Free the evacuated pages.
>
> This compaction is incremental in the sense that creating the remembered set is interleaved with mutator execution. The evacuation step, however, is stop-the-world.
>
> Write-barrier elimination for x.slot = x is removed. Write-barrier elimination for x.slot = constant is removed in the JIT, kept for AOT but snapshot pages are marked as never-evacuate.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/52513
> Change-Id: Icbc29ef7cb662ef8759b8c1d7a63b7af60766281
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357760
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Bug: https://github.com/dart-lang/sdk/issues/52513
Change-Id: I565ad6c0fca283d33f605c10f181bc0a59e7d2b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366965
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-17 18:03:42 +00:00
Ryan Macnak bc0f02e4c8 [vm, gc] Incremental compaction.
At the beginning of a major GC cycle, select some mostly-empty pages to be evacuated. Mark the pages and the objects on these pages. Apply a write barrier for stores creating old -> evacuation candidate pointers, and discover any such pointers that already exist during marking.

At the end of a major GC cycle, evacuate objects from these pages. Forward pointers of objects in the remembered set and new-space. Free the evacuated pages.

This compaction is incremental in the sense that creating the remembered set is interleaved with mutator execution. The evacuation step, however, is stop-the-world.

Write-barrier elimination for x.slot = x is removed. Write-barrier elimination for x.slot = constant is removed in the JIT, kept for AOT but snapshot pages are marked as never-evacuate.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52513
Change-Id: Icbc29ef7cb662ef8759b8c1d7a63b7af60766281
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357760
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-16 23:26:08 +00:00
Derek Xu 45221e51c3 [VM/Debugger] Prevent FindBestFit from considering closures that were
compiled prior to the latest reload

TEST=verified that
pkg/vm_service/test/breakpoint_resolution_after_reloading_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: Ie816a3ad65a17ef9f497f209f2203d679728cb75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366860
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-05-16 21:57:18 +00:00
Ryan Macnak 565bc48302 [vm, gc] Use FreeListElement as the filler object for array truncation.
This is consistent with new-space sweeping using FreeListElement as the filler object, and allows for stronger asserts in incremental compaction.

TEST=ci
Change-Id: I43a87a46fb1211a88589cf4a349ada7b556e4c11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366885
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-16 19:30:58 +00:00
Sam Rawlins 8b53d26a09 observatory: replace unsupported [this] comment references with this.
Work towards https://github.com/dart-lang/dartdoc/issues/3761

Sibling CL to https://dart-review.googlesource.com/c/sdk/+/365204

The analyzer has never recognized `[this]` as a valid doc comment
reference (and the `comment_references` lint rule has similarly
reported such reference attempts). dartdoc has its own algorithms
for resolving comment references, which we are dismantling in favor
of a single resolution, provided by the analyzer.

We've also decided against adding support in the analyzer (see
https://github.com/dart-lang/linter/issues/2079), so these
reference attempts should be re-written.

TEST=Nope
Change-Id: Ie584a8338d4b203c4dce737769dbf2bd9094a42c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366881
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-05-16 19:24:38 +00:00
Devon Carew 2837647bea [wiki] move the https://github.com/dart-lang/sdk/wiki to the docs/ dir
Change-Id: I28db796fadcc111d97d3589bf3988ea0bbb8e18a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366682
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-05-16 18:19:40 +00:00
Ryan Macnak b3287af10e [vm] Remove MSAN_UNPOISONs around print and sort functions.
This was probably fixed by ddc11f8084.

TEST=msan
Change-Id: I05f58b382ad186929bd4dbf56e905568cb268d96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366683
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-16 16:33:52 +00:00
Tess Strickland 8b8ec2aa3d [gardening] Fix TrySwitchInstanceCall for --no-lazy-dispatchers.
TEST=Manual run of the following command line found by the dart
     fuzzer:

out/DebugX64/dart --profiler --max_profile_depth=189 \
  --sample_buffer_duration=51 --marker_tasks=2 \
  --optimization_counter_threshold=31050 --no_load_cse \
  --no_lazy_dispatchers pkg/compiler/lib/src/dart2js.dart \
  --invoker=test --platform-binaries=out/ReleaseX64 \
  --out=out/dartfuzz/5.js --no-source-maps \
  pkg/compiler/lib/src/util/memory_compiler.dart

Change-Id: If7620b7b7bb76d28f66ffde01af52a62392302c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366780
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-05-16 10:33:58 +00:00
Ryan Macnak 38d7d5d663 [vm, compiler] Account for IndirectGotoInstr with 1 successor in register allocation.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/55686
Change-Id: I58f772d80063c0b44613224bf4eb3980d2d9e2b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366067
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-15 16:53:58 +00:00
Johnni Winther ae03b57cbb [cfe] Remove .isNonNullableByDefault from package:kernel
This removes the .isNonNullableByDefault properties and similar from
the AST nodes in package:kernel. NNBD is now always enabled so these
properties are trivial.

TEST=existing

Change-Id: I75ca0551ac4b5910ea63530dd0c9c2e68bd01aff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366320
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-05-15 08:31:38 +00:00
Vyacheslav Egorov 3afb61aa7a [vm] Use Hash as TypeArguments canonicalization hash
Fixes https://github.com/dart-lang/sdk/issues/55666

TEST=ci

Change-Id: Ib7d53e14f5be0f56851576dec2e6a3f136b41e44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366301
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-05-15 08:06:29 +00:00
Ryan Macnak d45304cd6f [vm] Add support for the Zalasr extension.
TEST=ci
Change-Id: Ic1a98751ac6b46310e420b44f487720f0dc237c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366162
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-14 16:40:59 +00:00
Ryan Macnak aac993f867 [vm] Remove RV_Zbc from RV_B.
The B Standard Extension has been ratified as Zba + Zbb + Zbs.

TEST=ci
Change-Id: Ifad5d68104e8f98e49a34e5a5ae76fa13c377b38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365988
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-05-13 21:39:22 +00:00
Vyacheslav Egorov 04cc5098ab [vm] Enable test pattern (a&b == 0) fusion in AOT on X64/ARM64
Previously we would only fuse this pattern for Smi operations
which (almost) never happens in AOT. This CL enables fusion
for Int64 operations as well.

The implementation is limited to X64 and ARM64 for now
because implementing it on 32-bit platforms is somewhat
cumbersome.

Issue https://github.com/dart-lang/sdk/issues/55522

R=alexmarkov@google.com
TEST=vm/cc/IL_TestIntInstr,vm/dart/test_int_pattern_il_test

Cq-Include-Trybots: luci.dart.try:vm-linux-release-simarm-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-simarm_x64-try,dart-sdk-linux-riscv64-try,vm-aot-linux-debug-simriscv64-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-simriscv64-try,vm-linux-release-ia32-try
Change-Id: I62a482640db45befac6b0b78850f23a8cc624c75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365463
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-05-11 08:53:29 +00:00
Ben Konyi 5f3cd4afe3 [ CLI ] Implicitly set --mark-main-isolate-as-system-isolate for dart test
Fixes https://github.com/flutter/flutter/issues/143170

TEST=test_test.dart

Change-Id: I98044ab2362adcdd55c4f6def0752a755b1385b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366040
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2024-05-10 19:28:45 +00:00
Ryan Macnak 57f57dbbf2 [vm] Don't assert assuming FLAG_max_polymorphic_checks is the same between AppJIT training and execution.
Compare FLAG_optimization_counter_threshold, which can likewise change; optimized compilation might happen sooner or later than with a consistent flag value, but should still be correct.

TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/55625
Change-Id: Iced616163ecf8b3d0a811c67e0c01a9be3d8b18b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365904
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-10 18:14:46 +00:00