Commit graph

19986 commits

Author SHA1 Message Date
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
Alexander Aprelev 992672b549 [gardening] Fix gcc bot - add suggested parenthesis around '&&' within '||'
Broken gcc bot https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/vm-kernel-gcc-linux/366/overview

TEST=gcc bot

Change-Id: If93047686597d1e822b213a765ee3679f9d0d8b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256219
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-24 17:34:31 +00:00
Alexander Aprelev 33846f3678 [io/file] Add exclusive optional parameter to File.create, createSync.
TEST=standalone/io/file_create_test

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

Change-Id: I0b1bdc889caf5801570d7ac9e7b6694264cd6565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255482
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-08-24 17:09:49 +00:00
Martin Kustermann f73f25edab Revert to clang toolchain that was rolled in March
This reverts commit fef426ac0b
  This reverts commit e9f629f607
  This reverts commit 413f60a8b6

Reason for revert: With newer clang toolchain for MachOS, the produced
MachO binaries (e.g. `dartaotruntime`) can no longer be signed with
`codesign` on older MacOS versions (before MacOS 12).

We will report this breaking change to fuchsia-clang team and revert
to older (working) clang in the meantime to unblock releases.

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

Tested: ci
Co-authored-by: Martin Kustermann <kustermann@google.com>
Change-Id: I0d4fa6617df2908c4af31e102f5faf9e3ea1df95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256208
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-08-24 16:56:19 +00:00
Gabriel Terwesten 73b7d0c40a Reland "Reland "[vm/compiler] Optimize switch statements""
This is a reland of commit e2d6cb69fb

Original change's description:
> Reland "[vm/compiler] Optimize switch statements"
>
> This is a reland of commit f5228127f8
>
> Original change's description:
> > [vm/compiler] Optimize switch statements
> >
> > Switch statements that either contain only integers or only enum values of the same type can be optimized.
> >
> > Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.
> >
> > TEST=runtime/test/vm/dart{,_2}/optimized_switch
> > TEST=tests/language{,_2}/switch
> >
> > Fixes: https://github.com/dart-lang/sdk/issues/49585
> >
> > Co-authored-by: Gabriel Terwesten gabriel@terwesten.net
> >
> > Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
> > Reviewed-by: Alexander Markov <alexmarkov@google.com>
> > Commit-Queue: Alexander Markov <alexmarkov@google.com>
>
> TEST=runtime/test/vm/dart{,_2}/optimized_switch
> TEST=tests/language{,_2}/switch
>
> Change-Id: Ie96e5ff41dce33e2425ba9ad15ecd931d09bec6e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255700
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TEST=runtime/test/vm/dart{,_2}/optimized_switch
TEST=tests/language{,_2}/switch

Change-Id: I56f8d25a88bb856115550c5da3f02c80c7547802
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256180
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-23 22:11:50 +00:00
Ryan Macnak 938a2c81d2 [vm] Add Dart_NewUnmodifiableExternalTypedDataWithFinalizer.
This foregoes the optimization of removing CheckWritable if the unmodifiable views are not used from Dart code.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/49784
Change-Id: I18f3c36437ef136daf875358278caca4e3e0faa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255816
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-23 16:36:10 +00:00
Alexander Aprelev 4c498a48c3 [vm/deferred] Restore relative calls for allocation stubs.
Ensure all allocation stubs go into the root unit.

Fixes dartbug.com/48330
TEST=ci

Change-Id: I06dd7ec5b948783b9e32a32168aabfbb737ad078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256027
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-23 16:28:46 +00:00
Lasse R.H. Nielsen 571f43b004 Change : to = for default values in runtime/.
TEST=No functional changes, so no tests changed.

Change-Id: I74e9f144323ce0092f67a95eea67dda5f8868500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256122
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-08-23 13:53:42 +00:00
Chris Evans 7962f8a119 Updates to analyze_snapshot tool
- format fixes for readme and build descriptions
- added pretty print option for tool
- changed parsing of class_table to discover library objects
  - JSON output format changes
- defines to accurately mirror platform compatibility
- other small fixes
TEST=ci
Change-Id: I3f27f6fa48ce6111d94c5a88d57fa7bf7abc210c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252661
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2022-08-23 12:18:00 +00:00
William Hesse 97dbbb2b90 Revert "Reland "[vm/compiler] Optimize switch statements""
This reverts commit e2d6cb69fb.

Reason for revert: Reload mode crashes on switch statements

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

Original change's description:
> Reland "[vm/compiler] Optimize switch statements"
>
> This is a reland of commit f5228127f8
>
> Original change's description:
> > [vm/compiler] Optimize switch statements
> >
> > Switch statements that either contain only integers or only enum values of the same type can be optimized.
> >
> > Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.
> >
> > TEST=runtime/test/vm/dart{,_2}/optimized_switch
> > TEST=tests/language{,_2}/switch
> >
> > Fixes: https://github.com/dart-lang/sdk/issues/49585
> >
> > Co-authored-by: Gabriel Terwesten gabriel@terwesten.net
> >
> > Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
> > Reviewed-by: Alexander Markov <alexmarkov@google.com>
> > Commit-Queue: Alexander Markov <alexmarkov@google.com>
>
> TEST=runtime/test/vm/dart{,_2}/optimized_switch
> TEST=tests/language{,_2}/switch
>
> Change-Id: Ie96e5ff41dce33e2425ba9ad15ecd931d09bec6e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255700
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,alexmarkov@google.com,gabriel@terwesten.net

Change-Id: Iac9267211ceb2029361167cb28224d6cd44dc3c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256100
Commit-Queue: William Hesse <whesse@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-08-23 10:43:50 +00:00
Martin Kustermann 3669086a40 [vm] Fix field index information in heap snapshots in AOT
In AOT we can have unboxed fields that will not be visited by GC
visitors and as such are also not reported as <obj>.references when
producing heap snapshots.

Though the heapsnapshot's <class>.fields will contain entries
for unboxed fields, which causes the fields index calculation to be
incorrect.

This can cause various confusing things, e.g. incorrectly caluclated
retaining paths, since the <class>.fields.index doesn't match the
index in <obj>.references.

To fix this this CL will change the visiting code to emit dummy
references for unboxed fields.

The written test uncovered a few other issues:

  - report type_arguments and native_fields in <class>.fields
    => the visitors already visit those fields

  - fix `Class::next_{host,target}_field_offset` for classes
    with native fields
    => this will also shrink size of `NativeWrapperClass` subclasses

  - ensure classes with vm-defined layout are finalized
    => we assume objects should only exist in heap if their class
       is finalized

  - fix `FfiNativeFunction` type_argument offset

  - fixes for object fields list
    => add missing entries, fix existing entries

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

TEST=vm/dart{,_2}/heap_snapshot_regress_49711_test

Change-Id: I8e25680b2c0c8c49caafbb8da57b0b6419e89c4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255814
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-23 05:17:49 +00:00
Ryan Macnak fabbac4afd [vm] Fix -Werror=format-overflow when building with gcc.
TEST=ci
Change-Id: I9bb9d2658ab81322a07ee2892ddc9ac82332424e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256024
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-08-22 22:10:49 +00:00
Ryan Macnak ae57447189 [vm] Simplify creating ByteData from the embedding API.
TEST=ci
Change-Id: I0d5093c0eee6ab477e73a368179aba9a23d9600f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255817
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-22 17:50:45 +00:00
Gabriel Terwesten e2d6cb69fb Reland "[vm/compiler] Optimize switch statements"
This is a reland of commit f5228127f8

Original change's description:
> [vm/compiler] Optimize switch statements
>
> Switch statements that either contain only integers or only enum values of the same type can be optimized.
>
> Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.
>
> TEST=runtime/test/vm/dart{,_2}/optimized_switch
> TEST=tests/language{,_2}/switch
>
> Fixes: https://github.com/dart-lang/sdk/issues/49585
>
> Co-authored-by: Gabriel Terwesten gabriel@terwesten.net
>
> Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TEST=runtime/test/vm/dart{,_2}/optimized_switch
TEST=tests/language{,_2}/switch

Change-Id: Ie96e5ff41dce33e2425ba9ad15ecd931d09bec6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255700
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-22 15:09:17 +00:00
Alexander Markov 5f985eb3e6 Reland "[vm/compiler] Initial implementation of IL binary serialization"
This is a reland of commit 9700458975

Original change's description:
> [vm/compiler] Initial implementation of IL binary serialization
>
> This change adds binary serialization/deserialization of flow graphs.
> It supports all IL instructions and certain objects which can be
> referenced from IL instructions. IL binary serialization is a useful
> machanism which would allow us to split compilation into multiple parts
> in order to parallelize AOT compilation.
>
> The program structure (libraries/classes/functions/fields) is not
> serialized. It is assumed that reader and writer use the same
> program structure.
>
> Caveats:
> * FFI callbacks are not supported yet.
> * Closure functions are not re-created when reading flow graph.
> * Flow graph should be in SSA form (unoptimized flow graphs are not
>   supported).
> * JIT mode is not supported (serializer currently assumes lazy
>   linking of native methods and empty ICData).
>
> In order to test IL serialization, --test_il_serialization VM option is
> added to serialize and deserialize flow graph before generating code.

TEST=vm/dart/splay_test now runs with --test_il_serialization.
TEST=Manual run of vm-kernel-precomp-linux-debug-x64-try with
--test_il_serialization enabled (only ffi tests failed).
TEST=gcc build on dart-sdk-linux-try bot.

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

> Change-Id: I7bbfd9e3a301e00c9cfbffa06b8f1f6c78a78470
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254941
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

Change-Id: I64ff9747f761496a096371e490ef070a14023256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255840
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-22 15:07:47 +00:00
Johnni Winther dcaebaa793 [cfe] Add Field.isEnumElement
This adds the flag `isEnumElement` to the `Field` node and uses it
to recognize enum elements for the exhaustiveness computation on
switch statements.

Closes #49697

TEST=pkg/front_end/testcases/general/issue49697/main.dart

Change-Id: I21852f3b063329e043639c825054f538c8ed6536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255808
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-08-22 05:44:57 +00:00
Ryan Macnak b3a569ea8d [vm] Prevent Dart_NewSendPort from bypassing the arbitrary object checks.
In particular this affects SendPorts from dart:io's IOService and Flutter's IsolateNameServer.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/109248
Change-Id: I28ed3073a6fe5583729637ae7914d914edc709e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255261
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-19 18:10:15 +00:00
Martin Kustermann d68ca2cc57 [vm] Avoid repeating fields in heapsnapshot class descriptions
Fixes https://github.com/dart-lang/sdk/issues/49710

TEST=tests/vm/dart{,_2}/heap_snapshot_regress_49710_test.dart

Change-Id: Ib2c31a582381dcfaf12739b9d0c7e28d98063791
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255813
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-19 16:51:45 +00:00
Alexander Markov 17311c94d1 Revert "[vm/compiler] Initial implementation of IL binary serialization"
This reverts commit 9700458975.

Reason for revert: breaks Dart SDK build using gcc and dart-sdk-linux-main bot.

Original change's description:
> [vm/compiler] Initial implementation of IL binary serialization
>
> This change adds binary serialization/deserialization of flow graphs.
> It supports all IL instructions and certain objects which can be
> referenced from IL instructions. IL binary serialization is a useful
> machanism which would allow us to split compilation into multiple parts
> in order to parallelize AOT compilation.
>
> The program structure (libraries/classes/functions/fields) is not
> serialized. It is assumed that reader and writer use the same
> program structure.
>
> Caveats:
> * FFI callbacks are not supported yet.
> * Closure functions are not re-created when reading flow graph.
> * Flow graph should be in SSA form (unoptimized flow graphs are not
>   supported).
> * JIT mode is not supported (serializer currently assumes lazy
>   linking of native methods and empty ICData).
>
> In order to test IL serialization, --test_il_serialization VM option is
> added to serialize and deserialize flow graph before generating code.
>
> TEST=vm/dart/splay_test now runs with --test_il_serialization.
>
> TEST=Manual run of vm-kernel-precomp-linux-debug-x64-try with
> --test_il_serialization enabled (only ffi tests failed).
>
> Issue: https://github.com/dart-lang/sdk/issues/43299
> Change-Id: I7bbfd9e3a301e00c9cfbffa06b8f1f6c78a78470
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254941
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

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

Change-Id: Iae4e4868f183815a8fc3cd79597141b3896e23d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/43299
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255780
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-18 20:46:34 +00:00
Ryan Macnak 4a621f5c48 [vm, compiler] Don't clobber R18 during CCallInstr on Fuchsia ARM64.
Cf. 5380fa5d40.

TEST=local
Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=105336
Change-Id: Id025e40e6153570ee88f2daa47be6f12ff9b5822
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255548
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-18 20:28:26 +00:00
Alexander Markov 9700458975 [vm/compiler] Initial implementation of IL binary serialization
This change adds binary serialization/deserialization of flow graphs.
It supports all IL instructions and certain objects which can be
referenced from IL instructions. IL binary serialization is a useful
machanism which would allow us to split compilation into multiple parts
in order to parallelize AOT compilation.

The program structure (libraries/classes/functions/fields) is not
serialized. It is assumed that reader and writer use the same
program structure.

Caveats:
* FFI callbacks are not supported yet.
* Closure functions are not re-created when reading flow graph.
* Flow graph should be in SSA form (unoptimized flow graphs are not
  supported).
* JIT mode is not supported (serializer currently assumes lazy
  linking of native methods and empty ICData).

In order to test IL serialization, --test_il_serialization VM option is
added to serialize and deserialize flow graph before generating code.

TEST=vm/dart/splay_test now runs with --test_il_serialization.

TEST=Manual run of vm-kernel-precomp-linux-debug-x64-try with
--test_il_serialization enabled (only ffi tests failed).

Issue: https://github.com/dart-lang/sdk/issues/43299
Change-Id: I7bbfd9e3a301e00c9cfbffa06b8f1f6c78a78470
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254941
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-08-18 16:53:24 +00:00
Konstantin Shcheglov 5a9e007a5a Use DartType.element2 instead of 'element'.
We want to replace it in https://dart-review.googlesource.com/c/sdk/+/243164

Change-Id: If28020581b3e511ceb2bee59cf30d38be7f1308e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255584
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-18 15:56:14 +00:00
Ilya Yanok 9299aa216e Revert "[vm/compiler] Optimize switch statements"
This reverts commit f5228127f8.

Reason for revert: causes a VM crash, see b/242964932 (the test is also publicly available at 93fb0da38a/drift_dev/test/analyzer/sql_queries/query_analyzer_test.dart (L8))

Original change's description:
> [vm/compiler] Optimize switch statements
>
> Switch statements that either contain only integers or only enum values of the same type can be optimized.
>
> Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.
>
> TEST=runtime/test/vm/dart{,_2}/optimized_switch
> TEST=tests/language{,_2}/switch
>
> Fixes: https://github.com/dart-lang/sdk/issues/49585
>
> Co-authored-by: Gabriel Terwesten gabriel@terwesten.net
>
> Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,alexmarkov@google.com,gabriel@terwesten.net

Change-Id: I8c673ea70e7ed91dffb3674e7dcb4aaa0611e978
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255258
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-08-18 10:10:54 +00:00
Chloe Stefantsova 1611fe6f45 [cfe] Separate out IntersectionType from TypeParameterType
TEST=Covered by existing tests

Change-Id: Ie7b99b1c109edff5198cfbf5d22e1cfb1dc130d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253665
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-08-18 08:47:29 +00:00
Alexander Markov c9bcbd3474 [vm/compiler] Reduce flow graph checks for common constants
This change disables certain debug mode checks for commonly used
constants which were enabled in https://dart-review.googlesource.com/c/sdk/+/253840.

It turns out they affect compilation time considerably in debug mode,
especially if low optimization threshold is used and kernel service
snapshot is not used (for example in debug/ia32 mode).

Time of running standalone_2/regress31114_test in debug/ia32 mode:
78s -> 34s.

TEST=CQ + a few debug bots
Fixes https://github.com/dart-lang/sdk/issues/49676

Change-Id: I9e09d6e5b9c1c86d9026a924a367301e0dac85b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255500
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-08-18 03:22:53 +00:00
Gabriel Terwesten f5228127f8 [vm/compiler] Optimize switch statements
Switch statements that either contain only integers or only enum values of the same type can be optimized.

Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.

TEST=runtime/test/vm/dart{,_2}/optimized_switch
TEST=tests/language{,_2}/switch

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

Co-authored-by: Gabriel Terwesten gabriel@terwesten.net

Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-17 18:00:43 +00:00
Tess Strickland 00bd7ff339 [vm/test] Remove checked-in binaries from MachO test.
Instead of using checked-in binaries in snapshot_utils_test.cc,
write out the binaries manually and check the written binaries.

TEST=vm/cc/CanDetectMachOFiles

Issue: https://github.com/dart-lang/.allstar/issues/159

Change-Id: I024ecac2084cfaef6bf8fe2a7cecceb9ae5d8de9
Cq-Include-Trybots: luci.dart.try:vm-kernel-mac-release-arm64-try,vm-kernel-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255460
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-08-17 16:18:35 +00:00
Ryan Macnak 8e2766c285 [vm] Provide more detailed errors when message deserialization cannot find a program element serialized by name.
TEST=local
Bug: https://github.com/flutter/flutter/issues/109248
Change-Id: Ifda7c08cf88c37a9895839858a18badf994bf72c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255220
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-16 16:46:47 +00:00
Ryan Macnak 234128e8d3 Revert "[vm] Allocate old in object-graph-copy's slow path."
This reverts commit d0a60d67c9.

Reason for revert: Slow path transition seems to occur earlier than I expected

Original change's description:
> [vm] Allocate old in object-graph-copy's slow path.
>
> If we have reached the slow path, the message's subgraph is very likely to be large.
>
> TEST=ci
> Change-Id: Ie8a18c78936ae8a53f30dd61da3650e684c09dfa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249081
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I61faddd37e424a742427ae7c270cdb8b0a13c418
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255300
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-16 16:23:47 +00:00
Ryan Macnak a8a94dcc4d [vm] Fix leak of forwarding tables when isolate message sending fails.
TEST=ci
Change-Id: I644834dcb49f197390dd71468b42b74c68a3cdb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255180
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-16 16:19:07 +00:00
Daco Harkes 1ae40d5ebf [vm/ffi] Add Fuchsia ABI unit tests
Adds the Fuchsia ABI to the ABI unit tests.

Adds an ABI test for the FFI callback on who's return the stack is/gets
corrupted from bug:
https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=105336

TEST=tools/test.py ffi_unit

Change-Id: I3c9bb9941e4883384dfba787bb6dacb4c8cdc141
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255122
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-08-16 12:17:26 +00:00
Alexander Aprelev 0914835773 [vm/inliner] Tweak inlining heuristic, improve List.of inlining.
Builds on top of https://dart-review.googlesource.com/c/sdk/+/228660, introduces vm:vm:always-consider-inlining that tell inliner not to give up inlining of a function.

HashMap constructor got prefer-inline pragma to accommodate shift in inlining away from where it used to be inlined due to large size of inlined HashMap, greater than FLAG_inline_getters_setters_smaller_than heuristic.

Notable performance changes:

JIT (x64)
===
ListCopy.List.of.fixed.100 27.37%
ListCopy.List.of.fixed.2 16.31%

AOT (x64)
===
Empty  -9.978%
InstantiateTypeArgs.Instantiate1  -8.262%
...
ListCopy.List.of.fixed.2 13.73%
ListCopy.spread.num.2 15.51%
ListCopy.List.of.2 15.08%
MapCopy.Map.String.of.Map.100 55.62%
MapCopy.Map.Thing.of.Map.100 56.06%

flutter release
===
flutter_gallery_apk_size (Pixel 2)
-0.0074% (1.0 noise)41809568.00 41812676.00


Addresses https://github.com/dart-lang/sdk/issues/49408

TEST=Inliner_always_consider_inlining, Inliner_List_of_inlined
Change-Id: I7f8fc7cb0ac4a69310c108cf519518c384dc0164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253740
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-15 21:14:36 +00:00
Ben Konyi eff8c305d9 [ Service / Timeline ] Enable Compiler, Dart, and GC timeline streams when --observe is provided
TEST=pkg/vm_service/test_timeline_default_streams_test.dart

Fixes https://github.com/flutter/devtools/issues/3444

Change-Id: I3f772a54a512eb836e3e7279ee8d4d3437473393
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255181
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-08-15 21:02:36 +00:00
Ryan Macnak d0a60d67c9 [vm] Allocate old in object-graph-copy's slow path.
If we have reached the slow path, the message's subgraph is very likely to be large.

TEST=ci
Change-Id: Ie8a18c78936ae8a53f30dd61da3650e684c09dfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249081
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-15 20:32:56 +00:00
Ryan Macnak f32392aada [standalone] Cleanup sorting classes before generating an AppJIT snapshot.
With isolate groups enabled, there is no longer an issue with spawnFunction isolates becoming out-of-sync.

Cf. be9bb43ceb.

TEST=ci
Change-Id: I242a15e132958ade3107c54ce38ea6922e0f5662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254761
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-08-11 20:58:39 +00:00
Ryan Macnak b6a57b7cf9 [vm] Make use of exception helpers.
TEST=ci
Change-Id: Icdfaef665756bc12e25fba58afcd6cd1bde8525a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254760
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-08-11 18:52:22 +00:00
Ryan Macnak c1e67ac84f [vm] Recognize unmodifiable typed data views.
These types now work with Dart_TypedDataAcquireData.

The presence of these types no longer degrades the performance of typed data indexed loads.

The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Change-Id: Iffad865708501acf96db418985cd5a69bd9afa55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-11 18:10:48 +00:00
Ryan Macnak 10bf1cfe58 Revert "[vm] Recognize unmodifiabled typed data views."
This reverts commit d1112d37bd.

Reason for revert: b/242043014

Original change's description:
> [vm] Recognize unmodifiabled typed data views.
>
> These types now work with Dart_TypedDataAcquireData.
>
> The presence of these types no longer degrades the performance of typed data indexed loads.
>
> The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/32028
> Bug: https://github.com/dart-lang/sdk/issues/40924
> Bug: https://github.com/dart-lang/sdk/issues/42785
> Change-Id: I05ac5c9543f6f61ac37533b9efe511254778caed
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253700
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=kustermann@google.com,rmacnak@google.com,askesc@google.com

TEST=ci
Change-Id: I32c1c460fc30c51bc0d42e7cfaafe72bf5630069
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254560
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-10 20:08:22 +00:00
Alexander Markov 6ad3805751 [vm/compiler] Fix type of Parameter in a CatchBlockEntry
Parameter in a CatchBlockEntry may correspond to a late local variable
which was not initialized yet, so its type should correctly state
that it can be sentinel.

TEST=vm/dart/flutter_regress_109261_test
Fixes https://github.com/flutter/flutter/issues/109261

Change-Id: Ia6fbbe4b9963323f84438b3f618437276e51f256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254440
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-10 19:27:38 +00:00
Vyacheslav Egorov afb34fb9e3 [vm] Fix kNumberOfReservedCpuRegisters on ARM64
Instead of using an integer literal use constexpr popcount
function instead.

The misalignment causes an incorrect generation of a call
to a shared write barrier stub for the last allocatable register
on ARM64.

Reported by Lin Zuojian <zuojian.lzj@alibaba-inc.com>

TEST=ci

Change-Id: I69ce32da958573be0ec8967e462f8a378a778a28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254401
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-08-10 18:04:09 +00:00
Alexander Markov 1db5d58b34 [vm/compiler] Prevent allocating instances of abstract instruction classes
Also fix instantiation of abstract UnboxIntegerInstr.

TEST=ci

Change-Id: I1aa67194fba795f2bb5c6f061b027aefeb93b365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254260
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-10 14:15:28 +00:00
Ryan Macnak d1112d37bd [vm] Recognize unmodifiabled typed data views.
These types now work with Dart_TypedDataAcquireData.

The presence of these types no longer degrades the performance of typed data indexed loads.

The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Change-Id: I05ac5c9543f6f61ac37533b9efe511254778caed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253700
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-09 20:57:05 +00:00
Ivan Inozemtsev 3344e06416 Reland "[vm] Require exact operating system match for snapshots with code"
This is a reland of commit 5b144f2ecb

TEST=ci

Original change's description:
> [vm] Require exact operating system match for snapshots with code.
>
> TEST=ci
> Change-Id: Ifb9e673f4aef0d42c2ef058174051ed6ed20b17b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252844
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Brian Quinlan <bquinlan@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

Change-Id: I5d64815a78be571873de85344ae7f8dabf55a91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254203
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-09 15:40:42 +00:00
Alexander Markov 1d985a58cd [vm/compiler] Avoid adding the same ConstantInstr both to GraphEntry and FunctionEntry initial definitions
Each instruction should appear only once in the flow graph.
Before this change a ConstantInstr from initial definitions of
GraphEntry could be also added to initial definitions of FunctionEntry.

This is also a step towards https://github.com/dart-lang/sdk/issues/36894.

TEST=ci

Change-Id: I042258dced99cbf5a908028427da2cb5a8b0d329
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253840
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-09 13:58:52 +00:00
Michael Thomsen c34b72482e Remove deprecated APIs from dart:convert
Contributes to bug: https://github.com/dart-lang/sdk/issues/34233

Change-Id: I443fa14342680b61bf7357d40347427200fea29b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247741
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-08-09 10:21:22 +00:00
Alexander Markov 964c756faa [vm/compiler] Unify VariadicDefinition and VariadicDefinitionWithEmbeddedInputs
The unified base class for instructions with variable number of inputs
now keeps inputs in GrowableArray<Value*> (no indirection, no extra zone
memory allocation).

InputsArray is changed to GrowableArray<Value*> instead of
ZoneGrowableArray and passed as rvalue reference.

TEST=ci (pure refactoring)

Change-Id: I4a6f6835516c118c2b924720bcd8a964858e4368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253820
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-08 15:58:40 +00:00
Martin Kustermann 4539bf6584 [vm] Make heap snapshot writer also visit isolate stacks as roots
Heap snapshots currently produced don't visit isolate stacks. As such
analyzing such snapshots may lead one to conclude there is a lot of
garbage while objects are actually reachable.

=> This CL makes us visit isolate stacks when building heap snapshots.

Furthermore we add a new `VMInternals.writeHeapSnapshotToFile` helper
that can be used to programmatically write snapshots and can be handy
for internal use at times. (We also use this helper in a test)

TEST=vm/dart{,_2}/heap_snapshot_test

Change-Id: I976544b7f6d20863764af9a40bf1ffb3c319bbce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253785
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-06 11:24:28 +00:00
Tess Strickland 24683da915 [vm] Add OS and architecture to non-symbolic stack traces.
Examples of the new line added to non-symbolic stack traces:

os: linux arch: x64 comp: yes sim: no
(Running on linux-x64c)

os: macos arch: arm64 comp: no sim: yes
(Running on mac-simarm64)

This CL also abstracts out the separate hardcoded strings across
the codebase for host and target OS and architecture into
definitions in platform/globals.h to ensure that they stay
in sync across different uses.

TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag

Issue: https://github.com/flutter/flutter/pull/101586
Change-Id: Ifdfea5138dd1003f561da0174e89aebc165bf9b0
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253283
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-08-05 11:53:37 +00:00
Alexander Markov 63e170a242 [vm/compiler] More consistent handling of inputs of IL instructions
This change removes duplicate management of inputs in variadic
IL instructions by introducing VariadicDefinition and
VariadicDefinitionWithEmbeddedInputs base classes.

TemplateInstruction and TemplateDefinition are used in more
places where appropriate.

Number of inputs no longer depends on the values of the inputs
(DropTempsInstr and AllocateObjectInstr).

This change also prepares IL for the future implementation of binary
serialization/deserialization in the following ways:
* Environment now holds Function and not ParsedFunction
  (which are not going to be serialized).
* Instructions no longer keep Zone* pointer (it's redundant).
* NativeCallInstr keeps references to handles instead of pointers.

TEST=ci (pure refactoring)

Change-Id: I932b62c1c207bbf60cddbded8a39b41beabd3e83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253480
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-03 14:49:55 +00:00
Slava Egorov d94a1cd419 Revert "[vm, compiler] Implement unboxed SIMD for RISC-V via lowering."
This reverts commit 460bd7a03a.

Reason for revert: build and layout benchmarks seem to be failing on Golem

Original change's description:
> [vm, compiler] Implement unboxed SIMD for RISC-V via lowering.
>
> TEST=ci
> Change-Id: Ice2ec0847ee43ff9b8c5859ba15dbbeee48ba36e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250943
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

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

Change-Id: I062bc13d0d941fcabf4c67a696fc2be324f0e1c3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253580
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-08-03 10:32:46 +00:00
Tess Strickland d5dd0a5eea "Reland "[vm] Remove warnings about non-standard stack traces."
This is a reland of commit cc9d14d822

TEST=vm/dart{,_2}/causal_stacks/async_throws_stack_lazy_non_symbolic_test

Original change's description:
> [vm] Remove warnings about non-standard stack traces.
>
> The language team has clarified in
> https://github.com/dart-lang/language/issues/1212 that the content of
> stack traces is not specified in a way that is violated by either
> obfuscation or non-symbolic stack traces. Thus, we remove the warnings
> about supposedly standard-violating stack traces.
>
> TEST=No change in actual functionality, so tested manually.
>
> Bug: https://github.com/dart-lang/sdk/issues/43388
> Change-Id: I2c7ac44cf2f9afafa85d902b2783e1173e727264
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249185
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Bug: https://github.com/dart-lang/sdk/issues/43388
Change-Id: I2f99779e391b156ca963be57467b40dbe69f2b76
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253281
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-03 09:51:35 +00:00
Ryan Macnak 460bd7a03a [vm, compiler] Implement unboxed SIMD for RISC-V via lowering.
TEST=ci
Change-Id: Ice2ec0847ee43ff9b8c5859ba15dbbeee48ba36e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250943
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-08-02 20:24:54 +00:00
Ivan Inozemtsev 4324491619 Revert "[vm] Require exact operating system match for snapshots with code."
This reverts commit 5b144f2ecb.

Reason for revert: b/240912656

Original change's description:
> [vm] Require exact operating system match for snapshots with code.
>
> TEST=ci
> Change-Id: Ifb9e673f4aef0d42c2ef058174051ed6ed20b17b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252844
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Brian Quinlan <bquinlan@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Id03a1d741d6dde6a570a91721771da842f2496a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253282
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-08-01 16:32:44 +00:00
Ryan Macnak 4f7bb16cc5 [vm] Add a stub simx64.
This allows building gen_snapshot with host=arm64, target=x64.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/103386
Change-Id: I478cc0917462896de9b598455d2ed68401323b50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252962
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-29 18:11:01 +00:00
Ryan Macnak 355295789e [vm, compiler] Fix CanTriggerGC for LoadFieldInstr and LoadCodeUnitsInstr.
TEST=ci
Change-Id: I233802bfcd24b024e82e370b6d5b8baf44042476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252781
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-28 20:13:40 +00:00
Ryan Macnak 5b144f2ecb [vm] Require exact operating system match for snapshots with code.
TEST=ci
Change-Id: Ifb9e673f4aef0d42c2ef058174051ed6ed20b17b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252844
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-07-28 16:38:40 +00:00
Ryan Macnak fb84b13e55 [vm, compiler] Rename StoreInstanceFieldInstr to StoreFieldInstr to match LoadFieldInstr and GuardFieldXYZInstr.
TEST=ci
Change-Id: I3161cad413f2d7be2bd8269306a51b5ae6a7384d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252780
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-07-27 20:00:49 +00:00
Ryan Macnak c6a1eb1b61 [vm, gc] Very basic RAIL.
Related to https://github.com/dart-lang/sdk/issues/47574

TEST=ci
Change-Id: I2f07be6150b025a301e6e4d10935b606087cdf00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252462
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-27 16:40:38 +00:00
Zach Anderson 3b8817e7fc Revert "[vm/compiler] Add symbols for read-only data when requested."
This reverts commit 286326f834.

Reason for revert: Reverting for the regressions mentioned in https://github.com/flutter/flutter/issues/108378

Original change's description:
> [vm/compiler] Add symbols for read-only data when requested.
>
> Symbols for non-clustered objects in the read-only data section are
> now added to the static symbol tables for unstripped snapshots and
> separate debugging information.
>
> In DEBUG mode, the name for a non-String read-only data object also
> includes the name of the parent object.
>
> TEST=vm/dart{,_2}/readonly_data_symbols
>
> Change-Id: I623b023138aeca0580bc76392882eac5686f8f50
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251104
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I82bdabf07c137fbabe7b4c45bdf23011350c3d87
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252801
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2022-07-27 13:30:28 +00:00
Ryan Macnak 139d9216ad [vm, compiler] Discover the sole implementation of an interface when it is a different class than the interface.
TEST=ci
Change-Id: Ibeb83f1099a9dfdeeaee69814739bff84617c1fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252243
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-26 17:33:37 +00:00
Tess Strickland a174dd7e89 [vm/test] Handle any simulator architectures more generically.
In `use_flag_test_helper.dart`, there is code for SIMARM/SIMAR64,
but now we have SIMRISCV64.

For now, just look for `SIM` in the build directory to determine
whether or not we're running on a simulated architecture, and
disable the assembly part of `use_dwarf_stack_traces_flag_test.dart`
on all simulated architectures instead of just SIMARM/SIMARM64.
(They run fine locally for SIMARM/SIMARM64, but trybots don't
have the buildtools fetched currently as the configuration uses our
own ELF writer to generate snapshots, not an assembler.)

TEST=vm/dart{,2}/use_dwarf_stack_traces_flag

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

Change-Id: I710de16f29a24e6d64a8bce3469da9648ee25def
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simriscv64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252604
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-07-26 13:27:18 +00:00
Aaron Clarke 4448741898 Updated Dart_Post docstring to mention Dart_PostCObject.
fixes https://github.com/dart-lang/sdk/issues/49524

TEST=n/a, documentation

Change-Id: Ia5154e9c2c1d6f6cce46e9bceb49f315cb840bc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252681
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-25 22:55:06 +00:00
Ryan Macnak f9e833416e [vm, ffi] Fail more gracefully when attempting to use FFI on a simulator.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48846
Bug: https://github.com/dart-lang/sdk/issues/49472
Change-Id: I9083d1c4e2ff633d22747f80ce1fed970e2f771a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251849
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-25 19:29:09 +00:00
Ryan Macnak 1ab217ac40 Reland "[vm] Forward dynamic events names to os_signposts as arguments."
Assume the embedder provides static strings for event labels.

TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I40aa4996fed2b1230da64d182e6f172f60480fdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251145
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-25 17:42:49 +00:00
Ryan Macnak 2d00818aef [dartfuzz] Don't try to use FFI on simriscv.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/49472
Change-Id: Ib3dc89b969197a8d27c330dfbcd4029dbf9dd22e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251848
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-25 16:48:13 +00:00
Anis Alibegić 40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
Tess Strickland 286326f834 [vm/compiler] Add symbols for read-only data when requested.
Symbols for non-clustered objects in the read-only data section are
now added to the static symbol tables for unstripped snapshots and
separate debugging information.

In DEBUG mode, the name for a non-String read-only data object also
includes the name of the parent object.

TEST=vm/dart{,_2}/readonly_data_symbols

Change-Id: I623b023138aeca0580bc76392882eac5686f8f50
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251104
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-07-25 11:03:29 +00:00
Ryan Macnak 2d13b205d7 Reland "[vm] Generate event ids for synchronous begin and end events."
Fix transposed id and timestamp.

TEST=Instruments, ci
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I2c2650f28050b179d26e1269729727f58201a8a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251581
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-22 19:13:47 +00:00
Tess Strickland 27f6c6d660 Reland "[pkg/native_stack_traces] Support Mach-O dSYM debugging information."
This is a reland of commit 08c13f173c

Fixes test failures on non-x64 architectures, both in the test
harness and due to DWARF5 line number program headers having a
non-backwards compatible format. (We generate DWARF2 in the
ELF snapshot writer, but the assembler used for assembly snapshots
may generate DWARF5.)

TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag

Original change's description:
> [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
>
> TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag
>
> Bug: https://github.com/dart-lang/sdk/issues/43612
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
> Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

Bug: https://github.com/dart-lang/sdk/issues/43612
Change-Id: I8a9cb70e78bc8594bcae004809c5a1be778d691d
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251464
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-07-22 07:05:26 +00:00
Ryan Macnak c36ae576e2 [vm] Add a glossary of terms used by the VM.
Change-Id: Iea8ab0a6d49a1bcfd0835761caf2446af3cb1228
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252280
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-07-21 19:45:15 +00:00
Alexander Markov c50ec0a7d6 [vm] Fix ActivationFrame::GetParameter for suspendable functions
TEST=ci

Change-Id: I483a2cd834de3f88728e3b8f498a4d748d387305
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252402
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-21 17:04:55 +00:00
Alexander Markov 1f48a6c7dd [vm] Document the new implementation of async/async*/sync* based on suspend/resume stubs
TEST=none (documentation only change)

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I61e734f85c40e3a301c4185e8917e78c37171590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251680
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-21 16:18:23 +00:00
Ben Konyi 54d3d7e459 [ Service ] Add gcType to Event
Fixes https://github.com/dart-lang/sdk/issues/49319

TEST=N/A

Change-Id: I703f102e2003ec6a21166b03ec52d89a42f61ad3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251621
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-20 18:08:27 +00:00
Ryan Macnak 49885ed289 [vm, compiler] Narrow CompileType from AbstractType for double/Float32x4/Float64x2/Int32x4 to the concrete implementation cid instead of kDynamicCid.
This gets the phi unboxing heuristic unstuck when its input comes from a parameter, which doesn't collect type feedback to propagate a speculative concrete cid.

TEST=ci
Change-Id: I939d64b41e4c3cefcff59d25b02afba8c40975ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252040
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-20 17:38:45 +00:00
Konstantin Shcheglov 4f787e4a09 Stop using DartType.displayName, regenerate.
Preparation for https://dart-review.googlesource.com/c/sdk/+/251783

Is this tool still used? I noticed that even when I re-generated
with a clean workspace, it still had a lot of changes.

Change-Id: I901ada1e6ad1d989b15882d9cf8ef83762fa8828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251784
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-19 23:50:24 +00:00
Ryan Macnak 9b6bda05ec [vm] Remove dead _localTimeZoneAdjustmentInSeconds.
Dead since 6af4987dc6.

TEST=ci
Change-Id: Ib92d2334dcc4c98e203628b4a8d244e6277b6b97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-07-19 17:29:04 +00:00
Alexander Markov 788f0dbda6 Revert "[vm] Fix building simriscv64 on Mac."
This reverts commit 651eb6d9c4.

Reason for revert: broke all tests on vm-kernel-precomp-mac-release-simarm64 bot.

Original change's description:
> [vm] Fix building simriscv64 on Mac.
>
> TEST=local
> Change-Id: I1a385ffb3fa26ee9a11af6a3088864c49aa8f03a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247900
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Id5ca3b9aadf53dc2e68f41f00339948f36234111
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251880
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-07-18 21:39:13 +00:00
Ryan Macnak 89e43f0406 [dartfuzz] Regenerate type and API tables.
This picks up changes to the core libraries since the last time the tables were regenerated.

TEST=dartfuzz
Change-Id: I01a844a53835a9b6ab964f09e28733fc6ee995e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251846
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-18 21:22:56 +00:00
Ryan Macnak 651eb6d9c4 [vm] Fix building simriscv64 on Mac.
TEST=local
Change-Id: I1a385ffb3fa26ee9a11af6a3088864c49aa8f03a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247900
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-18 20:28:53 +00:00
Liam Appelbe 844a9f3808 Reland "[ VM / Service ] Add abstract flag to Function"
This reverts commit 9b02bdaa76.

With https://dart-review.googlesource.com/c/sdk/+/251443 this is a
non-breaking change.

Bug: https://github.com/dart-lang/coverage/pull/412
Change-Id: Iaa8a74ab8065380d2a7e8a8fc07fec3a4518d979
TEST=Added to get_object_rpc_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251480
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-07-15 18:30:20 +00:00
Alexander Markov 025bfc858e [vm] Fix yield in async* to check if the stream was canceled while generator was suspended
Previously there was a window between the decision to resume generator
and actually running the micro-task. The stream could be canceled
during that window, making running the generator incorrect.

The solution is to check if the stream was canceled right before
resuming the generator in yield/yield*.

This change also unifies yield and yield* to check if the stream
was canceled even before suspending the generator.

TEST=language/async_star/cancel_while_paused_test,
language/async_star/cancel_while_paused_at_yield_test

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

Change-Id: Ib8ff3a2da9a6a7da8766a7dbf28e2c9d618728f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251562
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-07-15 14:09:20 +00:00
Daco Harkes 0f456a845c [vm] Check for undefined symbols in assembly snapshots
We don't check undefined symbols in our assembly snapshots. We
currently never emit undefined symbols, because Dart code only refers
to Dart code statically.

When adding static linking, we would like to have the option to have
PC relative calls to native libraries provided as relocatable files
(object files or static libraries).

Not checking would compile the symbols to dynamic linker, but we don't
support that `dart compile exe` at the moment. So we should add this
sanity check.

Also: Removes unused imports in relevant test.

Bug: https://github.com/dart-lang/sdk/issues/49418
Change-Id: I10701b82a1e8a06ce41271bd9183064addfb88f4
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251261
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-07-15 11:32:35 +00:00
Alexander Thomas 90bd16550d [infra] Upgrade checked-in SDKs to 2.18.0-271.0.dev
Tested: Builds on the CQ, built locally.
Change-Id: I25d0286d43199f4012a21e2223b1046a61a86bb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251545
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-15 04:48:41 +00:00
Gary Qian 03e5f9f941 Revert "Reland "[vm] Generate event ids for synchronous begin and end events.""
This reverts commit 05e5664ad6.

Reason for revert: Blocking Flutter engine -> framework roll, https://github.com/flutter/flutter/pull/107653/checks?check_run_id=7341814911

Invalid argument(s): durations is empty!
package:flutter_driver/src/driver/timeline_summary.dart 414:7   TimelineSummary._averageInMillis
package:flutter_driver/src/driver/timeline_summary.dart 72:12   TimelineSummary.computeAverageFrameRasterizerTimeMillis
package:flutter_driver/src/driver/timeline_summary.dart 232:47  TimelineSummary.summaryJson


Original change's description:
> Reland "[vm] Generate event ids for synchronous begin and end events."
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

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

Change-Id: I52fffe00ec141a486241fa8719d4cf12df168384
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251561
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-14 17:21:25 +00:00
Alexander Markov 2ad557a892 [vm] Cleanup more async-related code
This change continues cleanup of async implementation in the VM.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Icdaeab18bcdc0d6974bc45841b630822cd1ac114
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251441
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-14 16:04:54 +00:00
Alexander Thomas 5249cd9294 [release] Bump version to 2.19
Tested: Standard CQ
Change-Id: Ic52d4d38a5b117dfcdc778dedfac08315ca30a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251541
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2022-07-14 14:14:55 +00:00
Ryan Macnak c2058b0f40 [vm, compiler] Allocate only one SSA index to definitions, even those with pair representation.
Change the mapping between SSA indices and virtual registers from 1:1 to 1:2.

This shrinks the size of bit vectors used during optimizations, and leaves the size of bit vectors used during register allocation the same.

TEST=ci
Change-Id: I0c82ca7972f7efb30559f7e4869396f1eed757c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250982
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-13 23:27:33 +00:00
Ryan Macnak 05e5664ad6 Reland "[vm] Generate event ids for synchronous begin and end events."
TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-13 21:59:33 +00:00
Ben Konyi a75e9cd3ee Revert "[pkg/native_stack_traces] Support Mach-O dSYM debugging information."
This reverts commit 08c13f173c.

Reason for revert: Causing failures on simarm, simarm64, etc

Original change's description:
> [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
>
> TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag
>
> Bug: https://github.com/dart-lang/sdk/issues/43612
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
> Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/43612
Change-Id: I020c29f7329e9b53a8fe0f4f4a4de4070fca0ec3
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251242
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-13 16:15:45 +00:00
Alexander Markov da18c7c9a7 [vm] Fix type of Future returned from async closure created in a factory
In order to create a Future for the result of async closure,
closure needs to instantiate a type argument of its result type.
The result type may reference type arguments of enclosing function or
class and scope builder should visit closure's result type
in order to capture receiver or type arguments variable of parent
factory.

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

Change-Id: I1cd131251717fca43f8ca95856d13718eb9aca68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-13 14:09:53 +00:00
Ahmed Ashour 99f0fb5b70 Fix typos
Fixes #49364

TEST=ci

Change-Id: Ic643819c9cdd7b56690981b96b854b1e8d622fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250160
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-12 19:35:22 +00:00
Alexander Markov fb7b291886 [vm] Reduce number of callbacks used in sync* functions
This change introduces separate stubs for suspending sync* functions
at start and at yield/yield*. Suspend stub for yield/yield*
no longer calls Dart callback (in order to make it faster).

Also, ReturnSyncStar stub is removed - sync* functions now directly
return false instead of going through the stub.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Iee9a1f48cab2812cf0f9f0e4e6d8e847547e49f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250420
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-12 19:30:12 +00:00
Alexander Markov 61caeca47a Reland "[vm] Cleanup old async/async*/sync* implementation from the VM"
This is a reland of commit bc8afad855

On top of the original commit, this change fixes incorrect
propagation of async/async*/sync* modifiers from a function to
its dynamic invocation forwarder.

TEST=ci, runtime/tests/vm/dart/regress_b_238653741_test.dart
Fixes b/238653741
Issue: https://github.com/dart-lang/sdk/issues/48378

Original change's description:
> [vm] Cleanup old async/async*/sync* implementation from the VM
>
> TEST=ci
>
> Issue: https://github.com/dart-lang/sdk/issues/48378
> Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: Iaad033d974a23fc6c5880a3d7f41818eb117f839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251300
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-12 19:25:32 +00:00
Ryan Macnak 907dd9b8f5 [vm, compiler] Don't use an architecture-specific name for FPU registers in the register allocator.
TEST=ci
Change-Id: Id2cc6cf9f3275180692f13226d4198126e12b398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251149
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-12 18:26:22 +00:00
Ben Konyi 4dcada2bf8 [ VM ] Print more useful error message when trying to run a program with no main
Fixes https://github.com/dart-lang/sdk/issues/49432

TEST=Manual verification

Change-Id: Iba652016dc62306a883587b05506ee76cc650c20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251122
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-12 17:21:32 +00:00
Ryan Macnak becddc768f [vm, compiler] Use the right representation for DoubleToFloat/FloatToDouble.
TEST=ci
Change-Id: Id0ca5c081374d1cfe81dc7f210c2dcbd7978f74e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250984
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-12 16:42:02 +00:00
Tess Strickland 08c13f173c [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag

Bug: https://github.com/dart-lang/sdk/issues/43612
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-12 11:10:02 +00:00
Alexander Markov 2f17c118b5 Revert "[vm] Cleanup old async/async*/sync* implementation from the VM"
This reverts commit bc8afad855.

Reason for revert: b/238653741

Original change's description:
> [vm] Cleanup old async/async*/sync* implementation from the VM
>
> TEST=ci
>
> Issue: https://github.com/dart-lang/sdk/issues/48378
> Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,kustermann@google.com,alexmarkov@google.com

Change-Id: I6437d2d7d3914eb7fb9fe397472e2a5f7ae0cd9e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/48378
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251147
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-07-11 21:09:52 +00:00
Alexander Markov bc8afad855 [vm] Cleanup old async/async*/sync* implementation from the VM
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-11 18:46:41 +00:00
Alexander Markov 3a1229e56c [kernel] Remove obsolete AsyncMarker.SyncYielding and YieldStatement.isNative
AsyncMarker.SyncYielding and YieldStatement.isNative became
obsolete after async/async*/sync* kernel transformation was removed in
https://dart-review.googlesource.com/c/sdk/+/249944.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I69ac994af77f7e403686750bf8df437868bf33fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249947
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-11 18:20:45 +00:00
Ryan Macnak 3a45cf139b [vm, compiler] Fix --no_load_cse.
TEST=ci
Change-Id: I9b970a5a43577f879bd1edf9c40f3af064900f0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250980
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-07-11 18:15:41 +00:00
Alexander Markov 94c120a6ea [vm] Cleanup old async/async*/sync* implementation from kernel
This change removes kernel transformation which was used to
desugar async/async*/sync* functions in the old implementation of
async/async*/sync*.

The useful part of the transformation is retained in
pkg/vm/lib/transformations/for_in_lowering.dart.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ic70c1fb35162a31bcc22eac3a8f6488b61e945b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249944
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-11 18:12:41 +00:00
Ryan Macnak 01ce8f04be [vm, compiler] Rename Float32x4 accessors to match the other vectors and the Dart method names.
TEST=ci
Change-Id: If394241be0be422ab796f89549197c5be1ba4a22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250981
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-07-11 17:52:19 +00:00
Martin Kustermann f047c33d5a [gardening] Mark all tests as slow in debug-ia32 mode
On ia32 the CFE will run from a kernel file instead of an AppJit
snapshot. This is generally not that fast. In debug mode the JIT will
have various additional verifications turned on in the runtime (e.g.
flow graph checker runs, ...) - which will make it very slow.

So we should give all tests on debug-ia32 extra time.

TEST=ci

Change-Id: Iafd20a4c555d952641bc75a4f2d318f33a2751ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251080
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-07-11 09:00:21 +00:00
Ryan Macnak e5602b0652 [vm, compiler] Fix loading Smis from the pool instead of as immediates due to polluted upper bits under compressed pointers.
Bring other architectures into agreement with arm about the order in which LoadObject should consider its options.

TEST=ci
Change-Id: I277e692020acc6581b3d19a87a85d95c8badd696
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250322
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-07 16:08:15 +00:00
Ryan Macnak 6bfe5c4d9b [vm] More thoroughly clobber volatile registers in the ARM simulators.
TEST=ci
Change-Id: I04336abf00eed29e5301625ab91e63887cdaefbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250762
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-07 16:02:51 +00:00
Vyacheslav Egorov 9c3c3886c9 [deps] Rev benchmark_harness dependency
benchmark_harness (0ae822e..f4ed0fc):
  f4ed0fc  Wed Jul 6 03:45:31 2022 -0700  Leaf Petersen  Fix harness to not call timer repeatedly in the measured loop. (#38)

Change-Id: I5843e1700af29939d69c80eab7348bf39bbcd0d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250742
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-07-07 09:48:02 +00:00
Daco Harkes d3ea8bff5c [vm/ffi] Fix constant Finalizables
The kernel builder relied on only seeing expressions emitted by the
finalizable transform (variable get and this) as arguments to the fence.

However, other transforms can run later. In this case the expression
was turned into a constant.

This CL changes the implementation to accept any expression rather than
accepting a subset of expressions.

TEST=tests/ffi/regress_49402_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49402
Change-Id: I1a962a5b7a38099eb5c3bbf5a5a8145b16727d97
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250744
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-07 08:39:21 +00:00
Alexander Aprelev 9b02bdaa76 Revert "Reland "[ VM / Service ] Add abstract flag to Function""
This reverts commit aa2e19827f.

Reason for revert: broken g3 bot

Original change's description:
> Reland "[ VM / Service ] Add abstract flag to Function"
>
> This reverts commit 6c542eca22.
>
> Switched vm_service from a minor version bump to a major one.
> See: https://buganizer.corp.google.com/issues/236964692#comment4
>
> Bug: https://github.com/dart-lang/coverage/issues/398
> Change-Id: I85f88d4a1cdcb878cbf77da283041458381e2a2b
> TEST=Added to get_object_rpc_test.dart
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250772
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,asiva@google.com,liama@google.com

Change-Id: I6fbedfb146ee2157baf49162acd0c943402b6cbf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/coverage/issues/398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250787
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-07-07 02:39:11 +00:00
Liam Appelbe aa2e19827f Reland "[ VM / Service ] Add abstract flag to Function"
This reverts commit 6c542eca22.

Switched vm_service from a minor version bump to a major one.
See: https://buganizer.corp.google.com/issues/236964692#comment4

Bug: https://github.com/dart-lang/coverage/issues/398
Change-Id: I85f88d4a1cdcb878cbf77da283041458381e2a2b
TEST=Added to get_object_rpc_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250772
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-06 22:32:22 +00:00
Ryan Macnak 1044c64347 [vm] Don't read function entry points when initializing Threads that don't execute Dart code.
Such helper threads may start concurrently with PostLoad phase of deserialization, during which the function entry points are being initialized.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/49394
Change-Id: I4cad3ebc0d54364d508ba8af8091efebbb6ece3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250761
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-06 21:49:10 +00:00
Ryan Macnak 6e3ef8b9e6 [standalone] Update tcmalloc to 2.10.
Remove some architecture limitations.

TEST=ci
Change-Id: I9703729d3e871687cd4951ec40d3d09ae579871f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247864
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2022-07-06 17:34:20 +00:00
Vyacheslav Egorov a2ab7ccea4 [vm] Avoid UB in FinalizeHash(hash)
FinalizeHash(hash) was trying to avoid UB in expression 1 << 32
by casting 1 to uintptr_t. This type however is not wide enough
on 32-bit platforms.

Instead just use explicit comparison hashbits < kBitsPerInt32 to
avoid overflow in left shift.

This bug went unnoticed for a while because it the only place
where we call FinalizeHash(hash) is in the snapshot profile
writer code and it only triggers when gen_snapshot is a
32-bit binary - which is only true on Windows, as Mac and Linux
seem to use simarm_x64 configuration instead.

This UB was explicitly affecting the code behavior because C++
compiler would either optimize out or change behavior of any
code that consumed value produced by FinalizeHash(hash).

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

TEST=vm/cc/DirectChainedHashMap

Change-Id: I39f2b09e7516c875b765e5a065d1c1331f89fa33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250741
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-07-06 12:48:16 +00:00
方哲源 6b04cac19d [vm] Bug fix in dedup optimization when build deferred components.
Closes https://github.com/dart-lang/sdk/pull/49393

TEST=vm/dart{,_2}/regress_49372

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try
GitOrigin-RevId: c6306f96ae2bafa25c45e5c7a818c71eb72d8d12
Bug: https://github.com/dart-lang/sdk/issues/49372
Change-Id: I7ec4b170819321cb74037e475006890259446744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250720
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-06 11:04:10 +00:00
Johnni Winther f6846849b9 [cfe] Handle augment super expressions
This adds the generation of access to augmented procedures.

TEST=existing

Change-Id: I5efa9cc541b86c18735bb1f4c51c73976ffa42ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250164
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-07-04 12:37:50 +00:00
Daco Harkes c48f6fea58 [vm] Small fixes
Some small fixes split off from
https://dart-review.googlesource.com/c/sdk/+/246241.

* Print code comments on disassembly if the code object exists.
* Add Struct to the NativeType API.
* Fix typo.
* Add documentation.

TEST=Only cosmetic changes, build/run CI should be enough.

Change-Id: Ie193243573b034c52e41401b4d384d556c212fdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250165
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-07-04 07:53:39 +00:00
Zach Anderson d7df61e042 Revert "[vm] Generate event ids for synchronous begin and end events."
This reverts commit 7fe44864d6.

Reason for revert: https://github.com/flutter/flutter/issues/106957

Original change's description:
> [vm] Generate event ids for synchronous begin and end events.
>
> os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Id86959d08b5352b5446b6f294a8302b88b4fa0c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250403
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2022-07-01 16:08:40 +00:00
Liam Appelbe f7990bc0da Revert "[vm] Forward dynamic events names to os_signposts as arguments."
This reverts commit 90da09e2db.

Reason for revert: Blocking this revert: https://dart-review.googlesource.com/c/sdk/+/250403

Original change's description:
> [vm] Forward dynamic events names to os_signposts as arguments.
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: Ice4a83f03dccb6c7dbd54c229f37d4ea7d0d8051
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250111
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I326fb50ead5c298e62666371adadb2b9f40d69c7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250407
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2022-07-01 16:07:50 +00:00
Vyacheslav Egorov ec9a660ccc [vm] Avoid clobbering array length in AllocateArray stub on ARM
It was calling EnsureIsNewOrRemembered on the slow path which
was forgetting to preserve registers around a runtime call.

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

TEST=vm/dart{,_2}/flutter_regress_106510

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm-try
Change-Id: I621e392304fcd1fd643c009fbcde3f88b6f19b7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250168
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-07-01 12:31:47 +00:00
Alexander Markov abedfaf62a [vm] Fix soundness issue when awaiting a user-defined Future
TEST=language/async/await_user_defined_future_soundness_test

Issue: https://github.com/dart-lang/sdk/issues/49345
Change-Id: Ieaaa9baace13dad242c770a710d4d459e135af81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250222
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-30 22:53:24 +00:00
Ryan Macnak 4308eb39cf [standalone] Remove RISC-V linker hack.
TEST=ci
Change-Id: I5379bc3f537cab149742df138d76983b4f16a796
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250141
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-30 21:16:04 +00:00
Ryan Macnak 7004b1859f [vm] Account for pool entries that are immediate objects.
Cf. 4c82eb5836

TEST=gallery
Bug: https://github.com/flutter/gallery/issues/545
Change-Id: I90935aba3737f7b6873368e5a8ebf1cc48d34a22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250320
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-06-30 20:32:44 +00:00
Ryan Macnak 90da09e2db [vm] Forward dynamic events names to os_signposts as arguments.
TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: Ice4a83f03dccb6c7dbd54c229f37d4ea7d0d8051
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250111
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-30 20:16:33 +00:00
Ryan Macnak 7fe44864d6 [vm] Generate event ids for synchronous begin and end events.
os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.

TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-30 16:48:36 +00:00
Ryan Macnak 1c461e06c1 [vm, gc] Make force-growth a thread-local property.
Don't evaluate concurrent marking on new-space page allocation or external allocation under force-growth scopes.

TEST=ci, tsan
Bug: https://github.com/dart-lang/sdk/issues/49344
Bug: https://github.com/dart-lang/sdk/issues/48377
Bug: https://github.com/dart-lang/sdk/issues/48607
Change-Id: Ieff3880bd29228804419ef292a41ba4d502c2c80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250223
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-06-30 00:21:36 +00:00
Alexander Aprelev f51149eba3 [embedder] Clean up deprecated secure connection enforcement mechanism.
Addresses https://github.com/flutter/flutter/issues/54448
TEST=ci, flutter

Change-Id: If1ea8044cdfa8d593e0cd5b5201c2fbe71dd08ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248220
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-06-29 16:59:25 +00:00
Martin Kustermann dd9a2dca24 [gardening] Mark vm/dart{,_2}/byte_array_test as slow
The test runs with --opt-counter-threshold=10 and can be very slow,
especially in debug mode.

TEST=Should address flaky timeout of this test.

Change-Id: I2e45681743c4660e20c765ec0fcf85424393f2c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250084
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-06-29 08:29:47 +00:00
Daco Harkes a37502c1b8 [misc] Cleanup stale todos
TEST=tests/ffi

Change-Id: Iae97f62b1adb8dbe99ad075dfe750604db0de62c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249301
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-28 16:02:53 +00:00
Ryan Macnak 93a4247af3 Reapply "Account for @pragma("vm:entry-point") creating additional "root" libraries when partitioning the program into loading units."
Weaken assertion in gen_snapshot requiring all libraries to have a loading unit as there can still be unreachable libraries:
  - Google3 and Fuchsia will compile all the sources in a package to a single dill file, then present multiple input dill files to the AOT compilation. Since the set of libraries was derived from package membership instead of imports, many can be unreachable.
  - When the root library's main comes from an export, the frontend's representation will incorrectly report the library containing main as the root library and the true root library may be unreachable from it.

Instead, assert only that surviving compiled code is assigned a loading unit.

TEST=gallery
Bug: https://github.com/flutter/gallery/issues/545
Bug: https://github.com/dart-lang/sdk/issues/49325
Bug: https://github.com/dart-lang/sdk/issues/41974
Bug: b/237016312
Change-Id: Ia52563a6f517308d041368be11dcc85270f19acc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249724
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-06-27 18:56:12 +00:00
Alexander Markov 77ea9820aa [vm] New implementation of sync* based on suspend/resume stubs
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I7f4b6b56d914a617dfd7ac724cd4414532073b4c
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249141
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-27 18:19:12 +00:00
Ryan Macnak e7b77987ff [vm, gc] Address TSAN warning on access to PageSpace::phase_.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/49323
Change-Id: I6e98cbd33b69332a01db4fdcceb0b3da164e725e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249760
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-24 23:00:00 +00:00
Martin Kustermann 0113970da0 [gardening] Mark some tests as Pass, Slow
The tests are generally slow and sometimes hit the limit to a timout
(e.g. recently on win-debug-ia32)

TEST=Should fix flaky timeouts.

Change-Id: I8879d0e6df94046e79e43957877877a3458deb3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249607
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-24 13:26:39 +00:00
Martin Kustermann db6b2679e6 [gardening] Use .dart_tool/package_config.json instead of deprecated (and now removed) .packages
TEST=Fixes test after support for .packages was removed.

Change-Id: I44e077f06b62e3abb9f1a96cae0fbe576e44ef39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249682
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-06-24 11:20:19 +00:00
Jens Johansen b4e2012f5b [CFE] Remove support for .packages file
This CL:
* Removed the redirect from .packages to .dart_tool/package_config.json
  (whenever such a file existed).
* Removes support for the old format entirely.
* Updates all tests etc that were found.

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

TEST=Existing tests updated.

Change-Id: Iccf711c455ac1885189aa773ca74dd8f55012964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248603
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-06-24 08:20:39 +00:00
Emmanuel Pellereau 6c542eca22 Revert "[ VM / Service ] Add abstract flag to Function"
This reverts commit 921476edf3.

Reason for revert: breaks google3 (b/236964692).

Original change's description:
> [ VM / Service ] Add abstract flag to Function
>
> Bug: https://github.com/dart-lang/coverage/issues/398
> Change-Id: I1f6e16483e28fb7a77aebae079fd62abe9d16099
> TEST=Added to get_object_rpc_test.dart
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249421
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

TBR=bkonyi@google.com,liama@google.com

Change-Id: I1733080dadd6f283766dddbdbe1390d821f91f64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/coverage/issues/398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249680
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
2022-06-24 07:35:29 +00:00
Emmanuel Pellereau c13f7b0360 Revert "Account for @pragma("vm:entry-point") creating additional "root" libraries when partitioning the program into loading units."
This reverts commit 9c2a91fb72.

Reason for revert: breaks google3 (b/237016312)

Original change's description:
> Account for @pragma("vm:entry-point") creating additional "root" libraries when partitioning the program into loading units.
>
> If a library contained an entry point but was not reachable from the root library, it was not assigned to any loading unit and caused a null dereference in gen_snapshot. This is not possible with the standalone embedder, but is possible in Flutter because it passes multiple sources to frontend_server.  E.g., `--source dart_plugin_registrant.dart`.
>
> TEST=gallery
> Bug: https://github.com/flutter/gallery/issues/545
> Change-Id: I9c67f0e39f7509094ee873610d80851a702a0cf2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249640
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I3e17bf29b8f29e4797abfca35fa82b9ca3b5a160
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/flutter/gallery/issues/545
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249681
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
2022-06-24 07:35:08 +00:00
Ryan Macnak 9c2a91fb72 Account for @pragma("vm:entry-point") creating additional "root" libraries when partitioning the program into loading units.
If a library contained an entry point but was not reachable from the root library, it was not assigned to any loading unit and caused a null dereference in gen_snapshot. This is not possible with the standalone embedder, but is possible in Flutter because it passes multiple sources to frontend_server.  E.g., `--source dart_plugin_registrant.dart`.

TEST=gallery
Bug: https://github.com/flutter/gallery/issues/545
Change-Id: I9c67f0e39f7509094ee873610d80851a702a0cf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249640
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-23 23:51:48 +00:00
Ben Konyi 95d1558109 [ VM / CLI ] Redirect users to use 'dart compile' for snapshot generation
Note: `--snapshot=` and related flags are still valid for non-DartDev
invocations of the VM (e.g., 'dart --snapshot=').

TEST=Local testing

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

Change-Id: I666f68bd46d5b22c691da15267f14f4ad5a53731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-06-23 20:35:15 +00:00
Ryan Macnak 0a8fda94b6 [vm, compiler] Use RISC-V's compare-and-branch for a shorter write barrier sequence.
dart2js.aot.rv64 25753840 -> 25721032 (-0.13%)
dart2js.aot.rv32 24891160 -> 24858368 (-0.13%)

TEST=ci
Change-Id: I252e0477f11b9198fe043f105a8745bc283aaaa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249062
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-23 15:58:15 +00:00
Liam Appelbe 921476edf3 [ VM / Service ] Add abstract flag to Function
Bug: https://github.com/dart-lang/coverage/issues/398
Change-Id: I1f6e16483e28fb7a77aebae079fd62abe9d16099
TEST=Added to get_object_rpc_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249421
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2022-06-23 15:46:05 +00:00
Emmanuel Pellereau bb104f07fc Revert "Reland "[vm] Remove warnings about non-standard stack traces.""
This reverts commit 6651c29779.

Reason for revert: breaks google3 (b/236928633)

Original change's description:
> Reland "[vm] Remove warnings about non-standard stack traces."
>
> This is a reland of commit cc9d14d822
>
> TEST=vm/dart{,_2}/causal_stacks/async_throws_stack_lazy_non_symbolic_test
>
> Original change's description:
> > [vm] Remove warnings about non-standard stack traces.
> >
> > The language team has clarified in
> > https://github.com/dart-lang/language/issues/1212 that the content of
> > stack traces is not specified in a way that is violated by either
> > obfuscation or non-symbolic stack traces. Thus, we remove the warnings
> > about supposedly standard-violating stack traces.
> >
> > TEST=No change in actual functionality, so tested manually.
> >
> > Bug: https://github.com/dart-lang/sdk/issues/43388
> > Change-Id: I2c7ac44cf2f9afafa85d902b2783e1173e727264
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249185
> > Commit-Queue: Tess Strickland <sstrickl@google.com>
> > Reviewed-by: Daco Harkes <dacoharkes@google.com>
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
>
> Bug: https://github.com/dart-lang/sdk/issues/43388
> Change-Id: Ifa7915b4ba21cca592ed5645cd9ad6cda1575f12
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249192
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>

TBR=kustermann@google.com,dacoharkes@google.com,sstrickl@google.com

Change-Id: I65f3d84caee3ec9ac30f0ce058104bb24ef6ea11
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/43388
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249580
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
2022-06-23 09:25:00 +00:00
Alexander Aprelev 413f60a8b6 Reland "Update clang and gn to match Fuchsia."
This reverts commit a99b0f6c09.

To fix culprit for the revert, it no longer rolls zlib, instead adds
an option to ignore clang warnings in zlib source code.

TEST=ci

Change-Id: I9a877ff0c08af961bc49fcacaad5b01f1ed0a743
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249542
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-22 21:54:25 +00:00
Ryan Macnak 2e4107c8ae [vm, gc] Apply incremental marking back-pressure in proportion to internal allocation size.
In particular, do not apply incremental marking back-pressure for external allocations. External allocations do not cause additional marking work. If a mutator thread performs a storm of external allocations, this should not cause it to effectively become a marking thread.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47492
Bug: https://github.com/flutter/flutter/issues/106305
Change-Id: Icace57e73d695143f7e295924b61b9b1c04be121
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249403
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-06-22 15:41:04 +00:00
Tess Strickland 6651c29779 Reland "[vm] Remove warnings about non-standard stack traces."
This is a reland of commit cc9d14d822

TEST=vm/dart{,_2}/causal_stacks/async_throws_stack_lazy_non_symbolic_test

Original change's description:
> [vm] Remove warnings about non-standard stack traces.
>
> The language team has clarified in
> https://github.com/dart-lang/language/issues/1212 that the content of
> stack traces is not specified in a way that is violated by either
> obfuscation or non-symbolic stack traces. Thus, we remove the warnings
> about supposedly standard-violating stack traces.
>
> TEST=No change in actual functionality, so tested manually.
>
> Bug: https://github.com/dart-lang/sdk/issues/43388
> Change-Id: I2c7ac44cf2f9afafa85d902b2783e1173e727264
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249185
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Bug: https://github.com/dart-lang/sdk/issues/43388
Change-Id: Ifa7915b4ba21cca592ed5645cd9ad6cda1575f12
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249192
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-06-22 09:19:37 +00:00
Ryan Macnak d45dde461e [vm] Fix edge cases in simulating RISC-V's fmin/fmax.
TEST=ci (+ local qemu)
Change-Id: Ia7921c204cf2397fda785196731c93b627dee62a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249082
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-06-21 20:47:34 +00:00
Ryan Macnak baa870bfa7 [vm, gc] Prevent multiple threads racing to finalize marking from triggering an extra (synchronous) GC.
TEST=ci
Change-Id: I844f23cbedfc99950b4dfadfb9a339865bea1a6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249080
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-21 19:56:34 +00:00
Alexander Aprelev a99b0f6c09 Revert "Update clang and gn to match Fuchsia."
This reverts commit e9f629f607 as it break flutter build https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20iOS%20Engine/32804/overview

```
[1617/4268] CC obj/third_party/zlib/chrome_zlib.adler32.o

FAILED: obj/third_party/zlib/chrome_zlib.adler32.o
error: unknown warning option '-Wno-deprecated-non-prototype' [-Werror,-Wunknown-warning-option]
[1618/4268] CXX obj/third_party/skia/modules/skunicode/src/skunicode.SkUnicode_icu_builtin.o
[1619/4268] CC obj/third_party/zlib/chrome_zlib.compress.o
FAILED: obj/third_party/zlib/chrome_zlib.compress.o
error: unknown warning option '-Wno-deprecated-non-prototype' [-Werror,-Wunknown-warning-option]
```

TEST=ci

Change-Id: I3c4ce4a9c80be197dc50e70365e668e5b7a4e2fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249240
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-21 17:02:04 +00:00
Tess Strickland 140db2e0f3 Revert "[vm] Remove warnings about non-standard stack traces."
This reverts commit cc9d14d822.

Reason for revert: Broken precomp async stack tests.

Original change's description:
> [vm] Remove warnings about non-standard stack traces.
>
> The language team has clarified in
> https://github.com/dart-lang/language/issues/1212 that the content of
> stack traces is not specified in a way that is violated by either
> obfuscation or non-symbolic stack traces. Thus, we remove the warnings
> about supposedly standard-violating stack traces.
>
> TEST=No change in actual functionality, so tested manually.
>
> Bug: https://github.com/dart-lang/sdk/issues/43388
> Change-Id: I2c7ac44cf2f9afafa85d902b2783e1173e727264
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249185
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,dacoharkes@google.com,sstrickl@google.com

Change-Id: I315ce10074109cf7f7cdbd94402673444b0fd6f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/43388
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249191
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-21 11:54:34 +00:00
Tess Strickland cc9d14d822 [vm] Remove warnings about non-standard stack traces.
The language team has clarified in
https://github.com/dart-lang/language/issues/1212 that the content of
stack traces is not specified in a way that is violated by either
obfuscation or non-symbolic stack traces. Thus, we remove the warnings
about supposedly standard-violating stack traces.

TEST=No change in actual functionality, so tested manually.

Bug: https://github.com/dart-lang/sdk/issues/43388
Change-Id: I2c7ac44cf2f9afafa85d902b2783e1173e727264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249185
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-06-21 08:00:33 +00:00
Alexander Markov 1aa406869b [gardening] Skip enable_mirrors_test on configurations with separate kernel compilation
Separate kernel compilation on sim* bots doesn't respect VM options, so
--enable-mirrors=false has no effect on those bots.
This change skips the recently added test for that VM option.

Issue: https://github.com/dart-lang/sdk/issues/49266
Change-Id: I2119c2c9623054fa24fdeee248c80b14287e7ee8
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249022
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-17 19:05:09 +00:00
Alexander Markov 8bc1cda3f7 [vm] Fix --enable-mirrors VM flag to affect environment and conditional imports
This change propagates --enable-mirrors VM flag to CFE via
TargetFlags.supportMirrors. CFE uses that to select conditional
imports and for constant evaluation of bool.fromEnvironment.

TEST=runtime/tests/vm/dart/enable_mirrors_test

Issue: https://github.com/dart-lang/sdk/issues/49266
Change-Id: I9f6b03f1ab224d13cbe9f035fb5b6fa6eb59055c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249020
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-17 17:20:09 +00:00
Martin Kustermann a6b408d901 [gardening] Remove null safety flag from newly added test
This fixes an issue in our testing infrastructure: If // VMOptions
swiches the null safety mode explicitly, all tools/test.py runs that
require multiple steps (e.g AOT that compiles+runs or simarm that
compiles to kernel + runs) would fail with mismatch in null safety mode.

Instead rely on our test matrix to run this test in all null safety
configurations.

TEST=ci

Change-Id: I6e2f6963351a1a6c071cefb4444e64d2904c63f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249001
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-17 13:37:48 +00:00
Martin Kustermann 4703d2c54e [vm] Make _CastError.{_url,_line,_column} nullable fields
The ! operator causes _CastErrors to be thrown without the
_CastError.{_url,_line,_column} fields to be set (see
runtime/vm/runtime_entry.cc:NullErrorHelper).

This CL makes the fields nullable. An alternative would be to remove the
fields entirely since the fields are not used and the position of the
failed null check is visible from top frame in the stack frame as well.

Though the fields are visible in the debugger and there are other
situations where they are correctly set (e.g. in type errors that cause
_CastError to be thrown). To avoid changing this behavior, we make them
nullable.

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

TEST=vm/dart{,_2}/regress_49279_test

Change-Id: Ieff9e84819d5afa83c8950ad1f99d684d184340a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248980
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-17 10:39:28 +00:00
Daco Harkes 2b700003d9 Reland "[vm] Only call .hashCode once when adding to Map and Set"
Relanding after https://dart-review.googlesource.com/c/sdk/+/244200.

Original change's description:
> [vm] Only call `.hashCode` once when adding to `Map` and `Set`
>
> The methods to add to hash maps and hash sets are recursive: if the
> index needs to be rehashed then the same method is called again
> after rehashing.
>
> This CL nests the actual implementation in a private method that takes
> the full hashCode as an extra argument.
>
> No significant code size or run time changes are reported on our
> benchmarks. (Our benchmarks do not contain purposefully slow hashCodes.)
>
> Note that hashCode can be called again later if rehashing of the index
> is required on adding subsequent elements.
>
> Bug: https://github.com/dart-lang/sdk/issues/48948
> Change-Id: Ia3ccff9e592d675b4922ac78c4aa7ee0287ecb50
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243623
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>


Change-Id: I033bd7cc29fc812dccb6dccf0c3dca6e22cae2ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248802
Commit-Queue: Tess Strickland <sstrickl@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-17 10:05:18 +00:00
Ryan Macnak 01a7f207c3 [vm] Speed up the RISC-V simulator.
TEST=ci
Change-Id: I8ddba01117d21fcf915d77bc06765a0d576f55ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248682
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-16 17:56:02 +00:00
Alexander Aprelev 6d923dfd99 Revert "Deprecate outdated errors, drop CastError and NullThrownError."
This reverts commit 0f3dea33f9.

Reason for revert: breaks dart->engine roller as flutter still uses NullThrownError, fails analysis step

Original change's description:
> Deprecate outdated errors, drop `CastError` and `NullThrownError`.
>
> Both `CastError` and `NullThrownError` becomes just (deprecated) aliases for `TypeError`.
>
> `FallThroughError` becomes deprecated. Fall-through was made a compile-time error in Dart 2.0, the error should no longer be used.
>
> `CyclicInitializationError` is deprecated. Null safe Dart doesn't specify which error a late initialization error throws. We use internal errors now.
>
> These errors should not be needed in sound null-safe mode (if they are even needed now), and so should be removed in Dart 3.0.
>
> TEST= No new tests, should not change behavior in a significant way.
>
> Bug: https://github.com/dart-lang/sdk/issues/49141
> Change-Id: I636e9a0d0c32021d40bb819a88a1f57db6efc5a9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247384
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Brian Quinlan <bquinlan@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/49141
Change-Id: I1b2802ec69fe654525e683527ff3554ff972f0c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248741
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-16 17:12:19 +00:00
Ryan Macnak e9f629f607 Update clang and gn to match Fuchsia.
Roll zlib for -Wno-deprecated-non-prototype.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/103568
Change-Id: I969ab107e8917cc35645cfc9916db0d9ab61b203
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248720
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-16 16:06:09 +00:00
Ryan Macnak 068d88b0d0 [vm, compiler] Emit constant-width addresses in IA32 disassembly for the absolute addressing mode.
TEST=ci
Change-Id: I1a3f6a4064ecc6d93e9cb21055d43e9cb698eea5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248721
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-06-16 16:03:19 +00:00
Alexander Aprelev abeaa03148 [vm/heap/metrics] Remove deprecated isolate-based vm heap statistic messages.
Fixes https://dartbug.com/49211
TEST=ci

Change-Id: Icddbebccf84f226b2ac89acb9153353d84658079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248680
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-16 15:27:49 +00:00
Tess Strickland 73bc88f957 [vm/compiler] Fix bad check in CompilerType::IsAssignableTo.
In order to know whether a value is assignable to a given type,
we need the fully instantiated type. Thus, return false if the
type given to CompilerType::IsAssignableTo is uninstantiated,
similar to CompilerType::IsInstanceOf.

TEST=vm/dart{,_2}/regress_b_230945329_test.dart

Bug: b/230945329
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I7ff9eb2214debc274f09580d51c80f0921f8f77d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244200
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-06-16 14:03:00 +00:00
Ryan Macnak 1a2dd17712 [vm, compiler] XMM0 is not just a scratch register on IA32.
In particular, it can be live across write-barrier calls.

TEST=ci
Change-Id: I9383cc775315d76d0dc0052fa8f91daa233cb413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248681
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-15 20:16:58 +00:00
kanghuay 5daf8f21ed [vm] Prevent empty range in coverage output
Closes https://github.com/dart-lang/sdk/pull/49251

GitOrigin-RevId: 4c399e9b8150bbce495b4f88e0546bdd40fff7ed
Change-Id: Ic16843edeeca9678a7caedbe8f675f7d0d20548d
TEST=Added a case to source_report_test.cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248349
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2022-06-15 20:13:28 +00:00
Ryan Macnak ec54e588fc [vm, compiler] Implement all remaining assembly intrinsics for RISC-V.
TEST=ci
Change-Id: Ifbeac4ca5a3af5950b07446896b70ab4e6693ce5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247801
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-15 19:37:48 +00:00
Lasse R.H. Nielsen 0f3dea33f9 Deprecate outdated errors, drop CastError and NullThrownError.
Both `CastError` and `NullThrownError` becomes just (deprecated) aliases for `TypeError`.

`FallThroughError` becomes deprecated. Fall-through was made a compile-time error in Dart 2.0, the error should no longer be used.

`CyclicInitializationError` is deprecated. Null safe Dart doesn't specify which error a late initialization error throws. We use internal errors now.

These errors should not be needed in sound null-safe mode (if they are even needed now), and so should be removed in Dart 3.0.

TEST= No new tests, should not change behavior in a significant way.

Bug: https://github.com/dart-lang/sdk/issues/49141
Change-Id: I636e9a0d0c32021d40bb819a88a1f57db6efc5a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247384
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-15 15:35:58 +00:00
Alexander Markov 058265f4e7 Reland "[vm] More efficient 'await' of not Future and completed _Future"
This is a reland of commit 6b3d1752fa

Fixes b/235734143
TEST=runtime/tests/vm/dart/await_in_custom_zone_test.dart

Original change's description:
> [vm] More efficient 'await' of not Future and completed _Future
>
> When awaiting a value which is not a Future or a completed
> built-in _Future, 'await' implementation can bypass heavyweight
> _Future/_FutureListener machinery and schedule micro-tasks directly.
>
> Benchmarks:
> JIT, x64:
> AsyncLiveVars.* +46-54% (bigger is better)
> Calls.AwaitAsyncCall -46% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -45%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45%
> Calls.AwaitFutureOrCall -60%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -60%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, ia32:
> AsyncLiveVars.* +43-52% (bigger is better)
> Calls.AwaitAsyncCall -42% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -42%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -41%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -39%
> Calls.AwaitFutureOrCall -55%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -54%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -53%
>
> JIT, arm:
> AsyncLiveVars.* +64-71% (bigger is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% (less is better)
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -48%
> Calls.AwaitFutureOrCall -64%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -64%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, arm64:
> AsyncLiveVars.* +65-78% (bigger is better)
> Calls.AwaitAsyncCall -51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49%
> Calls.AwaitFutureOrCall -69%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -67%
>
> AOT, x64:
> AsyncLiveVars.* +55-61% (bigger is better)
> Calls.AwaitAsyncCall -47% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -46%
> Calls.AwaitFutureOrCall -59%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -59%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -58%
>
> AOT, arm:
> AsyncLiveVars.* 54-66% (bigger is better)
> Calls.AwaitAsyncCall -46-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46-50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -46-52%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45-50%
> Calls.AwaitFutureOrCall -63-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -63-66%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> AOT, arm64:
> AsyncLiveVars.* +53-66% (bigger is better)
> Calls.AwaitAsyncCall -50-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50-51%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49-50%
> Calls.AwaitFutureOrCall -66-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -66-68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> TEST=ci
> Issue: https://github.com/dart-lang/sdk/issues/48378
>
> Change-Id: I65e3702fcd816ee3fee876ff442b9887c035b1ec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243102
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I245984ace1c768fdcba58dfdd6aa46e52126be4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248442
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-15 15:35:38 +00:00
Ahmed Ashour 85700570f6 Fix typos
Fixes #49241

TEST=ci

Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 11:08:28 +00:00
Liam Appelbe d1affb719f [vm] Remove async function deduping in source_report
As of https://dart-review.googlesource.com/c/sdk/+/247603 we no longer
see 2 copies of the function, so now this deduping check entirely skips
those functions.

Fixes: https://github.com/dart-lang/coverage/issues/392
Bug: https://github.com/dart-lang/coverage/issues/392
Change-Id: I7157eec2ad53b3bcff346e4837bec26169b94e5b
TEST=Added coverage_async_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248460
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-06-14 23:50:17 +00:00
Ryan Macnak 837480f3f6 [vm, gc] Parallelize scavenging large arrays.
TEST=ci
Change-Id: Ie9966aa2a1d8821f486fb8acd7ff4c3fe7c111ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247602
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-14 21:34:08 +00:00
Alexander Markov 0fd7f0c2a2 Revert "[vm] More efficient 'await' of not Future and completed _Future"
This reverts commit 6b3d1752fa.

Reason for revert: internal test failures b/235734143.

Original change's description:
> [vm] More efficient 'await' of not Future and completed _Future
>
> When awaiting a value which is not a Future or a completed
> built-in _Future, 'await' implementation can bypass heavyweight
> _Future/_FutureListener machinery and schedule micro-tasks directly.
>
> Benchmarks:
> JIT, x64:
> AsyncLiveVars.* +46-54% (bigger is better)
> Calls.AwaitAsyncCall -46% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -45%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45%
> Calls.AwaitFutureOrCall -60%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -60%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, ia32:
> AsyncLiveVars.* +43-52% (bigger is better)
> Calls.AwaitAsyncCall -42% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -42%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -41%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -39%
> Calls.AwaitFutureOrCall -55%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -54%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -53%
>
> JIT, arm:
> AsyncLiveVars.* +64-71% (bigger is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% (less is better)
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -48%
> Calls.AwaitFutureOrCall -64%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -64%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, arm64:
> AsyncLiveVars.* +65-78% (bigger is better)
> Calls.AwaitAsyncCall -51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49%
> Calls.AwaitFutureOrCall -69%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -67%
>
> AOT, x64:
> AsyncLiveVars.* +55-61% (bigger is better)
> Calls.AwaitAsyncCall -47% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -46%
> Calls.AwaitFutureOrCall -59%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -59%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -58%
>
> AOT, arm:
> AsyncLiveVars.* 54-66% (bigger is better)
> Calls.AwaitAsyncCall -46-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46-50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -46-52%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45-50%
> Calls.AwaitFutureOrCall -63-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -63-66%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> AOT, arm64:
> AsyncLiveVars.* +53-66% (bigger is better)
> Calls.AwaitAsyncCall -50-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50-51%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49-50%
> Calls.AwaitFutureOrCall -66-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -66-68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> TEST=ci
> Issue: https://github.com/dart-lang/sdk/issues/48378
>
> Change-Id: I65e3702fcd816ee3fee876ff442b9887c035b1ec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243102
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I8ed0fca7234dd33f45997029b948a63341991ee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248353
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-06-14 17:24:37 +00:00
Ryan Macnak 305c3e30c6 [vm, gc] Remove the growth policy's hard limit when concurrent marking is available.
Instead, impose back-pressure by making mutators assist with marking as they allocate.

Synchronous marking may still occur if the heap grows to --old_gen_heap_size or the OS is out of memory.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47492
Change-Id: I2538f9e9b6d67bbbca0951d5162075a950658380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246180
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-13 18:46:37 +00:00
Johnni Winther 7900e9071a [cfe] Remove support for old super-mixins feature
This CL remove the support for mixing in classes that don't extend
Object. An error has been report by the analyzer for some time and
now also by the CFE.

This puts the breaking change https://github.com/dart-lang/sdk/issues/48167 into effect.

TEST=pkg/front_end/testcases/general/issue48167.dart

Change-Id: Ia7715a27dc1aa18a7c85b24ed86d19a91b6924d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247551
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-06-13 15:30:57 +00:00
Ahmed Ashour 8bb3a10e40 Fix typos
Fixes #49228

TEST=ci

Change-Id: Idcc625554bcf07807bae9791ea37b73ae9394b87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247960
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-10 15:48:54 +00:00
asiva 6970e0907b [VM | VMService] Fix expression evaluation when recursive types are used.
Bug:49209
TEST=pkg/vm_service/test/eval_issue_49209_test.dart
Change-Id: I7da8a195a624b34519aa64fffc248cad0fb7e6fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247901
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-06-10 15:03:04 +00:00
Alexander Markov 6b3d1752fa [vm] More efficient 'await' of not Future and completed _Future
When awaiting a value which is not a Future or a completed
built-in _Future, 'await' implementation can bypass heavyweight
_Future/_FutureListener machinery and schedule micro-tasks directly.

Benchmarks:
JIT, x64:
AsyncLiveVars.* +46-54% (bigger is better)
Calls.AwaitAsyncCall -46% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
Calls.AwaitAsyncCallClosureTargetPolymorphic -45%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45%
Calls.AwaitFutureOrCall -60%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -60%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%

JIT, ia32:
AsyncLiveVars.* +43-52% (bigger is better)
Calls.AwaitAsyncCall -42% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -42%
Calls.AwaitAsyncCallClosureTargetPolymorphic -41%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -39%
Calls.AwaitFutureOrCall -55%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -54%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -53%

JIT, arm:
AsyncLiveVars.* +64-71% (bigger is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% (less is better)
Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -48%
Calls.AwaitFutureOrCall -64%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -64%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%

JIT, arm64:
AsyncLiveVars.* +65-78% (bigger is better)
Calls.AwaitAsyncCall -51% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -51%
Calls.AwaitAsyncCallClosureTargetPolymorphic -50%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49%
Calls.AwaitFutureOrCall -69%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -68%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -67%

AOT, x64:
AsyncLiveVars.* +55-61% (bigger is better)
Calls.AwaitAsyncCall -47% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -46%
Calls.AwaitFutureOrCall -59%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -59%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -58%

AOT, arm:
AsyncLiveVars.* 54-66% (bigger is better)
Calls.AwaitAsyncCall -46-51% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -46-50%
Calls.AwaitAsyncCallClosureTargetPolymorphic -46-52%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45-50%
Calls.AwaitFutureOrCall -63-68%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -63-66%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%

AOT, arm64:
AsyncLiveVars.* +53-66% (bigger is better)
Calls.AwaitAsyncCall -50-51% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -50%
Calls.AwaitAsyncCallClosureTargetPolymorphic -50-51%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49-50%
Calls.AwaitFutureOrCall -66-68%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -66-68%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378

Change-Id: I65e3702fcd816ee3fee876ff442b9887c035b1ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243102
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-10 14:38:28 +00:00
Alexander Markov de43a7c16a [vm] Cleanup --lazy-async-stacks VM option
This option was enabled by default in https://dart-review.googlesource.com/c/sdk/+/149288
This change removes old logic behind --no-lazy-async-stacks
and makes --lazy-async-stacks/--no-lazy-async-stacks options no-op.

TEST=ci

Change-Id: I5726690e90e78dd2ac37d8c5944e388042fc3acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247780
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-10 13:41:24 +00:00
Alexander Markov a765ba1006 [vm] Handle dropped pragma class in Library::FindPragma
AOT compiler can remove pragma class from ObjectStore.
This change fixes Library::FindPragma to handle this situation.

TEST=service_2/pause_on_unhandled_exceptions_catcherror_test

Change-Id: I5f58ebcb0f1e3b1c2e658ad19bfdea4c72577a7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247763
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-06-09 17:52:19 +00:00
Siva Annamalai 5cb3b37c74 Revert "Refactor _Future."
This reverts commit 69f32d6ad7.

Reason for revert: We seem to have a number of tests failing with timeouts in CBUILD after this change, please see logs at
69f32d6ad7

Original change's description:
> Refactor `_Future`.
>
> This is a major rewrite of the `_Future` class,
> which is the default implementation of the `Future` interface.
>
> The main goal was to reduce the number of expensive type checks
> in the internal passing around of data.
> Expensive type checks are things like
> * `is _Future<T>` (more expensive than just `is _Future`, the latter
>   can be a single class-ID check.
> * Covariant generic parameter checks (using `T` covariantly in a
>   parameter forces a run-time type check).
>
> Also removed some plain unnecessary casts and turned some
> implicit casts from `dynamic` into `unsafeCast`s.
>
> This seems to be an success, at least on very primitive benchmarks, according to Golem:
> FutureCatchErrorTest    41.22% (1.9 noise)
> FutureValueTest         46.51% (2.8 noise)
> EmptyFutureTest         59.15% (3.1 noise)
> FutureWhenCompleteTest  51.10% (3.2 noise)
>
> A secondary goal was to clean up a very old and messy class,
> and make it clearer for other `dart:async` how to interact
> with the future.
>
> The change has a memory cost: The `_FutureListener<S,T>` class,
> which represents a `then`, `catchError` or `whenComplete`
> call on a `_Future`, now contains a reference to its source future,
> the one which provides the inputs to the callbacks,
> as well as the result future returned by the call.
> That's one extra memory slot per listener.
>
> In return, the `_FutureListener` now does not need to
> get its source future as an argument, which needs a covariant
> generic type check, and the methods of `_Future` can be written
> in a way which ignores the type parameters of both `_Future`
> and `_FutureListener`, which reduces complex type checks
> significantly.
>
> In general, typed code is in `_FutureListener`, which knows both
> the source and target types of the listener callbacks, and which
> contains the futures already at that type, so no extra type checking
> is needed.
> The `_Future` class is mostly untyped, except for its "public"
> API, called by other classes, which checks inputs,
> and code interacting with non-native futures.
> Invariants ensure that only correctly typed values
> are stored in the untyped shared `_resultOrListeners` field
> on `_Future`, as determined by its `_state` integer.
> (This was already partially true, and has simply been made
> more consistent.)
>
> Further, we now throw an error in a situation that was previously
> unhandled: When a `_Future` is completed with *itself*.
> That would ensure that the future would never complete
> (it waits for itself to complete before it can complete),
> and may potentially have caused weird loops in the representation.
> In practice, it probably never happens. Now it makes the error
> fail with an error.
> Currently a private `_FutureCyclicDependencyError` which presents
> as an `UnsupportedError`.
> That avoids code like
> ```dart
> import "dart:async";
> void main() {
>   var c = Completer();
>   c.complete(c.future); // bad.
>   print("well!");
>   var d = Completer();
>   d.complete(c.future);
>   print("shucks!");
> }
> ```
> from hanging the runtime by busily searching for the end of a cycle.
>
> See https://github.com/dart-lang/sdk/issues/48225
> Fixes #48225
>
> TEST= refactoring covered by existing tests, few new tests.
>
> Change-Id: Id9fc5af5fe011deb0af3e1e8a4ea3a91799f9da4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244241
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,kustermann@google.com,sra@google.com,sigmund@google.com,nshahan@google.com

Change-Id: I455be5a04b4c346df26d4ded0fa7388baccb0f8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247762
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-09 16:51:55 +00:00
Lasse R.H. Nielsen 69f32d6ad7 Refactor _Future.
This is a major rewrite of the `_Future` class,
which is the default implementation of the `Future` interface.

The main goal was to reduce the number of expensive type checks
in the internal passing around of data.
Expensive type checks are things like
* `is _Future<T>` (more expensive than just `is _Future`, the latter
  can be a single class-ID check.
* Covariant generic parameter checks (using `T` covariantly in a
  parameter forces a run-time type check).

Also removed some plain unnecessary casts and turned some
implicit casts from `dynamic` into `unsafeCast`s.

This seems to be an success, at least on very primitive benchmarks, according to Golem:
FutureCatchErrorTest    41.22% (1.9 noise)
FutureValueTest         46.51% (2.8 noise)
EmptyFutureTest         59.15% (3.1 noise)
FutureWhenCompleteTest  51.10% (3.2 noise)

A secondary goal was to clean up a very old and messy class,
and make it clearer for other `dart:async` how to interact
with the future.

The change has a memory cost: The `_FutureListener<S,T>` class,
which represents a `then`, `catchError` or `whenComplete`
call on a `_Future`, now contains a reference to its source future,
the one which provides the inputs to the callbacks,
as well as the result future returned by the call.
That's one extra memory slot per listener.

In return, the `_FutureListener` now does not need to
get its source future as an argument, which needs a covariant
generic type check, and the methods of `_Future` can be written
in a way which ignores the type parameters of both `_Future`
and `_FutureListener`, which reduces complex type checks
significantly.

In general, typed code is in `_FutureListener`, which knows both
the source and target types of the listener callbacks, and which
contains the futures already at that type, so no extra type checking
is needed.
The `_Future` class is mostly untyped, except for its "public"
API, called by other classes, which checks inputs,
and code interacting with non-native futures.
Invariants ensure that only correctly typed values
are stored in the untyped shared `_resultOrListeners` field
on `_Future`, as determined by its `_state` integer.
(This was already partially true, and has simply been made
more consistent.)

Further, we now throw an error in a situation that was previously
unhandled: When a `_Future` is completed with *itself*.
That would ensure that the future would never complete
(it waits for itself to complete before it can complete),
and may potentially have caused weird loops in the representation.
In practice, it probably never happens. Now it makes the error
fail with an error.
Currently a private `_FutureCyclicDependencyError` which presents
as an `UnsupportedError`.
That avoids code like
```dart
import "dart:async";
void main() {
  var c = Completer();
  c.complete(c.future); // bad.
  print("well!");
  var d = Completer();
  d.complete(c.future);
  print("shucks!");
}
```
from hanging the runtime by busily searching for the end of a cycle.

See https://github.com/dart-lang/sdk/issues/48225
Fixes #48225

TEST= refactoring covered by existing tests, few new tests.

Change-Id: Id9fc5af5fe011deb0af3e1e8a4ea3a91799f9da4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244241
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-09 15:32:33 +00:00
Alexander Markov 3e0abdbb98 Reland "[vm] Enable new implementation of async/async* in JIT mode"
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I5b8720b8ef5b8d28773d26c7e94c2e78d876c9d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247603
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-09 15:24:13 +00:00
Alexander Markov e505ab1fd2 [vm] Fix stack trace collection while registering async callbacks in the Zone
During 'await', when registering 'then' and 'error' callbacks in
a custom Zone, the stack trace should be collected synchronously
as there are no awaiters yet, but the suspended function and its
callers are still on the stack.

This change corrects the new implementation of async to collect
these stack traces synchronously.

Class StackZoneSpecification from package:stack_trace relies on the
stack traces during callback registration in order to provide more
detailed chain of async stack traces via Chain.capture.
Without this change package:stack_trace captured truncated Chains.

Issue: https://github.com/dart-lang/sdk/issues/48378
Issue: https://github.com/flutter/flutter/issues/105340

TEST=vm/dart/causal_stacks/zone_callback_stack_traces_test

Change-Id: Iee348aa5c9abb4126f6c5d8215a6dc2cee57e124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247620
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-09 14:52:33 +00:00
Alexander Markov 3e9290df4f [vm] Skip caching of function entry points in Thread in JIT mode
Cached entry points of core library functions are only used
in AOT mode (JIT mode uses Function/Code objects instead of entry
points in order to call those functions).

This change removes storing entry points into the Thread.
It fixes TSAN error which reports a data race between JIT compilation
which installs Code and caching of entry points when scheduling
a thread.

TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/49194
Issue: https://github.com/dart-lang/sdk/issues/48378

Change-Id: Ib109118df414cd722001dad363e9e05a94ab0556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247501
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-06-09 14:21:33 +00:00
Michael Richards d635322b3d Added byte registers to the x86-64 disassembler
TEST=CI

Bug: 48656
Change-Id: I099e25d66e62094d471bebed88b8b4bad1df6c2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247463
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Richards <msrichards@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-06-08 22:57:03 +00:00
Ryan Macnak 3e17635bca [vm, gc] Refactor incremental marking to not require reserving a visitor in advance.
Allow multiple threads to contribute to incremental marking.

Also, avoid incremental markers handling large arrays that exceed their budget.

TEST=ci
Change-Id: Icefe490538ff486063a098077aaa962f0a3f2203
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247260
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-06-08 20:33:02 +00:00