Commit graph

19986 commits

Author SHA1 Message Date
Derek Xu 3ab116198c Revert "[ Observatory ] Add basic records support to Observatory"
This reverts commit fca7813650.

Reason for revert: Broke analyzer tryjob

Original change's description:
> [ Observatory ] Add basic records support to Observatory
>
> Fixes https://github.com/dart-lang/sdk/issues/50405
>
> TEST=Manual testing
>
> Change-Id: If14f434792c89e3509895fcdd17561df810798e3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268581
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Derek Xu <derekx@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,derekx@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I30c4404adb9ac8f1851a89a0c846cb70461e410c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269220
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Auto-Submit: Derek Xu <derekx@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2022-11-10 23:42:08 +00:00
Ben Konyi fca7813650 [ Observatory ] Add basic records support to Observatory
Fixes https://github.com/dart-lang/sdk/issues/50405

TEST=Manual testing

Change-Id: If14f434792c89e3509895fcdd17561df810798e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268581
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2022-11-10 17:50:51 +00:00
Derek Xu ba503c19af [VM/Service] Clarify documentation of RetainingObject
I checked if the retaining paths displayed on Observatory currently made sense, and they do. So, I think that the `getRetainingPath` responses currently being produced are correct, but they are not described well in the spec.

TEST=N/A

Change-Id: I6809ea9ea20574fd18bf5ee3d7d2c190aad62e7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-11-10 17:08:45 +00:00
Alexander Markov 3bcb19455f [vm/compiler] Cleanup yield_index from Return instruction
TEST=ci

Change-Id: Ib41689681a171ec93366dc6f5a09aa7d5707c5cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268780
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-11-10 15:03:57 +00:00
Tess Strickland c1afa7f85e [vm/compiler] Strip org-dartlang-sdk URI prefix to resolve DWARF paths.
Before, we only stripped `org-dartlang-sdk:///` as a prefix when it was
followed by `sdk/...`, which happens for code compiled with the Dart
SDK. However, the same prefix can show up in Flutter code (e.g.,
`org-dartlang-sdk:///third_party/dart/sdk/...`).  Thus, except for one
case, just strip the prefix at all times when `--resolve-dwarf-paths`
is set, leaving a relative path.

The one case is `org-dartlang-sdk:///flutter/`, which appears in the
resolved version of `dart:ui` (`org-dartlang-sdk:///flutter/lib/ui`),
where the `flutter` isn't part of the actual filesystem path. In this
case, we strip off the `flutter/` as well.

TEST=vm/dart{,_2}/use_resolve_dwarf_paths_flag

Bug: https://github.com/dart-lang/sdk/issues/44325
Change-Id: Ia9abca877e41657089a438d4723ff08a2e16fe69
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268762
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-11-10 09:33:22 +00:00
Tom Robinson a211fe7655 Add logging to trace invalid keys.
Per b/253491057, there are invalid keys (i.e. keys with value 0) being
passed around on occasion.  These keys are resulting in flaky test.

This change adds additional error logging to help determine when the
zero-valued keys are originating from.

This change also removes the zx_assert to avoid crashing when a
zero-value key is encountered, and instead an error is logged.

TEST=built for fuchsia and tested on nest hub device.

Bug: b/253491057
Change-Id: Ic94a3f526318ef2873d3af7a3ceab064b67859d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268603
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2022-11-09 21:59:28 +00:00
asiva b464175a29 [VM/Developer] Expose through the developer API a gc count for the isolate group that could potentially trigger execution of associated finalizers of objects that were collected.
TEST=reachability_test.dart

Change-Id: I27bdac49a4b7069ca428282d55d8ec572c9fc0e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266424
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-11-09 19:15:04 +00:00
Brian Quinlan b75f8aaaf5 [io/file] - add FileSystemNotFoundException
Thrown by when an operation fails because a file is not found.

TEST=updated unit tests
Issue: https://github.com/dart-lang/sdk/issues/12461
Change-Id: I2e6e3986f92d5bf9f3922f4e2c6bbba67cc102bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267280
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-11-08 19:26:19 +00:00
Kallen Tu 63b49dfc8e Deprecate checkValidIndex and avoid using it in the core library.
TEST=No new behaviour, existing tests pass.

Change-Id: Ia7a8e58543bd5e1d8dd14bd46c5083759333845b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259104
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-11-08 19:02:35 +00:00
Ryan Macnak ff3fb1114e [vm, compiler] Don't clobber preserved register in assembler test.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50401
Change-Id: Ia88c9809311c5901f331ab63a211ef55215c82a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268383
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-08 01:01:37 +00:00
Alexander Markov 10e9606861 [vm] More efficient 'is' tests for record types
'is' tests against record types are split into series of 'is' tests of
record fields. This is more efficient as record instances cannot be
added to subtype test caches (because type of a record instance
depends on types of its fields).

This change also adds canonicalization and constant evaluation of
LoadFieldInstr for record fields.

Performance on a trivial micro-benchmark (on x64):
JIT (RunTime): 4519104.5 -> 20031.5
AOT (RunTime): 4352583.0 -> 26281.6

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I2ed464cd3b31f365b17805f4e7debe1d6d1051fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268080
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-11-07 22:27:31 +00:00
Alexander Aprelev ce9a42f53e [vm/vmservice] Ensure only one vmservice http server is launched.
When many concurrent requests come in, it was possible to leak http servers, leading to hanging dart vms.

Fixes https://github.com/dart-lang/sdk/issues/50389
TEST=developer_server_launch_test

Change-Id: Icc59987a1a60af5ec72e0cb1ca7b43dea7f0c5e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268181
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-11-07 15:30:21 +00:00
Ryan Macnak 48b2d7e0e9 [vm, compiler] Remove surprising truncation from x64's LoadImmediate.
All other architectures have a LoadImmediate that works with any uword, but x64's truncated to 32-bit, causing surprising x64-only failures when LoadImmediate is used from architecture-independent parts of the compiler.

TEST=ci
Change-Id: Ia2b2cfd1df7396833e4508ed21b4995fc9af464b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268040
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-11-04 21:42:27 +00:00
Vyacheslav Egorov 8de4432f68 [vm] Do not leak string values of flags
Previously repetetively parsing some string valued
flags would cause their values to leak.

This change makes sure that we delete the previous
value when we assign a new one.

vm/cc/ParseFlags is extended to catch this when running
under ASAN.

TEST=tools/test.py -n dartk-asan-linux-release-x64 vm/cc/ParseFlags

Change-Id: I7478cdb48063dcae35d4129a4c9a2829dddae729
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267821
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-11-03 22:41:53 +00:00
Derek Xu 024a4603d1 [VM/Service] Move handling of closures in service to Closure::PrintJSONImpl()
TEST=CI

Change-Id: Iebb568837f5ed00c97eaadf0490a62cfbfb554bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267040
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-11-03 18:08:12 +00:00
Derek Xu d6415b2fe0 [VM/Service] Print Service IDs by default in PrintSharedInstanceJSON()
This CL adds the parameter `bool include_id` to
`PrintSharedInstanceJSON()` and makes it default to true. This CL also
removes `AddServiceId()` calls that are now unnecessary due to this
change.

TEST=CI

Change-Id: Ica53757a7fc23c70946be71f88408963e5aeae04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265041
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-11-03 18:08:12 +00:00
Tess Strickland 9ad1e36b17 [vm] Visit slots in objects with unboxed fields in Pass1Visitor.
In the heap snapshot writer, Pass1Visitor assigns object ids both to
heap objects and to Smis, and Pass2Visitor uses that information when
writing the heap snapshot. However, their logic for visiting slots in an
object with unboxed fields varies slightly. Pass1Visitor does not visit
each individual slot, but Pass2Visitor does. This means that SmiPtrs
that are only reachable via an object with unboxed fields are not added
to the writer in Pass1Visitor, and thus have an object id of 0 during
Pass2Visitor. This CL fixes this difference in visiting behavior.

TEST=vm/dart_2/heap_snapshot_regress_49711_test
     vm/dart_2/heap_snapshot_test

Fixes: https://github.com/dart-lang/sdk/issues/50341
Change-Id: Id238771af18ee098f39e6d1cc80e021dc8e117fe
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267580
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-11-03 17:50:58 +00:00
Alexander Markov 3afb674e52 [vm] Cleanup kernel format versioning from the VM
TEST=ci

Change-Id: I9116d0e60aa073733fee3ce523fb5cbc2fb692f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267440
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-11-03 15:44:25 +00:00
Derek Xu e3d6f448f2 [VM/Service] Ignore offset and count for record requests
TEST=CI

Issue: https://github.com/dart-lang/sdk/issues/49724
Change-Id: I995bd7f76a39f7dc281ed25b4ec20c2efe0468d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267660
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-11-03 15:22:38 +00:00
Alexander Markov b9dfd1a651 [vm] Specialize allocation for small records
This change introduces specialized stubs and IL instruction for
allocating records with 2 or 3 fields. This makes allocation of
small records slightly faster compared to a construction of similar
class instances and makes code size of record allocation smaller.

Benchmark:
MultipleReturns.NotInlined.Record(RunTime) 77150 -> 66222
MultipleReturns.NotInlined.RecordNamed(RunTime) 78073 -> 67044
MultipleReturns.Forwarded.Record(RunTime) 97130 -> 77635
MultipleReturns.Forwarded.RecordNamed(RunTime) 96495 -> 77904

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I8ed7add06b39ba79dfd78bbe2afaefe606cc505b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266420
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-11-03 15:06:35 +00:00
Vyacheslav Egorov 885cb4ce11 [vm] Suppress leak in Dart_SetVMFlags(...)
Flags parsing currently leaks string flag values
which is not a problem because users are not
expected to be calling SetVMFlags multiple times.

TEST=manually

Change-Id: Ie6e18a1142341b90c5345384a16b03a2947d69b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267361
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-11-03 11:29:09 +00:00
Johnni Winther 05ff50e6ca [kernel] Add View and ViewType
These are needed for the 'views' feature. No nodes are created yet.

TEST=existing

Change-Id: I0c7a34e460a4d17bd39ee23e7aa6bd8851f4275e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266620
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-11-03 08:42:06 +00:00
Derek Xu 40defeeb44 [VM/Service] Support records in the VM Service
This makes VM Service responses involving records comply with
https://docs.google.com/document/d/1gq7ZlH9My2qIrlFY7-pceNmabOPLLeLVMt6Z44KE7_8.

service.md and package:vm_service are not yet updated by this CL. They
will be updated in a future CL that makes as much of the service comply
with the above proposal as possible without introducing breaking
changes.
e.g., the future CL will make it so that both the `decl` and `name`
properties will be populated for fields of `PlainInstance`s.

TEST=CI

Issue: https://github.com/dart-lang/sdk/issues/49724
Change-Id: Iff798e391d28f137a000352c15e180f32e3d3969
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264782
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-11-02 19:32:54 +00:00
Johnni Winther 5baa4af7d8 [analyzer,cfe] Add 'views' feature and support for 'view class'
This adds the 'views' feature flag together with parser support
for 'view class'. If the feature is not enabled, an error is reported.

TEST=pkg/front_end/parser_testcases/views/...

Change-Id: I813ac86a0e7de9f0a5729c6d7ae35b82d1258ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265780
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2022-11-02 11:09:59 +00:00
Liam Appelbe e73cc6feb1 [vm] Fix coverage test regression
This was an existing bug that was exposed by
https://dart-review.googlesource.com/c/sdk/+/266640

Bug: https://github.com/dart-lang/sdk/issues/50356
Change-Id: Ib11ec1587d2b328da0c3e04d1202cf6e2171ec02
Fixes: https://github.com/dart-lang/sdk/issues/50356
TEST=pkg-linux-debug bot, where the failure was seen
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267145
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2022-11-02 01:32:52 +00:00
Alexander Aprelev 82dc3cbee9 [gardening] Fix closure naming, instruction_sizes_test
Fixes https://github.com/dart-lang/sdk/issues/48339
TEST=ci

Change-Id: I40b634e78b5b6744fd8c7c8d6d574bec333da82d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266820
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-11-01 14:50:02 +00:00
Martin Kustermann 251303f28f [vm] Remove support for old native "<name>" syntax in VM
The old `native "<name>"` syntax was lowered to `@ExternalName()`
annotations. Those have been deprecated in favor of
`@pragma('vm:external-name')`. Users have now been migrated and we can
therefore remove the VM support for `@ExternalName`.

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

TEST=ci

Change-Id: I69febe49f59627659c540dd50ad0fbf704b6c3a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266387
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-11-01 09:35:02 +00:00
Liam Appelbe 86233b55bc [vm] Skip filtered class earlier in source report.
The main benefit of this is that it avoids cls.EnsureIsFinalized for
skipped classes. In some cases (eg very small tests with dependencies
on very large 3rd party packages, such as flutter) this can reduce
coverage collection time by 20%.

Change-Id: Id756af7f2d2ecdd07a5d1d05a400cea4de7ec408
Bug: https://github.com/flutter/flutter/issues/100751
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266640
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-10-31 20:55:53 +00:00
Martin Kustermann ef8a308669 [gardening] Make --optimization-counter-threshold= not affect system isolates
We have many tests that explicitly use --optimization-counter-threshold=
flag. We also have a CI builder that uses this flag for all tests.

This is an issue for cases where `kernel-isolate` is not AppJIT'ed,
which is the case for simulators and ia32. Especially in debug builds
this causes a very-very slow time-to main due to JIT'ing the CFE code in
`kernel-isolate` and running flow graph checker etc (in debug mode).

This causes various tests to sporadically hit the timeout limit, become
flaky and require gardening attention.

As workarounds: the actual threshold was modified in tests, status files
were updated to mark tests as Pass,Slow etc.

=> This Cl will make `kernel-isolate` no longer be affected by the
   `--optimization-counter-threshold`
=> This should make the cycle times faster on those modes and avoid
   flaky timeouts that gardeners constantly have to pay attention to.

TEST=ci

Change-Id: Ia58e807b22f69f924315a43c6764427afe398ee6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266683
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-10-31 14:38:44 +00:00
Ryan Macnak a1089367cc [graphexplorer] Rename bounds variables for successor and predecessor iteration.
Based on suggestion from code review.

Change-Id: I51b3dbbd6f9822842f154cd90c9a020194ed16f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266443
Reviewed-by: Derek Xu <derekx@google.com>
2022-10-28 20:07:24 +00:00
Ryan Macnak a8fe399c79 [vm] Stricter checks when sending isolate messages between groups.
- Check against sending arbitrary classes via types.
 - Stop allowing any object from dart:core, dart:collection, dart:typed_data (effectively reverts 807eacae30).

`SendPort.send` does not require such objects are sendable, and there is no guarantee the receiving isolate can represent them.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50243
Change-Id: I7e9b0e9d83080d44a98b257cd8f2a58da5443a87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264725
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-10-28 19:18:51 +00:00
Ryan Macnak b7f4afaf27 [graphexplorer] Use owned size instead of retained size for groups.
Unlike retained size, owned size is a partitioning, so it can be naively summed. This replaces an almost quadratic step with a linear step.

TEST=load a large snapshot, such as from dart2js
Change-Id: I49479f6e17b911965def62e9b44fc202ce6a9b9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265961
Reviewed-by: Derek Xu <derekx@google.com>
2022-10-28 18:03:30 +00:00
Martin Kustermann 3b2b126f60 [vm] Remove of old native syntax in VM corelib implementations
Issue https://github.com/dart-lang/sdk/issues/28791

TEST=ci

Change-Id: I37ff9eaada17484a5fef4f97ec3bdcf83edf6f36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229962
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-10-28 12:45:35 +00:00
Daco Harkes 3d7aacda12 [tests] Migrate away from native
Aggregated test results:
Pass -> CompileTimeError (expected CompileTimeError)

bug: https://github.com/dart-lang/sdk/issues/28791
Change-Id: I4de6dc405be0fe4f2acf1a073fa9ab5210e49c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266022
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-10-28 09:16:40 +00:00
Vyacheslav Egorov 3aa7a9e2b4 [vm] Detect when class table overflows
We only have 16bits for cids so class table
can't contain more than 65535 classes.

TEST=ci

Bug: b/255934984
Change-Id: I79d45f4f28399b0a61293ace40b8718f2569ef3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-10-27 22:15:32 +00:00
Ryan Macnak 2399265dcc [vm, gc] Add missing write barrier to IA32 code patching.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50292
Change-Id: If2709d30067b0a56d1d6eceeb97e132c9e777752
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265860
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-27 16:05:39 +00:00
Ryan Macnak a99eb47cf6 [vm, service] Fix compressed pointers build.
TEST=ci
Change-Id: I86c7e478f2ea1b1607516dc1a23f7321d3ed66dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265861
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-26 18:48:07 +00:00
Ryan Macnak 2d6037a144 [vm, service] Include Smis in heap snapshots.
TEST=ci
Change-Id: Iadb3bb749da0d065c46bc723c7f5a8a8951b68bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265562
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-26 16:04:29 +00:00
Ryan Macnak 6d5c966e68 [observatory] Don't repeat storage of identity hashes in loaded heap snapshots.
TEST=ci
Change-Id: I4696f0e943f4b0dd5716ece285650aed85056c37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265521
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-26 16:02:50 +00:00
Sam Rawlins 9896f1c647 Enable the unnamed-libraries experiment by default in 2.19.0
TEST=tests/language/library/unnamed_library_test.dart

Bug: https://github.com/dart-lang/language/issues/1073
Change-Id: I1c7fa7b4ee4450e344a7613525765e4ab590cc8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265381
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-10-25 21:10:57 +00:00
Ryan Macnak 419d6381bb [graphexplorer] Use an explicit stack in forest compression to prevent JS stack overflow.
Compare Observatory's object_graph.dart.

TEST=load a large snapshot, such as from dart2js
Change-Id: Ifea2ff4c06f5103d6f1f709fa79183398df90687
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265404
Reviewed-by: Derek Xu <derekx@google.com>
2022-10-25 16:15:48 +00:00
Daco Harkes 762c507553 [vm/ffi] Outlining state transitions in AOT
For single argument FFI calls:
- reduces trampoline size significantly (up to 50%, 150-170 bytes),
- reduces the compressed size of GPay by 2.5kb on arm64,
- regresses performance on arm64 (up to 2.5%).
For more arguments, percentage-wise size gains and speed regressions
are smaller.

Only applied on arm and arm64, we care about code size for these.

Note: On Raspberry Pie (arm), the performance regression on single-
argument calls regresses up to 30%.

TEST=tests/ffi/*

Design doc: https://go/dart-ffi-outline-state-transitions
Closes: https://github.com/dart-lang/sdk/issues/50094
Change-Id: I8b8d7da45f69be6ac1432b11b695de71e56acfd1
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-nnbd-mac-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262343
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-10-25 13:07:34 +00:00
Lasse R.H. Nielsen c13676f2b7 Deprecate FallThroughError.
The error has not been thrown since Dart 2.0,
where being able to reach the end of a switch case
became a compile-time error.

TEST=Removes tests depending on discontinued behavior.

Change-Id: I76292e7c73f2b3aaf071bbb290e97db493b75477
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261860
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2022-10-25 12:25:35 +00:00
Daco Harkes f524ec74ce [vm/ffi] FfiNative process lookup
This CL makes `FfiNative`s use `DynamicLibrary.process()` lookup if
resolving with the resolver set by `Dart_SetFfiNativeResolver` fails.

Also moves the implementation over from ffi.cc to
ffi_dynamic_library.cc so the implementation can be shared with
`DynamicLibrary.process()`.

Moves the implementation behind non-simulator and non-precompiler.
However, the implementation is tested in vm/cc tests which are in
precompiler mode. So enables the implementation if TESTED is defined.

This CL massages the build files so that TESTED is properly
defined when compiling the runtime for the vm/cc tests, and links
the ole32 symbols on windows for vm/cc tests.

(And some unrelated small cleanup changes here and there.)

TEST=tests/ffi/native_assets/process_test.dart

Change-Id: I25395d381db1d9b4b7a5759171a798a1140a6140
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,dart-sdk-win-try,vm-kernel-win-release-x64-try,vm-kernel-win-release-ia32-try,vm-kernel-precomp-win-product-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264982
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-10-25 10:57:07 +00:00
Alexander Markov e70dec4e82 [vm] Allocation sinking of records
This change adds all necessary support for allocation sinking and
materialization of record instances.

TEST=vm/cc/AllocationSinking_Records

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I040ce8b1ed3220f87a767b590050de3e50573170
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265380
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-10-24 23:00:47 +00:00
Ryan Macnak 9319d07e11 [vm] Fill in ArgumentValue.invalidObject when objects are rejected in isolate messages.
TEST=ci
Change-Id: I5a2816ce7fd40463aaffd971d867955a7b2bd7e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265043
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-24 17:49:29 +00:00
Ryan Macnak 578b602dec [vm] Remove dead code from the message serializer.
Intra-group messages are now always handled by the copier instead of the serializer, so the serializer no longer needs to handle all types.

TEST=ci
Change-Id: Iabe3e464cc2a5bc9e3296660a5d15124fbede3bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265160
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-10-24 17:24:55 +00:00
Ryan Macnak 84df527eba [vm, gc] Strengthen heap verification to disallow pointers to free list elements and forwarding corspes.
TEST=ci
Change-Id: I9b0f082e1bdf4c037bac3b2359fe8304ee0fda81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265003
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-10-20 23:12:15 +00:00
Ryan Macnak 1959041301 Reapply "[vm, gc] Add separate marking verification."
Fix compressed pointers builds.

TEST=ci
Change-Id: I761b39752991e5113d1d333f1f0004d967445c80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265040
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-10-20 22:18:07 +00:00
Alexander Aprelev 8c0df46887 [vm] Better implementation of hashCode function.
With this cl hashCode function for integers which used to be identity function becomes `uint128_t hash = value * constant; hash ^= hash >> 64; hash ^= hash >> 32; hash &= 0x3fffffff`. Note that the hashCode has to stay the same across platforms(64-bit/32-bit).

This dramatically improves performance of integer HashSet/HashMap lookups when integers differ in higher bits only(see the issue referenced below).

AOT ARM64 benchmarks:
===
WordSolverIdentity -3.630% (-0.9 noise)
BigInt.parse.0064.bits 15.43% (0.9 noise)
BigInt.parse.4096.bits 40.80% (1.6 noise)
BigInt.parse.0256.bits 42.01% (2.3 noise)
BigInt.parse.1024.bits 50.91% (2.6 noise)
IntegerSetLookup.DefaultHashSet 549916% (14727.6 noise)
IntegerSetLookup.DefaultHashSet 597150% (55520.2 noise)
IntegerSetLookup.HashSet 846924% (78126.7 noise)
IntegerSetLookup.HashSet 791864% (107221.1 noise)
===

AOT x64:
===
Havlak -14.25% (-1.7 noise)
DartMicroBench.Int64Div -7.091% (-1.2 noise)
ObjectHash.manual.5 -9.541% (-0.8 noise)
AsyncLiveVars.LiveInt1 4.726% (0.8 noise)
IsolateJson.SendAndExit_Decode1MBx1 9.067% (0.8 noise)
SplayHarderLatency 4.629% (0.9 noise)
TypedDataDuplicate.Float64List.32.loop 35.01% (1.8 noise)
IntegerSetLookup.DefaultHashSet 627996% (124823.6 noise)
IntegerSetLookup.HashSet 1245362% (244705.3 noise)
===

JIT ARM64:
===
IntegerSetLookup.DefaultHashSet_Random 73.80% (1.2 noise)
IntegerSetLookup.DefaultHashSet 344999% (6202.9 noise)
IntegerSetLookup.HashSet 483731% (7845.7 noise)
===

JIT x64:
===
CollectionSieves-Set-removeLoop -6.294% (-0.9 noise)
Utf8Encode.ru.10M 59.11% (0.8 noise)
Utf8Encode.ru.10k 71.62% (0.9 noise)
Utf8Encode.zh.10M 53.93% (0.9 noise)
Utf8Encode.ne.10k 71.34% (0.9 noise)
Utf8Encode.zh.10k 72.52% (0.9 noise)
Utf8Encode.ne.10M 53.17% (0.9 noise)
IntegerSetLookup.HashSet_Random 27.80% (1.1 noise)
String.replaceAll.String.Zero 8.659% (1.2 noise)
IntegerSetLookup.DefaultHashSet_Random 96.20% (1.3 noise)
IntegerSetLookup.HashSet 481037% (18028.8 noise)
IntegerSetLookup.DefaultHashSet 454450% (31501.3 noise)
==

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

Change-Id: Id982e4aa30cd1d6a63f93c73917a8b921ad464a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258600
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-10-20 20:31:20 +00:00