Commit graph

20589 commits

Author SHA1 Message Date
Liam Appelbe d6931e618e [vm] Make x86 disassembler able to handle invalid input
Arm, arm64, and riscv disassemblers already pass the new test.

Change-Id: Iaeb84d8db007d35225f77505503ca7614f82fb77
TEST=Disassembler_InvalidInput
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303560
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Liam Appelbe <liama@google.com>
2023-05-16 06:31:21 +00:00
Derek Xu 0e3069ea23 [VM/Timeline] Support serializing duration events in Perfetto's format
TEST=Reported duration events using the embedder API, then retrieved the
trace using GetPerfettoVMTimeline and checked that the timestamps of
events were correct in the Perfetto trace viewer.

Change-Id: I077d7f545d9546727bcc3022c05dfc0b7b3826f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302962
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-15 20:51:38 +00:00
Derek Xu fe43431184 [VM/Timeline] Add perfetto_utils::SetTimestampAndMonotonicClockId
TEST=Retrieved a trace using GetPerfettoVMTimeline and checked that the
timestamps of events were correct in the Perfetto trace viewer.

Change-Id: Ie06e9e883a5d740022fa162bf7162dca6babcf58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302961
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-15 20:51:38 +00:00
Derek Xu 61e280aa11 [VM/Timeline] Change return type of GetIsolate(Group)Id to unique_ptr
TEST=Retrieved a trace using GetPerfettoVMTimeline and checked that the
isolateIds and isolateGroupIds of events still showed up correctly in
the Perfetto trace viewer.

Change-Id: I13cf8dd2bb9af7fbe82da199b7f0d3c32a8cf1e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302960
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-15 20:51:38 +00:00
Ryan Macnak 6250eeca95 [vm] Make clz/ctz inlinable.
TEST=ci
Change-Id: I0eb4480e165259763befd3e7ee519fda111faefe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303040
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-15 17:52:49 +00:00
Ryan Macnak a0a210a779 [vm] Initialize the is-zone-handle slot of read-only handles.
Cf. 715866aed3.

TEST=msan
Bug: https://github.com/dart-lang/sdk/issues/52351
Change-Id: I5d435f40b55a530cce0bb61ea2a9be232caf8e1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303145
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-15 15:41:28 +00:00
Ryan Macnak 20674eee48 [vm, gc] Force inline VisitPointersNonvirtual.
Avoids some spill overhead in a scavenger hot-path.

TEST=ci
Change-Id: Icdbec3d71f0a833c5005b76815e94091afe79c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303004
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-12 21:26:07 +00:00
Alexander Aprelev 1cabe60b14 [vm/gardening] Fix send_unsupported_objects_* tests.
Make sure tests do correct checking of retaining paths, make sure test passes in obufscation mode

Fixes https://github.com/dart-lang/sdk/issues/51501
TEST=ci

Change-Id: Id97a1302f151a2f359f34e5def065401a4aa47c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303003
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-05-12 19:42:12 +00:00
Ryan Macnak 4641a46077 [vm] Update comment on thread interrupters.
TEST=docs only
Change-Id: Ib2921c485defc232264d0c4f86b783ce33c6eadd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302848
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-11 21:41:01 +00:00
Ryan Macnak f4bd3590fc [vm, gc] Avoid double-checking when draining work lists.
TEST=ci
Change-Id: Icc1a8e42e58eee967e562e4e0429eaab33dd7fe0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302802
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-11 18:31:30 +00:00
Daco Harkes 5cbd939dbb [vm/ffi] asTypedList MSAN and UBSAN fixes
Cleanup for https://dart-review.googlesource.com/c/sdk/+/301001.

TEST= ffi/external_typed_data_finalizer_test with sanitizers

Closes: https://github.com/dart-lang/sdk/issues/52349
Change-Id: Iff553c2af7bd61d7d68dbc5a60acbee46e03c17b
Cq-Include-Trybots: luci.dart.try:vm-msan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-ubsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302785
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-05-11 14:17:24 +00:00
Tess Strickland 6b922021a1 [platform] Fix include of vm/globals.h instead of platform/globals.h.
TEST=build

Change-Id: If9e88f09268ff9aecd483734924c9c6f6170d4fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302783
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-05-11 11:53:56 +00:00
Alexander Aprelev 3a668dcf03 [vm/win/aot] Provide unwinding information for Windows AOT snapshots.
Fixes https://github.com/dart-lang/sdk/issues/52045
TEST=ffi_induce_a_crash_test

Change-Id: Ic047df10732d6ff8cf695ce098d80ec3a098dbf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302380
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-05-11 03:14:27 +00:00
Tess Strickland 4b8aa6a634 [vm] Update assembler to access AbstractType::flags_ as Uint32.
In d592882f, the old uint8_t `type_state_` and `nullability_` fields
in subclasses of `AbstractType` were merged into a single uint32_t
`flags_` field in `AbstractType` itself.

Accessing the nullability information was abstracted into two methods:

* `LoadAbstractTypeNullability`
* `CompareAbstractTypeNullabilityWith`

However, the code from these methods were based off the old
`CompareTypeNullabilityWith` and `CompareFunctionTypeNullabilityWith`
methods that used unsigned byte loads to access the old field, and kept
that even though the new field is now a 32-bit unsigned integer. This
works for now, because the nullability portion of the `flags_` field
happens to be the lowest two bits, but might lead to confusion if
someone attempts to write similar code for accessing the other parts of
the `flags_` field without realizing it's larger than 8 bits.

Thus, this CL does the following:

* Unifies the implementation of both methods across architectures.
* Adds a native slot definition for the `AbstractType::flags_` field
  and uses `LoadFromSlot` to load the `flags_` field instead. Other
  places where the `AbstractType::flags_` field is accessed from the
  assembler are also changed to use `LoadFromSlot` appropriately.

TEST=The existing suite of tests are sufficient.

Change-Id: Ie578e4dddce810223ca9e767403136cb40d340f3
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-linux-debug-x64c-try,vm-kernel-precomp-linux-release-simarm-try,vm-linux-release-x64-try,vm-linux-release-simarm64-try,vm-linux-release-simarm-try,vm-linux-release-ia32-try,vm-linux-debug-simriscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302187
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-05-10 22:40:58 +00:00
Martin Kustermann 3ed8736bdd [vm] Make [ReloadOperationScope] a macro instead of a class
The [ReloadOperationScope] has [StackResource]s as fields and is itself
a [StackResource] which is problemantic if unwinding happens manually.

So we'll make it a macro that expands to the 3 fields instead.

TEST=ci

Change-Id: I3fb7bec7ca87193c83ec34908f9a43c5db005900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302201
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-05-10 19:08:23 +00:00
Derek Xu 6c3c34560e [VM/Service] Add code for working with Perfetto protos to package:vm_service
TEST=get_perfetto_vm_timeline_rpc_test and
get_perfetto_cpu_samples_rpc_test

Change-Id: I23a30629f1d7a8cd7e2c9daad2d02fae4decb338
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302421
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-10 19:06:10 +00:00
Derek Xu e26fe2817c [VM/Timeline] Start skipping over dart::TimelineEvents that provide no useful information when writing Perfetto traces
TEST=Checked that traces written using the Perfetto file recorder, and
traces retrieved through `getPerfettoVMTimeline` still looked correct.

Change-Id: I7e327ef525c99187fa8aea868d1cc48721af9f98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302420
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-10 19:06:10 +00:00
Ryan Macnak 1c1e11b0e7 [vm, gc] Retry allocation under the safepoint before performing GC.
This avoids back-to-back GCs where multiple threads race to enter a safepoint operation to perform GC, and the losers of the race perform GC after they enter their own safepoint operation.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/29415
Change-Id: Ic9be830b0c4438f9b57ea9f54464b342872175f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300860
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-10 17:24:50 +00:00
Ryan Macnak 28c2491f8d [vm, service] Account for weakness in getRetainingPath and getRetainedSize.
We had been treating all references as strong for these RPCs. Now weak references are skipped, but ephemeron references are still treated as strong.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/49155
Change-Id: I6c4f344ce3c0df5bdbeb133a697bb26ff972f372
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302367
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-10 16:12:28 +00:00
Daco Harkes e5bb28bc4d [vm/ffi] Pointer.asTypedList finalizer
TEST=tests/ffi/external_typed_data_finalizer_test.dart

Closes: https://github.com/dart-lang/sdk/issues/50507
CoreLibraryReviewExempt: https://github.com/dart-lang/sdk/issues/52261
Change-Id: I1a82dcca15961b28c0de64637970fe38a39286e5
Cq-Include-Trybots: luci.dart.try:vm-asan-linux-release-x64-try,vm-aot-asan-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-qemu-linux-release-arm-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-aot-win-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-aot-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301001
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-05-10 11:38:57 +00:00
Liam Appelbe bd48058fe1 [vm] Switch offsets to hexadecimal
This makes them easier to match up with disassembly.

Change-Id: I9782365e104e807af34a06aee8697e8588583181
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302221
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-05-09 22:01:00 +00:00
Michael Thomsen 152296e642 Cleanup experiment flags formatting:
- Move down shipped 3.0 flags
- Sort all flags consistently

TEST=Manually verified

Change-Id: I21c209df4ff11322512e50a2be666293b5a9743f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302323
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2023-05-09 21:08:41 +00:00
Tess Strickland a41d1b5813 [vm] Clear out specialized stubs for record types on reload.
There's also no need to visit function types on reload, as their
TTSes do not specialize.

TEST=vm/cc/TTS_Reload

Change-Id: Ibbc7bc220b9b75aab27b3e6815be06db461ec46f
Cq-Include-Trybots: luci.dart.try:vm-reload-linux-debug-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-reload-rollback-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302321
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-05-09 14:53:47 +00:00
Vyacheslav Egorov 54be4bc80e [vm/service] Remove Stack.awaiterFrames
This field was supposed[1] to replace Stack.asyncCausalFrames but IDEs
and other service protocol users never adopted it.

The mechanism for collecting awaiterFrames and asyncCausalFrames
was originally considerably different, but we have since unified
both[2] after we switched to lazy async stack traces[3].

Today the only differences between the two are:

- asyncCausalFrames represens async gaps explicitly, while
  awaiterFrames does not;
- when asynchronous function is running its synchronous part
  before the first suspension awaiterFrames will still represent
  the corresponding frame as an asynchronous activation, while
  asyncCausalFrames will treat the same frame as regular frame.

Consequently having this field does not add any value.

This CL removes it from the response and updates all tests to
test against asyncCausalFrames.

[1]: https://codereview.chromium.org/2692803006/
[2]: https://dart-review.googlesource.com/c/sdk/+/167561
[3]: https://github.com/dart-lang/sdk/issues/37668

Tested: pkg/vm_service, service, service_2
Bug: https://github.com/dart-lang/sdk/issues/51763
Change-Id: If2b035a8840047423b8ed8ce3b5d81155e9f38d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301062
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-09 13:46:56 +00:00
Martin Kustermann 7f38a7965e [vm] Ensure reload safepoint operation sends OOBs to all non-parked mutators
The reload safepoint operation mechanism will send out-of-band message
to all isolates that are not already at-reload-safepoint.

It identified all such threads by iterating the active threads list,
filtering those that are not at-reload-safepoint and those with an
active isolate (i.e. `thread->isolate() != nullptr`).

This `thread->isolate() != nullptr` condition isn't quite
correct. A mutator may temporarily run under a [NoActiveIsolateScope] to
make the `Isolate::Current()` unavailable to code that shouldn't depend
on isolates (e.g. GC and Compiler do that) or may even have the
incorrect isolate on it (e.g. Debugger Service notifications).

So if one thread triggers a [ReloadSafepointOperation] and another
thread is under a [NoActiveIsolateScope] it will not get the OOB message
and therefore not get interrupted to check-in.

This has caused flaky timeouts of `vm/dart/isolates/reload_active_stack_test`
- as this test runs isolates with active stack without going back
to event loop (which would check into reload operations).

Closes https://github.com/dart-lang/sdk/issues/52135

TEST=Updated vm/cc/Reload_NotAtSafepoint for regression test
TEST=Fixes flaky timeouts of vm/dart/isolates/reload_active_stack_test

Change-Id: Ib407c42aa97798ac994aff3bce263da79b83666a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302320
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-05-09 13:01:37 +00:00
Alexander Aprelev f59c521959 [vm/win] Leave \\?\UNC\ prefix when canonicalizing file path on Windows.
Fixes https://github.com/dart-lang/sdk/issues/52309
TEST=run tests\co19\src\LibTest\io\exit\exit_A01_t01.dart for example with UNC path to dart.exe

Change-Id: Ief6eb4cda24422a9a100abaf5173bb95e44d19bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302060
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-05-09 03:27:58 +00:00
Johnni Winther 13c4ad23c5 [kernel] Add SwitchStatement.expressionType
This adds the static type of the switch statement expression to
the AST to better support optimizations based on the possible
runtime values of the switch expression.

TEST=existing

Change-Id: Ief35b687150401100d8c96721a026e9f0911b3b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301063
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-05-08 07:39:02 +00:00
Vyacheslav Egorov dd2f556730 [vm] Reoder CFI directives in generated assembly.
This should not actually matter, but we discovered
that LLVM code responsible for emitting compact unwind information
expects this specific ordering of CFI directives. If we don't
follow the order then LLVM fails to emit compact unwind info and emits
__eh_frame instead which is very large.

See https://github.com/llvm/llvm-project/issues/62574.

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

Tested: manually via pkg/vm/tool/precompiler2 --build-assembly and objdump --unwind-info
Change-Id: Idb1f4f64afdaa7206bf43adf1685bb1f4086217f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301740
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2023-05-05 18:39:09 +00:00
Derek Xu cd83aa8494 [VM/Service] Prepare to publish package:vm_service 11.5.0
TEST=`dart pub publish --dry-run`

Change-Id: I6ef1c8175f39a086716be859068518d124124718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301540
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-04 20:20:58 +00:00
Alexander Markov c1f9930f5b [vm] Restore InstanceKind.TypeRef in the VM-service API for backwards compatibility
TEST=doc/comment change
Change-Id: I0fcb9d418a9c95e6ce57a03eb693aefb9e245d2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301501
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-04 18:04:13 +00:00
Derek Xu 1dd644f595 [VM/Service] Add getPerfettoCpuSamples RPC
TEST=Checked that Observatory's timeline view was still able to load CPU
samples correctly, and ensured that samples retrived using
getPerfettoCpuSamples were the same as the ones shown in Observatory.

Change-Id: I9b58cd32bc9a1c08848718f25f10db9fa6d4d241
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297760
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-03 19:17:11 +00:00
Derek Xu da971bbf13 [VM/Timeline] Add assertions to check that the recorder's lock is held where required
TEST=Checked that the timeline in DevTools still looked correct, and
checked that no assertions failed when fetching the timeline

Change-Id: Ia7ed4b8faf4e7c9e8871ecca3111a82e7f298318
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300420
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-05-03 19:17:11 +00:00
Vyacheslav Egorov 2b9140a8f7 [vm/bin] Improve error message in WakeupHandler
Instead of writing errno into stderr via perror include it into
FATAL message. This will help us to dignoze the problem in
environments where FATAL messages are preserved as part of the
crash report.

TEST=tested manually by changing write() parameters to be invalid

Bug: b/279184589
Change-Id: I45424af6064f9eec258a3bff1f96488b8a60f095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298862
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2023-05-02 07:32:30 +00:00
Derek Xu 2dc4db8b57 [VM/Timeline] Ensure that ReclaimCachedBlocksFromThreads is called before events are serialized
TEST=Checked that the timeline in DevTools still looked correct, TSAN,
ASAN

Change-Id: Ibefd92f23728a5b7a7d9db4ae972a75576069ea0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-01 14:52:30 +00:00
Derek Xu 0606c58fde [VM/Timeline] Correctly skip over blocks that are in use when serializing the timeline
TEST=TSAN, ASAN

Change-Id: I3b106c8f0bf3fef5fec8f9fd7146a13401ab9448
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299761
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-01 14:52:30 +00:00
Derek Xu c4f31a9108 [VM/Timeline] Lock accesses to the async track metadata map where needed
This CL also adds the `dart_support_perfetto` GN setting and enables it
by default, and adds a test to ensure that TSAN checks for races related
to reporting async events.

TEST=TSAN, ASAN

Change-Id: I5f43ceca0185287ca4d8e295a509088ea50fd9c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299740
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-01 14:52:30 +00:00
asiva c4cb74cb9d [VM/GC] Ensure that all the GC verification flags do not produce trace
output unless there is an assertion or Fatal error.

(This is needed to ensure that we are able to run the flutter tests with
all these verifications turned on and not disturbing the output from the
tests with these extraneous trace messages)

TEST=ci

Change-Id: Ifb7211e340f1cf29f6d2bff412eb4107f9cb64a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299440
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-28 23:25:43 +00:00
Alexander Markov 50e0e616c0 [vm] Fix gcc build
TEST=ci

Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-riscv64-try
Change-Id: Ib44701aa648c34f032456ee1dad6dc34fdc1584a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299940
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-28 21:26:41 +00:00
Alexander Markov 8d0677eca5 [vm] Simplify type finalization
After recursive types are gone, finalization of types can be
simplified: types can be finalized with a simple recursive traversal
and they no longer need to track "being finalized" state.

Also, finalization doesn't need to write back finalized types
because type finalization without canonicalization is always performed
in place and doesn't result in a new type (or type arguments vector).

TEST=ci

Change-Id: Ifc0a4e12aa410eb2be18c4a475c2f486cfa9ebf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299300
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-28 19:37:10 +00:00
Alexander Markov 2f2af4cfae [vm] Cleanup unnecessary SetHash(0)
After recursive types are gone, there is no need to reset hash code
of types during canonicalization, as it cannot change.

TEST=ci

Change-Id: Ibc64f08b52a66829f72dbae5906771f134bbffb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299260
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-04-28 19:37:10 +00:00
Alexander Markov e46b97e1b7 [vm] Cleanup UntaggedTypeParameter::parameterized_class_id_
For class type parameters 'parameterized_class_id' duplicates
a recently added 'owner' and can be removed.
'owner' is changed to hold class reference as a class id (Smi).

TEST=ci

Change-Id: I93fc11e6bcfcc00058a5281b497f59c5c5847ea6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299160
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-04-28 19:37:10 +00:00
Alexander Markov 2ee6fcf514 [vm] Remove TypeRef
TypeRef type wraps around another type and it was used to represent
a graph of recursive types. After [0], the only use of TypeRef is
for TypeParameter.bound which may indirectly reference the same
TypeParameter.

This change replaces TypeParameter.bound with TypeParameter.owner and
removes TypeRef entirely. Various parts of the VM no longer need to
handle and support TypeRefs.

TypeParameter.owner can reference a FunctionType, Class,
or, as an optimization, it can be set to null in order to share
class type parameters among different classes.

With the exception of the 'TypeParameter.owner' back pointer,
VM types are now not recursive and can be visited without
additional tracking.

Caveats:

* Generic FunctionType cannot be cloned in a shallow way:
  when copying a FunctionType, type parameters should be cloned too
  and their owners should be updated. For that reason,
  a mapping between 'from' and 'to' function types
  (FunctionTypeMapping) is maintained during type transformations
  such as InstantiateFrom.
  FunctionType::Clone is used instead of Object::Clone where
  appropriate.

* When testing types for subtyping and equivalence, mapping
  between function types is passed to make sure
  type parameters belong to the equivalent function types.

* IL serializer needs to serialize function types as a whole before
  serializing any types potentially pointing into the middle of a
  function type (such as return type 'List<Y0>' pointing into
  the middle of a function type 'List<Y0> Function<Y0>()').

[0] https://dart-review.googlesource.com/c/sdk/+/296300

TEST=ci

Change-Id: I67c2fd0117c6183a45e183919a7847fd1af70b3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294165
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-04-28 19:29:36 +00:00
Ryan Macnak 709ba7aa24 [vm] Use PR_SET_VMA_ANON_NAME on Linux too.
This was upstreamed to Linux in 5.17.

TEST=ci
Change-Id: Idcc0c6a80a8f8e148bf13ed4a1d9d54122379ff9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279206
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-04-28 18:29:58 +00:00
Alexander Aprelev 63bc3a685e [gardening] Remove test from stress testing.
The test was removed in https://dart.googlesource.com/sdk/+/4bfb196287ed2c746382c87dee38c3f17b02ef41.

TEST=ci

Change-Id: I97654b03f0e1147c5c0cd3bade2842f096e2d50a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299120
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-04-27 14:57:58 +00:00
Alexander Aprelev 86d754690a [vm/isolates] Put limit on how many isolates are suspended.
Fixes https://github.com/dart-lang/sdk/issues/52154
TEST=ci

Change-Id: I6f620113232cf8f771dd73be334ace0e385784f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-04-26 22:18:51 +00:00
Alexander Aprelev 4b7de54e03 [vm/regex] Pick a fix for unicode negated range RegExp.
Pick up v8 fix https://chromium-review.googlesource.com/c/v8/v8/+/3802690.

Fixes https://github.com/dart-lang/sdk/issues/52182
TEST=corelib/regexp/regexp_test

Change-Id: I01057ec5c8babdafc06ddeea3db48e14ae7c5357
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298700
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-04-26 19:46:06 +00:00
Alexander Markov 233a7298e0 [vm] Fix assertion failure when taking a tear-off of a constructor with nested function type
TEST=runtime/tests/vm/dart/regress_52179_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52179

Change-Id: I449e2aebe3ffeb78f4f9a213ec40e6892f7a0447
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298660
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-26 17:33:50 +00:00
Ryan Macnak cc3bf609f2 [vm, gc] Avoid suprious race between GC helper thread exit and GC visiting roots.
A sweeper helper thread may be exiting while the scavenge is visiting thread roots. GC helpers have no reusable handle state to clear, so the race is an uninteresting one between null and null.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/52125
Change-Id: Iae68f8a3a938ae20e540b11c172fbc4a50a90a9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298262
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-04-25 22:10:09 +00:00
Polina Cherkasova 4de8a314c4 Update README.md
Closes https://github.com/dart-lang/sdk/pull/52114

GitOrigin-RevId: 1a0abe31e57c60bfeaf5bc857a08b0f6bc3986d2
Change-Id: I837ff4f5fdf9afdbd2cbce3073f87e51a62960c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296701
Commit-Queue: Polina Cherkasova <polinach@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-04-25 18:50:20 +00:00
Valentin Hăloiu db766b37cb Fix SSL certificate check when hostname is an IP address
Closes https://github.com/dart-lang/sdk/pull/52118

GitOrigin-RevId: 7598354d2ad5baba2ed65177bdff521a637b5b65
Change-Id: I78246e423f6ee090030912576ab8202f0fa60509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296722
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-04-25 16:06:12 +00:00