Commit graph

19868 commits

Author SHA1 Message Date
Alexander Aprelev 46bc947e75 [gardening] Fix gen_snapshot crash on msvc.
Revert change to StringRAII which used to take reference, but was changed to take pointer in 2ead86ab9d

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

Change-Id: I8d8b18e6e9ae3cd07427ee1b37df404d11dcb26e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260402
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2022-09-21 18:16:56 +00:00
Ryan Macnak 1bbb01211d [vm] Fix -Werror=use-after-free in isolate shutdown.
TEST=gcc 12
Change-Id: Ia4aba7b35ee12677799a9aa289a250ae7035ba6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259140
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-21 17:52:01 +00:00
Alexander Markov f9355b1bf2 [vm] Make Address/FieldAddress independent of operand size on arm64
The operand size is dropped from Address/FieldAddress constructors on
arm64. This makes code using Address/FieldAddress less fragile, avoids
repeating size both in the Address/FieldAddress and load/store
instructions, and better aligns arm64 Address/FieldAddress with other
architectures.

TEST=ci

Change-Id: I92d7c5c8f0239333f022deebc0472136018bb0fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260072
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-21 17:12:36 +00:00
Alexander Markov 7f40a291ae [vm] Fix debug/arm64c build
On arm64 Address can assume certain load/store size depending on the
value (alignment) of the offset. This may cause assertion failure

  "runtime/vm/compiler/assembler/assembler_arm64.h: 2750: error: expected: a.log2sz_ == -1 || a.log2sz_ == size".

This change fixes build on arm64c in debug mode by using an unaligned
offset. This is a follow-up to https://dart-review.googlesource.com/c/sdk/+/259920.

TEST=Build on the vm-ffi-android-debug-arm64c bot.

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I2fef8c8b397e85b9092244ae701a5f7b24b8f6eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260062
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-20 18:06:15 +00:00
Vyacheslav Egorov 83ab5d5ca3 [vm] Remove dynamic field unboxing in JIT
Instead apply the same approach as we do in AOT: unbox based on the
static type information. There are no TFA results available in JIT,
but we could still unbox fields when running in sound null-safety.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-linux-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-rollback-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-linux-debug-simriscv64-try,vm-kernel-precomp-linux-debug-simriscv64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try
Change-Id: Ide2e78c6659261ef8d245a4586cf699ea0fbb459
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256211
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-09-20 13:42:45 +00:00
Vyacheslav Egorov da26deb0b4 [vm] Allow enabling timeline in PRODUCT via DART_ENABLE_TIMELINE define
R=kustermann@google.com

TEST=not-needed

Bug: b/245563515
Change-Id: I91d118c4bbe39cc9642dc07567f2fde812f6fe4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260103
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-09-20 10:58:25 +00:00
Alexander Markov ae2cebcee9 [vm] runtimeType for record instances and record type equality
TEST=language/records/simple/runtime_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I031dff68241dfc62ebc3b6350b10ba7d352bab37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259621
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-19 22:05:04 +00:00
Alexander Markov 947ab596b2 [vm] Null-initialize new record objects
TEST=co19/LanguageFeatures/Subtyping/dynamic/generated/records_arguments_binding_A03_t03
Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I5528a428f4dd49768732b1a8c440423f472e8923
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259920
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-19 20:58:01 +00:00
Derek Xu 99546781f4 [VM] Factor out helper functions related to isolate IDs
Adds the helper functions HasIsolateId(), HasIsolateGroupId(),
GetFormattedIsolateId(), and GetFormattedIsolateGroupId() to
timeline.h

The Perfetto recorder that will be added in a future CL will make use of
these.

TEST=ci

Change-Id: I50e234d9c2cc551ae9fbad7e92fc6e019213e264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259220
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-09-19 19:46:01 +00:00
Alexander Markov d6b3b8a6be [vm] Initial vm-service support for records
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49724
Change-Id: I8012390db004d3b9dd52a460a04bce79af3df365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259881
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-19 19:28:02 +00:00
Ahmed Ashour 5fe480b788 Fix typos
Fix #49864

TEST=ci

Change-Id: I9a7e06d604cd0b4f56f2ac229ab3fc9f01cb9d76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-09-16 19:35:00 +00:00
Alexander Markov aa03b81b81 [vm] Initial implementation of record type checks
This change provides baseline implementation of type checks involving
record instances and record types via runtime calls.

TEST=language/records/simple/type_checks_test
Issue: https://github.com/dart-lang/sdk/issues/49719

Change-Id: I2402f3db0a6dadbab477b073ed2b8861d5a172e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259460
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-09-16 18:05:00 +00:00
Alexander Markov a98b8f3db3 [vm] Do not omit field setters if field needs null assertion
In certain cases, VM can omit field setters for static fields as an
optimization. This change makes sure that setters are not omitted
if static field needs a null assertion.

TEST=language/nnbd/null_assertions/parameter_checks_fields_and_setters_test
(Borrowed from https://dart-review.googlesource.com/c/sdk/+/258220.)

Fixes https://github.com/dart-lang/sdk/issues/49940

Change-Id: I370bff7ad2d9dddb38c6c1b481684fdda09636ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258940
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-16 16:55:10 +00:00
Ryan Macnak 596a982286 [vm] Initialize DartInitializationState in a way MSAN will accept.
TEST=msan
Change-Id: I33cf5c340ed89ce14141282e9a743acc6803f14b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259061
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-09-14 17:38:29 +00:00
asiva 3cdeb58c98 [VM/Runtime] - Use 'const' qualifier for CObject typed data
Addresses https://github.com/dart-lang/sdk/issues/49827

TEST=ci

Change-Id: I525cc27d0bf01945d4f700f48355a3f17e297007
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256602
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-09-13 22:38:22 +00:00
Brian Quinlan 2ead86ab9d Implement anonymous pipes and the ability to transmit them between processes using Unix Domain Sockets.
Change-Id: I9c9f4ec0e99075a29c6f4d97c503e759134eb094
TESTED=Unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257804
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-09-13 21:16:28 +00:00
Alexander Markov e36a39437c [vm] Record field access operations
TEST=language/records/simple/literals_and_field_access_test
TEST=language/records/simple/constants_and_field_access_test
TEST=language/record_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I727b6ced0a70fa4f6513cb7bacce5796404e514c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257924
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 23:16:26 +00:00
Alexander Markov 3cc320d5c8 [vm] Record constants
TEST=language/record_literal_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ia24fb1178c4a19761fea65c5c0cc9a0137226e45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-12 23:12:37 +00:00
Alexander Markov 3ec7cf9c34 [vm] Record literals
TEST=language/record_literal_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I287586c0adb19fe401d76c7a586133a1fe9f1d1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257264
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 23:08:17 +00:00
Alexander Markov c94103ae05 [vm] Initial implementation of record instances
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I82ba571d1935d616fe3d4d6d579e59eb57d65a43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256804
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 22:41:57 +00:00
Alexander Markov 9a023aeae9 [vm] Initial implementation of record types
TEST=language/record_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ib2100c23513395c9fa9c541320eacbb33a2a119e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256802
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-12 22:40:57 +00:00
Ryan Macnak 8c577c420c [vm] Add unmodifiable typed data as a type that can be sent with Dart_PostCObject.
Cf. 938a2c81d2

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/49810
Bug: https://github.com/dart-lang/sdk/issues/49825
Change-Id: I8d4a574f12458e88b589d5ee02c68b1f436fb964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257925
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-12 19:45:12 +00:00
Vyacheslav Egorov 912577baec [vm] Follow up to 4a4eedd860
* Avoid calling memmove(dst, nullptr, 0) as this is flagged by UBSAN.
* Avoid hitting a bug[1] in the linker: LLD's identical code folding
(ICF) happens to replace RecordCoverageInstr::DebugName() with
DispatchTable::LargestSmallOffset() because they happen to contain
the same machine code, ICF fails to accomodate that DebugName also
contains a relocation to constant string. To avoid this we simply
eliminate LargestSmallOffset and replace it with a constant. Same for
OriginElement.

TEST=manually tested previously failing tests

[1]: reported https://github.com/llvm/llvm-project/issues/57693

Change-Id: I38637df6475c7670081b7af0a2de75ca37f6f07c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258801
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-09-12 12:33:57 +00:00
Vyacheslav Egorov 4a4eedd860 [vm] Clean up ClassTable
* Merge ClassTable and SharedClassTable back together;
* Simplify handling of multiple arrays growing in sync;
* Refactor how reload deals with ClassTable.

The last change is the most important because it makes it
much easier to reason about the code. We move away from
copying bits and pieces of the class table and shared
class table into reload contexts.

Having two class table fields in the isolate group makes
it easier to reason about. One field contains program
class table (one modified by kernel loader and accessed
by various program structure cid lookups) and heap
walk class table (used by GC visitors). Normally these
two fields point to the same class table, but during
hot reload we temporary split them apart: original
class table is kept as a heap walk class table, while
program class table is replaced by a clone and updated
by reload.

If reload succeeds we drop original class table and
set program class table as heap walk one.

If reload fails we drop the program class table and
restore original one from heap walk table.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-linux-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-rollback-linux-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-asan-linux-release-x64-try
Change-Id: I8b66259fcc474dea7dd2af063e4772df99be06c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258361
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-10 15:12:35 +00:00
Ryan Macnak 79afcf9c7d [vm] Add Dart_SetTimelineRecorderCallback.
TEST=ci
Bug: b/245563515
Change-Id: I5f8ada1854be9de5bf08f4492c3166826722dbf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258180
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-09-09 17:21:44 +00:00
Alexander Markov 438e0ebb35 [vm] Throw error from external functions even if they have a body
TEST=language/constructor/external_constructor_test
Fixes https://github.com/dart-lang/sdk/issues/49912
Fixes https://github.com/dart-lang/sdk/issues/28565

Change-Id: If01fd39c3195afe059da46bf26ab5bcf158933a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258281
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-09 14:18:34 +00:00
Aske Simon Christensen f2bc59738c Rename the VM's internal hash set classes
Rename `_CompactLinkedHashSet` to `_InternalLinkedHashSet` and
`_CompactImmutableLinkedHashSet` to `_InternalImmutableLinkedHashSet`
to make the names consistent with the corresponding `Map` class names
and to distinguish them from the non-VM-specific hash maps and sets,
which are generally named starting with `_Compact`.

Tested: ci
Change-Id: Ic1ebc44ba8beba34ceab382a4edddc6624fe3fb3
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258002
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-09-09 14:04:34 +00:00
Aske Simon Christensen bab5cfbe74 Add more types to the VM's internal compact hash structures.
This gets rid of some occurrences of `dynamic` and makes the
associated implicit conversions explicit.

Based on https://dart-review.googlesource.com/c/sdk/+/237582

Tested: ci
Change-Id: I7faeffab395c916800b29ea7e56bd3f7d15aac54
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258242
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-09 08:38:36 +00:00
Alexander Aprelev 51a8c5ccd9 [vm/redundant_stores] Clean up liveness update for MayThrow and HasSideEffects instructions.
Ensure that instructions that may throw and also have unknown side effects still load from all places.
Also since this optimization concerns AOT only, instructions that don't deopt but may throw(and don't have unknown side effects), still only load escaping stores.

Follow-up to 88fc8b65d2.
TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/49657
Change-Id: I55b1347badcd74b4c334bb7b37571e91ebb310a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258440
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-09-08 22:34:53 +00:00
Ryan Macnak e5fc6d652b [vm] Don't pass and copy unused category string when recording timeline events.
TEST=ci
Change-Id: I53b60a977c2b33d29a0ca685120044ba208d3ae4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258321
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-08 22:02:46 +00:00
Alexander Aprelev 88fc8b65d2 [vm/aot/redundancy_elimination] Ensure that MayThrow instructions don't expose non-escaping(non-aliased) allocations.
Bug: https://github.com/dart-lang/sdk/issues/49657
TEST=LoadOptimizer_RedundantStoreAOT
Change-Id: I3f2c59b94b9c1043dd5d9509ae10fc6dc22e3515
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257802
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-09-08 17:12:23 +00:00
Alexander Markov f38a2804a3 [vm/compiler] Fix computation of ParameterInstr type in a catch block
In order to compute type, ParameterInstr::ComputeType() uses
environment index to get a LocalVariable from LocalScope,
assuming that environment index matches a variable index in the scope.
This is only true for direct parameters (which are not copied in
prologue).

This change limits use of LocalVariable type for ParameterInstr
corresponding to direct parameters. Note that it only affects
Parameter instructions used in catch block entries, as
ParameterInstr in function entry always corresponds to a direct
parameter.

TEST=runtime/tests/vm/dart/regress_flutter110715_il_test.dart
Fixes https://github.com/flutter/flutter/issues/110715

Change-Id: I68d423860928d7e65143844522e3006d9ccfcf66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257441
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-09-07 17:58:10 +00:00
Derek Xu c9f0120220 Reland "[VM - Runtime] Return nullptr when allocating a FinalizablePersistentHandle fails"
This is a reland of commit b8d4e24338

How the failures were fixed:
1. My ExternalSizeLimit test crashed on msvc because I was using a
0-sized array. I have now changed that array to have size 1.
2. My ExternalSizeLimit test crashed on x64c because
ExternalTypedData::MaxElements(kExternalTypedDataUint8ArrayCid) is much
smaller than kMaxAddrSpaceMB/4 on x64c. I now call
ExternalTypedData::New() with a length argument of 1, and just pretend
that the external allocations are larger when calling
FinalizablePersistentHandle::New().

Original change's description:
> [VM - Runtime] Return nullptr when allocating a
> FinalizablePersistentHandle fails
>
> This CL adds checks to ensure that the tracked total size of
> externally allocated objects never exceeds the amount of memory on the
> system. When the limit is exceeded, then
> FinalizablePersistentHandle::New() will return nullptr.
>
> Resolves https://github.com/dart-lang/sdk/issues/49332
>
> TEST=ci
>
> Change-Id: Ib6cc92325b1d5efcb2965098fa45cfecc90995e3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256201
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TEST=I ran the tryjobs for the configurations that broke CI.

Change-Id: I813aa74667c59a4dbec7f53440ca8d0bf21256ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256973
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-09-06 15:13:16 +00:00
Brian Quinlan 270350d0bd Add support for sending file descriptors over unix domain sockets on macOS
Change-Id: Ifce87fdd100f193b956de98e293e2d6859bdb95b
TEST=unix_socket_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256783
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-09-01 20:36:12 +00:00
Matej Knopp c50869a8cb [VM] trigger message notify callback for each non-service message that came in while message handler was paused.
Closes https://github.com/dart-lang/sdk/pull/49708

TEST=N/A

GitOrigin-RevId: a2a5c2c487daaeb8bd58135e3a011c8e3f1f845e
Change-Id: I9eae4079cdffdb8cd4a07018cfc6efb80a477a2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255809
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-01 16:17:13 +00:00
Ryan Macnak a2d5419f73 Revert "[VM - Runtime] Return nullptr when allocating a FinalizablePersistentHandle fails"
This reverts commit b8d4e24338.

Reason for revert: breaks msvc, msan, x64c builds

Original change's description:
> [VM - Runtime] Return nullptr when allocating a FinalizablePersistentHandle fails
>
> This CL adds checks to ensure that the tracked total size of externally
> allocated objects never exceeds the amount of memory on the system. When
> the limit is exceeded, then FinalizablePersistentHandle::New() will
> return nullptr.
>
> Resolves https://github.com/dart-lang/sdk/issues/49332
>
> TEST=ci
>
> Change-Id: Ib6cc92325b1d5efcb2965098fa45cfecc90995e3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256201
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,asiva@google.com,dnfield@google.com,derekx@google.com

Change-Id: I934bfbf5dc2e8e2ead5c74fe6b1d84e7b311788c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256972
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-08-31 16:41:59 +00:00
Ryan Macnak 3f4db67730 [vm] Avoid pauses from uninterruptible WeakTable::Rehash().
TEST=ci
Change-Id: I39f59931b0607542a76e4b1c64a3126dbd055b74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247622
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-31 16:24:09 +00:00
Derek Xu b8d4e24338 [VM - Runtime] Return nullptr when allocating a FinalizablePersistentHandle fails
This CL adds checks to ensure that the tracked total size of externally
allocated objects never exceeds the amount of memory on the system. When
the limit is exceeded, then FinalizablePersistentHandle::New() will
return nullptr.

Resolves https://github.com/dart-lang/sdk/issues/49332

TEST=ci

Change-Id: Ib6cc92325b1d5efcb2965098fa45cfecc90995e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256201
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-08-30 18:51:59 +00:00
Ryan Macnak 0f96506a45 [vm] Clarify that the Dart_MessageNotifyCallback mechanism notifies once per message.
TEST=docs only
Change-Id: I40561595ecc8075f2f50b7c3dcc32f081d8ac85b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256649
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-29 20:32:35 +00:00
Brian Quinlan 8c49f519ce Generate an error when starting Processes on iOS
Bug: https://github.com/dart-lang/sdk/issues/49650
Change-Id: I4fc6ab5fc964eabe45851e7a72abf0db92e2b2f2
TEST=manual :-(
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254981
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-08-29 17:14:36 +00:00
Alexander Aprelev 1943645086 [vm/redundant_stores] Remove redundant initializing stores in AOT.
Fixes https://github.com/dart-lang/sdk/issues/49657
TEST=LoadOptimizer_RedundantInitializingStoreAOT

Change-Id: I9ba8cd8afef428fc84abb16cb98883debb485f25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256425
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-26 20:34:31 +00:00
Alexander Markov a7f7c0c5ac [vm] Support serialization of FFI callbacks in IL serialization
TEST=tests/ffi/function_callbacks_test.dart
TEST=Manual run of vm-kernel-precomp-linux-debug-x64-try with --test_il_serialization enabled.

Issue: https://github.com/dart-lang/sdk/issues/43299
Change-Id: Ia57021d9091e8a80de3645cb4723ebdbb5a3d33d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256371
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-08-26 17:37:21 +00:00
Emmanuel Pellereau 0af5c23e6c Revert "[vm] Cleanup unused code in ClosureFunctionsCache"
This reverts commit 4c1235caab.

Reason for revert: breaks google3 (b/243921378)

Original change's description:
> [vm] Cleanup unused code in ClosureFunctionsCache
>
> TEST=ci
>
> Change-Id: Ia6f24545c7e2d5b0df81cab52585d17556b36c16
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256363
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Auto-Submit: Alexander Markov <alexmarkov@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com

Change-Id: Ie6d6fe1e99b52e2530e3e3edcb455208aea13daa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256500
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2022-08-26 14:31:12 +00:00
Martin Kustermann 5c7e561a81 [gardening] Fix StoreReleaseLoadAcquire tests in tsan
In tsan mode, the load-acquire/store-release assembler implementation
will make a runtime call to let TSAN know about the operation.

In order to perform the runtime call the THR register needs to be
populated, which it wasn't.

TEST=Fixes crashing vm/cc/StoreReleaseLoadAcquire tests in tsan mode

Change-Id: I1f45fee9c8e40b8069bf32b13caa97a02f13a6a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256261
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-08-26 10:02:51 +00:00
Ryan Macnak 782d851e3a [vm] Appease UBSAN for ARM64 and RV64.
TEST=ubsan
Change-Id: I1297e9096875361cd8a4c302d128395e372c7b80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256244
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-25 17:15:33 +00:00
Alexander Markov 4c1235caab [vm] Cleanup unused code in ClosureFunctionsCache
TEST=ci

Change-Id: Ia6f24545c7e2d5b0df81cab52585d17556b36c16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256363
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2022-08-25 16:57:15 +00:00
Tess Strickland 0a4cb4d43e [pkg/native_stack_traces] Add support for MacOS universal binaries.
In addition to adding a parser for the universal binary format, this
also requires major reworks to handle files that contain different
DWARF information for different architectures, and how to pass the
architecture down to where it's needed.

Also fix dSYM handling: instead of assuming the name of the MachO file
corresponds exactly to the basename of the dSYM with the extension
stripped, just look for the single file within the
Contents/Resources/DWARF directory.

Also add `unrecognized` enum entries for DW_TAG, DW_AT, and DW_FORM
values that aren't handled.

Issue: https://github.com/flutter/flutter/pull/101586
Change-Id: Ief5edc275ccd1192669252140d128136cd2bed26
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-nnbd-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252821
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-08-25 13:27:24 +00:00
Chloe Stefantsova ddff459c7f [cfe] Add RecordType, RecordLiteral, and associated nodes
TEST=Covered by upcoming language and co19 tests.

Change-Id: Ibe8ecfb7f854adce5646125f6909066e27424665
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256066
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-08-25 10:33:35 +00:00
Ryan Macnak 39a671782b [vm] Don't run DFE with a low optimization threshold in profiler tests.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/49795
Change-Id: Iebe6b5c67b2bbd65399b25166f64392a15c7cc76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256241
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-24 19:49:59 +00:00
Liam Appelbe 00f032a641 [ VM / Service ] Add isolateGroupId to IsolateRef and Isolate
This will reduce the number of RPCs we need to do in package:coverage.

Benchmarked on a bunch of flutter test suites, and it halved the time
spent gathering coverage, bringing package:coverage's performance in
line with flutter's custom coverage collector. This unblocks migrating
flutter test to package:coverage.

Bug: https://github.com/flutter/flutter/issues/108313
Change-Id: I27651c7ce356d8b20c9c88444ad25d7677795a6d
TEST=Updated existing tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255720
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-08-24 18:40:49 +00:00