Commit Graph

21825 Commits

Author SHA1 Message Date
Alexander Markov a36dbc78ff [vm, dynamic_modules] Support loading of dynamic modules from unmodifiable view
TEST=pkg/dynamic_modules/test/data/load_unmodifiable_view
Fixes https://github.com/dart-lang/sdk/issues/57039

Change-Id: I5b04acd458da437b6ce4cf4b36e0c60c3d3458aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393920
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-11-06 20:23:58 +00:00
Ryan Macnak f972499915 [vm, compiler] Generate smaller far branches on RISC-V.
TEST=ci
Change-Id: I860596aafd8b11a36f0c1090759fe22e0beb81ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392462
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-11-06 19:44:04 +00:00
Ryan Macnak f6f8134ef2 [vm, compiler] Fix compressed instructions for larger shift values.
TEST=ci
Change-Id: I7b49c7479cce80f91c068cf6f82d8bb4d19d45e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393605
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-11-06 17:25:56 +00:00
Alexander Markov 9645a7114c [vm/compiler] Simplify code generation of comparisons by moving constant operands to the right
TEST=ci

Change-Id: Ifa17f11ca297de9da733dffc132ade498c9e0f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393604
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-11-06 13:58:40 +00:00
Ivan Inozemtsev 53ba9af361 Standalone Dart runtime library for embedders
For now we use a static library, but I am planning to add support for a shared library in a follow-up CL.

Tested: locally on macOS and Linux, also ci should at least build samples.
Change-Id: I277239359de226c56633884f350b22a030759ab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392640
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-11-06 13:11:34 +00:00
Siva Annamalai 74c5aa3a7a Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
This reverts commit f81a402aa1.

Reason for revert: golem benchmarks are failing to run

TEST=ci

Original change's description:
> "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
>
> This reverts commit 75e6a748f7.
>
> TEST=ci
>
> Original change's description:
> > Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > This reverts commit 1b331d05c2.
> >
> > Reason for revert: golem builds are failing
> >
> > Original change's description:
> > > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> > >
> > > TEST=ci
> > >
>
> Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Iec494940412aa31dbefdc5280e35ae99e8cecb26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393764
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-11-06 05:37:46 +00:00
asiva f81a402aa1 "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime

This reverts commit 75e6a748f7.

TEST=ci

Original change's description:
> Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> This reverts commit 1b331d05c2.
>
> Reason for revert: golem builds are failing
>
> Original change's description:
> > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> >
> > TEST=ci
> >

Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-06 03:10:31 +00:00
Ryan Macnak 4fa616b254 [vm] Fix code patcher assertions for RISC-V.
TEST=ci
Change-Id: I313d2bb7f03c9ce8fd9fe423e732b34a5a2420e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393584
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-11-05 22:16:59 +00:00
Siva Annamalai 75e6a748f7 Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
This reverts commit 1b331d05c2.

Reason for revert: golem builds are failing

Original change's description:
> [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
>
> TEST=ci
>
> Change-Id: I96ed52994e0d955300c18026032e68003504666d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Change-Id: I5dc14973f4ee4e577b2c996839d5e497c97fb440
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393761
Commit-Queue: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-05 21:58:09 +00:00
asiva 1b331d05c2 [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
TEST=ci

Change-Id: I96ed52994e0d955300c18026032e68003504666d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-11-05 20:39:15 +00:00
Alexander Markov f09afbe719 [vm/compiler] Cleanup unused handling of stack slot locations in comparisons
Location summary for inputs of integer comparisons uses either
RequiresRegister or LocationRegisterOrConstant, so operand cannot be a
StackSlot.

TEST=ci

Change-Id: Idff0f09074be2055f0f9a46d8629c769155eb8ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393044
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-11-05 13:50:55 +00:00
Alexander Markov 52cb60b34e [vm/compiler] Rename Comparison to Condition, introduce proper Comparison
Previously, ComparisonInstr base class represented arbitrary conditions
used in Branch, IfThenElse and CheckCondition instructions and included
subclasses TestInt, TestCids, TestRange and unary DoubleTestOp which are
not comparisons. So this refactoring renames ComparisonInstr to
ConditionInstr.

In addition, a new Comparison instruction is added as a base class for
StrictCompare, EqualityCompare and RelationalOp.

TEST=ci (pure refactoring)

Change-Id: Ic8756ee5913ff2bc974c95cea8004370c9f5527f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393420
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-11-05 13:50:08 +00:00
Ryan Macnak 6bb1b9c357 [vm] Fix RISC-V ClobberAndCall to actually call.
TEST=ci
Change-Id: I6729c1b9c76094d88363cf0cb79e92288c3aa4eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393600
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-11-05 02:31:43 +00:00
Ryan Macnak b0e3448240 [vm, compiler] Fix LR/SC assembler tests.
Compare 4242ff536f.

TEST=ci
Change-Id: I3cc69504c380af02fa3869e73beef4112a60accb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393381
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-11-04 18:26:02 +00:00
Alexander Aprelev 8519914049 [gardening] Fix riscv32 build, remove unused variable.
Fixes https://github.com/dart-lang/sdk/issues/57021
TEST=local riscv32 build

Change-Id: I142a50a5998ec35fc40e82fd0bd2533c5f2097c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393361
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-11-04 17:04:54 +00:00
René Kilczan fb173b8070 Detect Windows edition via WMI
Closes https://github.com/dart-lang/sdk/pull/57010

GitOrigin-RevId: 56375417878283dec1882e20cf396c0935e9fdb7
Change-Id: I9344426b143aa1677a950bf3ebec3eee214f3ccf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393002
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-11-04 10:42:20 +00:00
Alexander Markov 2bcb7361d5 [vm/compiler] Remove speculative int32 range checks
UnboxedInt32 representation is no longer speculative, so
all speculative int32 range checks are removed from Unbox and
IntConverter instructions. Unbox and IntConverter instructions
are now always truncating. IntConverter cannot deoptimize.

TEST=ci

Change-Id: Ie9a83e055e8b8372859b0721ac6fbcf73da39ab8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392740
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-11-01 13:15:36 +00:00
Alexander Markov 507d40fd95 [vm/compiler] Fix constant propagation of truncating Unbox instructions
TEST=ffi/data_test
Fixes https://github.com/dart-lang/sdk/issues/56996

Change-Id: I153a468d784eae16d65722e91a039347930fd801
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392841
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-10-31 21:52:48 +00:00
Alexander Markov c919ade017 [vm/compiler] Remove speculative inputs from IL instructions
All inputs of IL instructions are now non-speculative,
SelectRepresentations pass now always inserts non-speculative
unboxing instructions.

In call specializer, where JIT compiler speculates, speculative Unbox
instructions are now explicitly added for inputs which may have
incorrect type. Unbox instructions now have 'value_mode' (either
kHasValidType or kCheckType) instead of speculative mode.
Added canonicalization rule to change value mode if
compiler can prove that value has correct type.

Also, cleaned up speculations around UnboxedInt32 representation in
JIT mode, which aligns this representation with other unboxed
representations.

TEST=ci

Change-Id: I52f5c959c3f6515b1a7c9e8ab15b420beed0e3f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391492
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-10-30 19:35:48 +00:00
Samuel Rawlins 81f4b71293 Reland "Reapply "analyzer: separate unused_element_parameter from unused_element""
This reverts commit b3f31a0440.

Reason for revert: Customer tests are now disabled.

Original change's description:
> Revert "Reapply "analyzer: separate unused_element_parameter from unused_element""
>
> This reverts commit b551690c56.
>
> Reason for revert: flutter customer tests failing: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8738601049545714785/+/u/run_test.dart_for_customer_testing_shard_and_subshard_None/stdout
>
> Original change's description:
> > Reapply "analyzer: separate unused_element_parameter from unused_element"
> >
> > Fixes #49025. Fixes #48401
> >
> > This allows users to blanket ignore unused_element_parameter without
> > ignoring unused_element. They are reported in distinct situations so it
> > is valid to separate them.
> >
> > This reverts commit b888da751e.
> >
> > Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
> > Tested: trybots
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
> > Reviewed-by: Ben Konyi <bkonyi@google.com>
> > Commit-Queue: Samuel Rawlins <srawlins@google.com>
> > Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
>
> Change-Id: Ie0df2f4be45e5db2fa255dcf8c30ddf8408c155b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382420
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Matan Lurey <matanl@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Icbe69690e83daecc5a0649d2f632ffc33ba6394c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Matan Lurey <matanl@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-10-30 16:56:16 +00:00
Ryan Macnak f359a4367e [vm, compiler] Improve TestImmediate on RISC-V for higher single-bit tests.
Shifting the interesting bit to the sign bit is shorter than loading a large immediate.

TEST=ci
Change-Id: Ibd3dadf3885b554643e4606e8cbf83fcc6ba3d30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392463
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-10-30 16:40:18 +00:00
Ryan Macnak e65b892d12 [vm, compiler] Enable argument registers for RISC-V.
dart2js.aot.rv64gc  28061800 -> 27559904 (-1.8%)
dart2js.aot.rv64gcb 27996112 -> 27510728 (-1.7%)

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54955
Change-Id: Ic18ab8c33f59c36561fa7e7aed4d06f4e8f8c9dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357215
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-30 16:34:12 +00:00
Alexander Markov 3f717df415 [vm/compiler] Infer array element type from static type Iterable<E>
Inferring array element type E from static type Iterable<E> allows
compiler to remove extra checks left from iterator code.
This is valid as List<E> implements Iterable<E>.

This change makes for-in loops over built-in lists with static types
Iterable<E> as efficient as loops over List<E>.

TEST=runtime/tests/vm/dart/regress_56840_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/56840

Change-Id: Ie52208b9c3e92dcc52079e66c910b023f09a2173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392401
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-10-30 15:41:41 +00:00
Liam Appelbe 50f367b283 [vm] Early-out in NativeCallable trampoline if isolate creation disabled
I haven't been able to get a solid repro the tsan flake locally, and I'm not sure how to write a test for it, but this change is pretty uncontroversial anyway, so I'm inclined to just land it and see what happens.

I have some weak evidence that this fixes the issue though. Before this change I ran the flaky command about 500 times before I saw a failure (though I didn't get any useful data from the failure, and it didn't look quite the same as the bug). With the change, the command ran 3500 times before flaking. I'm not sure if it's the same flake though (rr isn't working for me atm).

Bug: https://github.com/dart-lang/sdk/issues/56900
Fixes: https://github.com/dart-lang/sdk/issues/56900
Change-Id: I939e8ceca4051ec91e942ca38a2b01477b67ddd8
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392162
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2024-10-29 22:26:59 +00:00
Ryan Macnak c2c8a984f3 [vm, compiler] Handle invalid shift amount during code generation by emitting a break instead of asserting.
The compiler sometimes fails to remove unreachable IL instructions, and such instructions can have contradictory range information.

TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/56947
Change-Id: I435019ea87804fdb649e7ff8cee855d08be24019
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392403
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-10-29 20:44:13 +00:00
Ryan Macnak 2a4a7d91d4 [vm, compiler] Don't introduce spurious connections to check bounds instructions during LICM.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/56947
Change-Id: Icf593c246f226dd9d8d8b6b055122f8b567be35e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391682
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-29 19:53:11 +00:00
Ryan Macnak 949eb447a4 [vm, gc] Add write-write fence after initializing object headers, or defer marking new-space objects in an active TLAB.
On architectures with a weak memory model, there is the possibility that the concurrent marker can see the publishing store of a new object before it sees the initializing store of that object's header. On an M1, the barrier to prevent reordering these stores is fairly cheap, so we emit this barrier on Mac/iOS ARM64. Otherwise, this barrier is very expensive (or at least expensive for some hardware within the ABI), so instead we avoid the race by deferring marking of objects inside an active TLAB.

Disable TSAN instrumentation on the marker setting the mark bit, as TSAN does not understand fences.

TEST=ooo arm64 machines
Bug: https://github.com/dart-lang/sdk/issues/56845
Change-Id: I0676661a7cf941fdc6b451e516d890c26826bb3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389265
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-10-28 22:41:39 +00:00
asiva cd31961c0b [vm] - Fix gcc compilation error
56962 - MutatorMarkerRace_DetectInTLAB test compile error on GCC

TEST=ci

Change-Id: I16038dc5f2fd8656652c13c55e7e4b403c4f859a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392063
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-10-28 17:26:36 +00:00
Ryan Macnak e25601e129 [vm, compiler] Use bit-manipulation extensions when targeting Android or Fuchsia RISC-V.
Use Zbb instructions when available for ClampedUint8List stores.
Use Zba instructions when available for IntConverter zero extensions.
Fix LslImmediate(kUnsignedFourBytes) when Zba is enabled.

TEST=locally switch to RV64GCB
Change-Id: If9fc0ac3fd2c5248785322f949e2003024e5152a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385640
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-28 17:08:39 +00:00
Ryan Macnak 36da75d075 [vm, compiler] Fix mismatch between ARM's StoreIndexedInstr::MakeLocationSummary and EmitNativeCode.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/56948
Change-Id: I7241071df2aedb34a88817896005eb0fdff674eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391487
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-28 17:04:10 +00:00
Ryan Macnak 9e28e19002 [test] Synthetic versions of the mutator-marker race.
TEST=vm/cc/MutatorMarkerRace_*
Bug: https://github.com/dart-lang/sdk/issues/56895
Change-Id: I3e3f25b2c43aec09a409377f77c6d2fec287bccb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390263
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-24 03:24:08 +00:00
Stephen Adams e288d38ce7 [vm] Don't do pragma_unsafe_no_bounds_check_test on IA32
TEST=ci
Bug: #56910
Change-Id: Iaed0cbf5ed139a14cfa4736839fbd6013bcfccfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391702
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2024-10-24 00:12:41 +00:00
Alexander Aprelev ea5fdaafd6 [io/socket/win] Ensure udp sockets survive sending data to unreachable destination.
TEST=tests\standalone\io\socket_udp_readwrite_test.dart
BUG=https://github.com/flutter/flutter/issues/155823

Change-Id: Ic38bc9c022fe3964bcca003bf498c4a5435d5104
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390140
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-10-23 19:13:05 +00:00
Ryan Macnak 37b7db0653 [io] Limit the IOService to 1 thread when running with --deterministic.
TEST=locally build the SDK twice without RBE
Bug: https://github.com/dart-lang/sdk/issues/56884
Change-Id: I59110f92c737fb1137e12114f6bcaacfd6283347
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391463
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-22 23:09:20 +00:00
Alexander Markov 2b899adb4c Revert "[vm] Enforce that entry points must be annotated by default."
This reverts commit cb9ecbc363.

Reason for revert: causes failures during Dart->Flutter roll and on Flutter HHH bots (see comments on the original CL).

Original change's description:
> [vm] Enforce that entry points must be annotated by default.
>
> Changes the default value of the --verify-entry-points flag
> to true.
>
> Changes the default value for the check_is_entrypoint argument to
> to the Invoke/InvokeGetter/InvokeSetter flags to true. The mirrors
> library implementation and calls via vm-service explicitly pass
> false for this argument now.
>
> Add annotations as needed, such as annotating classes with
> annotated generative constructors. In some cases, the annotations
> were more general than needed (e.g., annotating with a no-argument
> entry point annotation when only the setter is needed), so make
> those annotations more specific.
>
> As this pattern is already common in downstream code, allow
> Dart_Invoke on fields as long as the field is annotated for getter
> access. (That is, calling Dart_Invoke for a field is equivalent to
> retrieving the closure value via Dart_GetField and then calling
> Dart_InvokeClosure.)
>
> TEST=vm/cc/DartAPI_MissingEntryPoints
>      vm/dart/entrypoints_verification_test
>
> Issue: https://github.com/dart-lang/sdk/issues/50649
> Issue: https://github.com/flutter/flutter/issues/118608
>
> Change-Id: Ibb3bf15632ab2958d8791b449af8651d47f871a5
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
> CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363566
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

Issue: https://github.com/dart-lang/sdk/issues/50649
Issue: https://github.com/flutter/flutter/issues/118608
Change-Id: Idba168f77b0636a50ad93309e29dc9989cc1f388
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391460
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2024-10-22 14:18:04 +00:00
Tess Strickland cb9ecbc363 [vm] Enforce that entry points must be annotated by default.
Changes the default value of the --verify-entry-points flag
to true.

Changes the default value for the check_is_entrypoint argument to
to the Invoke/InvokeGetter/InvokeSetter flags to true. The mirrors
library implementation and calls via vm-service explicitly pass
false for this argument now.

Add annotations as needed, such as annotating classes with
annotated generative constructors. In some cases, the annotations
were more general than needed (e.g., annotating with a no-argument
entry point annotation when only the setter is needed), so make
those annotations more specific.

As this pattern is already common in downstream code, allow
Dart_Invoke on fields as long as the field is annotated for getter
access. (That is, calling Dart_Invoke for a field is equivalent to
retrieving the closure value via Dart_GetField and then calling
Dart_InvokeClosure.)

TEST=vm/cc/DartAPI_MissingEntryPoints
     vm/dart/entrypoints_verification_test

Issue: https://github.com/dart-lang/sdk/issues/50649
Issue: https://github.com/flutter/flutter/issues/118608

Change-Id: Ibb3bf15632ab2958d8791b449af8651d47f871a5
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363566
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-10-22 09:34:22 +00:00
Ben Konyi 6a9a4f0d0c [ CLI ] Support --suppress-analytics before CLI commands and for dart test
Fixes https://github.com/dart-lang/sdk/issues/56842

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

Change-Id: I1692352e3847c977c72a948d26be8ef8311ec69e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390900
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-10-18 15:02:06 +00:00
Stephen Adams 066962ff60 [vm] Defer removal of bounds checks
Change how `@pragma('vm:unsafe:no-bounds-checks')` works.

Instead of never inserting the bounds check, the bounds check is added to the flow graph with a flag that it should later be removed, `omit_check`. The removal occurs in `RangeAnalysis::EliminateRedundantBoundsChecks`. This ensures that the indexed load is pinned by the check, preventing illegal code motion.

`@pragma('vm:unsafe:no-bounds-checks')` is not a mechanism to allow unsafe access. It means that the access is known to be safe because of invariants not apparent to the compiler. Keeping the bounds check in the flow graph allows range analysis to learn from the bounds constraints and perhaps remove other checks. A test was added for this scenario. I didn't see this in the wild, but I did see one case where a refined range allowed a boxing to be removed.

Bug: #56808
TEST=BoundsCheckElimination_Pragma_learning, BoundsCheckElimination_Pragma_learning_control
Change-Id: I5b3f4470d6c40c988a8a0ee563c765f4f5f9128b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389620
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2024-10-16 23:10:11 +00:00
Ryan Macnak da8f17762c [vm, gc] Allocate card tables up front.
This avoids data races when multiple mutators compete to install the card table, and allows removing the initialization check from the write barrier.

TEST=ci, tsan
Bug: https://github.com/dart-lang/sdk/issues/56895
Change-Id: I30fe4687d3ca771f6c00dfa59e8dadec23d557a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390023
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-16 21:25:17 +00:00
Kallen Tu 1bf5482e1e Enable 'wildcard-variables' feature flag.
This CL enables the wildcard variables feature by default in Dart 3.7.

Local variables and parameters named `_` are now non-binding and they can be declared multiple times without collisions. All wildcard variable declaration types that have this behavior are described in the
wildcard variables specification: https://github.com/dart-lang/language/blob/main/accepted/future-releases/wildcard-variables/feature-specification.md.

Top-level variables, top-level function names, type names, member names, etc.
are unchanged. They can be named `_` and used as they are today.

These are a few examples of where wildcard variables can be used:
```dart
Foo(_, this._, super._, void _()) {}

typedef T = void Function(String _, String _);

main() {
  var _ = 1;
  int _ = 2;

  list.where((_) => true);
}
```

Bug: https://github.com/dart-lang/sdk/issues/55673
Fixes: https://github.com/dart-lang/sdk/issues/55654
Change-Id: I80e904d39b364f5e54b8406b4db02ec40ecc9db0
TEST=Existing tests, language tests for wildcards.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381311
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-10-15 19:12:31 +00:00
Derek Xu 30dc2de34f [VM/Service] Report the requested column in the error messages of CannotAddBreakpoint errors
TEST=CI

Change-Id: Ia74bd61ef0b166275d5828fb21cfa9c92c5f00cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389280
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-10-15 16:57:36 +00:00
Derek Xu cdacfd80f1 [VM/Debugger] Ensure that a breakpoint can only resolve on the exact line that was specified in a request
TEST=CI

Fixes: https://github.com/dart-lang/sdk/issues/56820
Change-Id: Ic04400ce6a15d7a2450b05bd5753087350ae52b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388460
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-10-15 16:57:36 +00:00
Daco Harkes 2bba463f71 [vm/ffi] Add embedder API for resolving asset ids - fix
Stop swallowing error messages.

TEST=Tested in the local engine build in Flutter that uses the new API.

Change-Id: I179366b8d5a251bcb00b5fea722e440c2745a1c7
Cq-Include-Trybots: luci.dart.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-try,vm-ffi-android-debug-arm-try,vm-aot-linux-debug-x64-try,vm-linux-debug-x64-try,vm-win-debug-x64-try,vm-mac-debug-x64-try,vm-mac-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389740
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-10-12 07:06:31 +00:00
Lasse R.H. Nielsen f8086c81ae Collect all test-related files in package:expect.
Collects files from `package:async_helper` and `tests/language`
that are generally useful, so that all test-related helpers are
in `package:expect`.

Moves the two libraries from `package:async_helper` into `package:expect`,
and the `tests/language/static_type_helper.dart` file too.

Deprecates `async_minitest.dart`, to follow `minitest.dart`,
expecting the Flutter use of it to have been fixed to not break
on deprecation (I believe Flutter no longer breaks builds on deprecations at all).

Patch 1 is the actual change.
Patch 2+4+8 is changing all existing references to the files.
Patch 6 ignores deprecation in files still using `async_minitest.dart`.

3+5+7+9 are updating this text to make the numbers match.
Then it's just test-expectations and small tweaks from there.

Change-Id: I1b665135b5fef9b9a0c3b340ffe9daf874d0174c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-10-11 16:53:52 +00:00
Ryan Macnak 889e5795bb [vm, compiler] Use immediate forms for BinaryUint32Op.
dart2js.aot.arm64  28757440 -> 28691320 (-66k)
dart2js.aot.x64    28311232 -> 28310536 (-1k)
dart2js.aot.rv64   27971912 -> 27955200 (-16k)
dart2js.aot.arm32  27793504 -> 27775936 (-17k)

TEST=vm/dart/uint32_op_imm_test
Change-Id: I25e486ea1ab3b20369c0c5a5fafae5d1ea53b1c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388120
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-09 16:47:48 +00:00
Jens Johansen 54f1ee4067 [VM/CFE] Fix expression compilation with record types
Fixes https://github.com/dart-lang/sdk/issues/56859

TEST=pkg/vm_service/test/evaluate_with_record_{1,2}_test.dart + CFE test

Change-Id: I4fdd2bc8e6c04fc59aaad28a192fe0b1833f000d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388841
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-10-09 11:01:57 +00:00
Ryan Macnak ccbd0c6129 [vm] Avoid reordered stores during Thread::SuspendStateInternal.
The profiler will crash if the signal handler runs between clearing the OSThread from the Thread and setting the TLS to the OSThread if they are reordered. The window here is much larger on Android because of Android's slow emutls. This doesn't affect standalone Dart because the two stores are in different translation units, but Flutter uses LTO.

TEST=flutter
Bug: https://github.com/flutter/flutter/issues/143178
Change-Id: I96a4d154083949f6bdd33a17a75a88d611c9a34a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388743
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-08 20:36:14 +00:00
Ryan Macnak 262b759e06 [vm] Place regexp sources in their own directory.
This makes it easier to see their cost in binary size tools.

TEST=ci
Change-Id: I6079ad9fb9b7c9450bb8d255e9a794a38ec9ae62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388641
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-10-08 17:28:49 +00:00
Derek Xu bdff12304d [VM/Debugger] Delete a TODO
I didn't mean to commit this TODO, it was just a reminder I left as I was working on a CL.

TEST=CI

Change-Id: I5e3f7592bd4d7d92f85b92ef44c6adf26465c772
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388380
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-10-08 17:23:43 +00:00
Vyacheslav Egorov 284e9e91c8 [vm] Allocation profiling via uprobes
This CL adds basic infrastructure and tooling to perform allocation
profiling using uprobes.

See runtime/tools/profiling/README.md for more details.

TEST=manually tested, requires root access

Cq-Include-Trybots: luci.dart.try:vm-aot-mac-release-arm64-try
Change-Id: Id68d181740dbf227a12d8cdba84b11a9518e75a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382405
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-10-08 13:56:45 +00:00