Commit Graph

18813 Commits

Author SHA1 Message Date
Ben Konyi cccc0293c5 [ VM ] Send 'dart --help [--verbose]' output to stdout
This is consistent with the majority of other tools and the CLI
behavior.

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

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

Change-Id: I45a3ddc9728e9cc1a273d4d5f11db74cb8104745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204661
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-08-06 16:06:05 +00:00
Ben Konyi b225582593 [ Service ] Disable CPU sample block streaming
See https://github.com/dart-lang/sdk/issues/46825

TEST=vm/cc/Profiler_* and service tests

Change-Id: I98faa1953a3bf3c28828dabaa0be6b033ada63fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209260
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-08-06 16:02:55 +00:00
Ryan Macnak 536541cd3a [vm, compiler] Use inferred types from TFA even if they are interface types.
In some cases, this brings the type of a phi and the type of its inputs into agreement.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46799
Change-Id: I8383a6fceb85cab2eff310d9e38661f868da15d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-06 00:01:51 +00:00
Ryan Macnak 479430235c [vm] Fix Zone corruption by GrowableArrayStorageTraits::Array.
HashTable<..., GrowableArrayStorageTraits> passes the zone to placement-new of GrowableArrayStorageTraits::Array. Because this class did not extend ZoneAllocated, the default placement-new interpreted the zone as the allocated address and clobbered the beginning of the zone.

TEST=build
Change-Id: I95805e00b3012f5282f11cfb6da1567f00d56c46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208982
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-08-05 21:47:27 +00:00
Ryan Macnak e908c9c2e8 [vm] Don't check for unboxed fields in the JIT; don't check for field guards in AOT.
TEST=ci
Change-Id: Iefc4fe4ea2547fd11aea461ae222c6e40ccf54c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208688
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-05 21:38:51 +00:00
asiva 11fafd0294 [VM/Runtime] - Fix racy access to port set in port map
- Delete the port set during cleanup while holding the lock
- Check for port set being valid in every function that accesses
  the port set to avoid racy access while the VM is shutting
  down (e.g: Dart_InvokeVMServiceMethod)

TEST=ci

Change-Id: Ib5c3a6a36260820c040304d03fdc49558dae611b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208983
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-05 20:46:12 +00:00
Alexander Markov acb969fb6d [vm] Relax assertion for failed type check during identity hot reload
TEST=standalone_2/io/socket_sigpipe_test in reload/debug configuration
Fixes https://github.com/dart-lang/sdk/issues/46820
Fixes https://github.com/dart-lang/sdk/issues/45829
Fixes https://github.com/dart-lang/sdk/issues/45135
Fixes https://github.com/dart-lang/sdk/issues/44065

Change-Id: I3684a9585ecf7c9a3dfa9615b63772a223e400a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209161
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-05 19:19:41 +00:00
Alexander Markov 56bd70b257 [vm] Correct comment
Follow-up to https://dart-review.googlesource.com/c/sdk/+/208981/comments/b4974489_d4a790dd.

TEST=change in comment

Change-Id: Ic581331843924da555dc528c8995943a94b7cef7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208985
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-08-05 00:37:47 +00:00
Alexander Markov f9c8f3c920 [vm] Fix equality of implicit static closures
There could be multiple instances of implicit static closures due to
instantiations at run time:

void foo<T>(T x) {}

void bar<T>() {
  void Function(T) myfoo1 = foo;
  void Function(T) myfoo2 = foo;
  print(myfoo1 == myfoo2);
}

This change fixes equality to handle this case.

TEST=language/generic_methods/explicit_instantiated_tearoff_test
TEST=language/constructor/tear_off_test

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

Change-Id: I485acc5444d19860ef4d8ebeec2e540fe57776d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208981
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-04 22:59:09 +00:00
Alexander Markov 32914654bd [vm] Treat redirecting factories as ordinary factories
After https://dart-review.googlesource.com/c/sdk/+/208681
it is now possible to use bodies of redirecting factories in the VM
and treat redirecting factories like ordinary factories.

TEST=vm/cc/DartAPI_New
TEST=vm/dart/redirection_type_shuffling_test
TEST=co19/LanguageFeatures/Constructor-tear-offs

Fixes https://github.com/dart-lang/sdk/issues/33041
Fixes https://github.com/dart-lang/sdk/issues/29201
Issue https://github.com/dart-lang/sdk/issues/46231

Change-Id: If410d2913704a33035800144699fd6e8a2570a19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208684
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-04 21:50:48 +00:00
Ryan Macnak a302550068 [vm] Fix the native port deserializer to interpret as_typed_data.length as counting elements instead of bytes.
This brings the native port deserializer into agreement with the native port serializer and the interpretation of TypedData::length_.

TEST=ci
Change-Id: I52eb28af7292fc15b0ad4779dc4d4e723f6e128b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208283
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-04 18:23:28 +00:00
Ben Konyi ada4278fd5 Revert "Reland "[ package:dds ] Add support for caching CPU samples based on UserTag""
This reverts commit 1796160606.

Reason for revert: Still seeing failures.

Original change's description:
> Reland "[ package:dds ] Add support for caching CPU samples based on UserTag"
>
> This reverts commit 4160747ef6.
>
> It seems like 9397b8ff05 should have fixed the original failures we were seeing and the failing bots in question seem to be passing when running try jobs.
>
> TBR=asiva@ (discussed offline)
>
> TEST=Existing service tests + get_cached_cpu_samples_test
> Change-Id: I1c50c0e79375df819a0bd68e68ac28c3064874c8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208441
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

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

Change-Id: Ic522ab61b430673533c94ecd0c91bee569a0add6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208960
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-04 17:32:38 +00:00
Ryan Macnak 782bcb4aed [vm] Process the forward tables during become.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46731
Change-Id: Ie382c3f6b7b5f98153f1d6cc099d43a247f8ccd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208683
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-04 15:49:57 +00:00
Johnni Winther 43c00097c2 [cfe] Remove isOptOutTest work-around
Change-Id: I7dd125508bba256eb4c78b02fb24e433f45b129a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205420
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-04 10:44:00 +00:00
Johnni Winther 5dc4d65114 [kernel] Add InvalidExpression.expression
... and use this to wrap expressions instead of Let

TEST=existing

Change-Id: I6d1f5cfa4693222840d6cb406790c39c6ae63e5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-04 08:40:18 +00:00
Daco Harkes e79e0020ce [vm] Move kHashBits to Object
TEST=This is a refactoring, existing tests suffice.

Change-Id: I6c380b796bf8e9c2414e93984f000b28790b967d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208656
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-08-04 07:55:40 +00:00
Ryan Macnak 5208456b5a [vm] Fix compressed pointer gen_snapshot profiling crash
Combines one and two byte string serialization into a unified
string serialization cluster that's built on CanonicalSet
serialization. This approach is already used when serializing
to RO data, but we can't use RO data in compressed mode.

Change-Id: I28b2473efbc855c0d30fa9ec39fa9c6d42dc2b67
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208022
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-08-03 20:17:20 +00:00
Ryan Macnak 5c164c57f5 [vm] Remove NoReloadScope from Exceptions::Create.
TEST=reload bots
Bug: https://github.com/dart-lang/sdk/issues/46731
Change-Id: If347196567f1c19516a5ae52ebfa1073d7ece634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208685
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-03 20:04:11 +00:00
Ryan Macnak d9bb68f93a [vm] Fix serialization of SIMD vectors.
Broken by bbefc05748.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46793
Change-Id: I8e5869caee2d705cecaf974cca3ee3f0c542ad3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208840
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-08-03 19:48:50 +00:00
Ben Konyi 1796160606 Reland "[ package:dds ] Add support for caching CPU samples based on UserTag"
This reverts commit 4160747ef6.

It seems like 9397b8ff05 should have fixed the original failures we were seeing and the failing bots in question seem to be passing when running try jobs.

TBR=asiva@ (discussed offline)

TEST=Existing service tests + get_cached_cpu_samples_test
Change-Id: I1c50c0e79375df819a0bd68e68ac28c3064874c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208441
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-03 19:18:59 +00:00
Alexander Markov f7078b3d68 [vm/compiler] Fix Handle passed to AllocateObject instruction while generating constructor tear-off
All handles passed to IL instructions should be ZoneHandles.
Recently added code for generating constructor tear-offs has been
passing Handle instead of ZoneHandle by mistake.

This change fixes the bug and adds assertions to AllocateObjectInstr so
it would check handle type earlier and on all platforms.

TEST=co19/LanguageFeatures/Constructor-tear-offs in debug/ia32 mode

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

Change-Id: I99e6889e59bf40f4788a7f3c6d37dad89aa91ab0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208686
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-03 16:39:39 +00:00
Daco Harkes 6c21348008 [vm] Introduce HAS_SMI_63_BITS
TEST=This is a refactoring, existing tests cover this.

Change-Id: I19c062bcf3d468814e2c2ecfacc9a65050925fc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208650
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-08-03 13:19:01 +00:00
Alexander Aprelev af50a684d1 [vm/concurrency] Grab constant_canonicalization_mutex before entering Safepoint scope.
If we attempt to acquire mutex once we are in Safepoint scope, we might never get it because some other thread force to a safepoint is actually holding that mutex already.

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

TEST=issue_6610_test on debug build

Change-Id: I4fc7154aae075c608af8facf53a029ddf5d0de2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208520
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-08-02 14:59:10 +00:00
Alexander Markov eec08e1864 [vm] Support tear-offs for generative and factory constructors
TEST=co19/LanguageFeatures/Constructor-tear-offs
Issue: https://github.com/dart-lang/sdk/issues/46231
Change-Id: I177d0d77eac32b49d39949d696de8aa9a618cc6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208442
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-07-30 18:50:27 +00:00
Ryan Macnak 2a99af9bc9 [vm] Avoid a copy when deserializing typed data to Dart_CObject.
Address regressions in the FileIO_write_* benchmarks.

TEST=ci
Change-Id: I87e9ddffc92b7cbd82a5d37477e649bdca03818f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208483
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-07-30 15:32:57 +00:00
Ryan Macnak bbefc05748 [vm] Rewrite isolate message serialization.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/25559
Bug: https://github.com/dart-lang/sdk/issues/27285
Bug: https://github.com/flutter/flutter/issues/84691
Change-Id: I04608c5d337144195748d5f3509a29eb3116585d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207865
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-07-29 16:55:55 +00:00
Ryan Macnak 7b0b8658d8 [dartfuzz] Revert change to dartfuzz_test that made a compile-time error in both runs count as a divergence.
This partially reverts 1ce169d940.

Change-Id: I2d7e6ea442d9d81a9b3b892359db24f0dc48a81f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208360
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-07-29 16:33:39 +00:00
Ryan Macnak a56c6ccab9 [vm] Fix gcc build.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46748
Change-Id: I21807884d974a918adf2aec91f2e2a8d06504776
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-07-28 19:57:54 +00:00
Alexander Markov 730ab0583d Migrate pkg/vm to null safety, part 5
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/46620
Change-Id: Ifc5fe377b5dd8273a45ca0c28fcd27527baae146
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208021
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-07-28 18:38:30 +00:00
Alexander Markov 4160747ef6 Revert "[ package:dds ] Add support for caching CPU samples based on UserTag"
This reverts commits 746b8f1f5c and
9ee2259fde.

Reason for revert: https://github.com/dart-lang/sdk/issues/46746

Original change's description:
> [ package:dds ] Add support for caching CPU samples based on UserTag
>
> DDS can be configured to listen for CPU sample events and cache samples
> that were collected while certain UserTags are active. These cached
> samples are stored in a ring buffer and are stored until the isolate
> shuts down.
>
> TEST=pkg/dds/test/get_cached_cpu_samples_test.dart
>
> Change-Id: Ib20770f59f1672c703413486f87795b3bb23f676
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207206
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>

TEST=ci
TBR=bkonyi@google.com,rmacnak@google.com,kenzieschmoll@google.com

Change-Id: I1b6655ad7e3b10e1145ff545cc90ecf3bc6e092d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208341
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-07-28 18:00:25 +00:00
Johnni Winther cb3a9b0043 [cfe] Remove old method invocation encoding nodes
TEST=existing

Change-Id: I05ee649ecfa7945e2e0f5e5d09441d8916a9c46e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208185
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-07-28 15:44:04 +00:00
Tess Strickland 9397b8ff05 [vm/profiler] Handle out of blocks case in ReserveSampleAndLink.
Both SampleBlock::ReserveAllocationSample and
SampleBlock::ReserveCPUSample can return nullptr, so that needs to be
appropriately handled in SampleBlock::ReserveSampleAndLink. The only
caller of the latter checks for nullptr, so pass though nullptr results
from the former methods.

TEST=Fixes current service tests failures on some trybots,
     see test results on CL.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,app-kernel-linux-debug-x64-try
Change-Id: Ib70cc6726862bc5fe3bfb0c06ee2aae84ec026c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208321
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-07-28 11:14:53 +00:00
Clement Skau 94bdcc2084 [VM] Adds native field accessor in Dart.
Adds GetNativeField(o,i) to access NativeFieldWrapperClass{1-4}
native fields directly in Dart instead of through VM API.
This will allow us to pass `this` as a raw pointer instead of as
a Dart handle which needs to be unwrapped.
This will in turn allow ffi native calls for instance methods.

TEST=Adds vm/cc/DartAPI_NativeFieldAccess

Bug: https://github.com/dart-lang/sdk/issues/43889
Change-Id: I8006c735569fcbe5e49915a4c7e72c4ca85b356e
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205482
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-07-28 08:31:17 +00:00
Ben Konyi 746b8f1f5c [ package:dds ] Add support for caching CPU samples based on UserTag
DDS can be configured to listen for CPU sample events and cache samples
that were collected while certain UserTags are active. These cached
samples are stored in a ring buffer and are stored until the isolate
shuts down.

TEST=pkg/dds/test/get_cached_cpu_samples_test.dart

Change-Id: Ib20770f59f1672c703413486f87795b3bb23f676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207206
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
2021-07-28 00:33:33 +00:00
Alexander Aprelev 94a40a6b09 [vm/concurrency] Do symbol table lookup without read lock.
Instead use acq/rel atomics for symbol table read/write.

Symbol lock read and write acquisition time(per simple lock acquisition time tracking from https://github.com/dart-lang/sdk/issues/46252#issue-910738294) reduced from
===
IsolateGroup main shutting down:
RWlock read: 1211 ms, write: 151
===
to
===
IsolateGroup main shutting down:
RWlock read: 7 ms, write: 63
===

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

TEST=IsolateSpawn on tsan

Change-Id: Ic8605c18511eba08a21202ca030b527af0a0fbc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207340
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-07-27 20:54:07 +00:00
Martin Kustermann 6541c00d51 [vm/concurrency] Disable dart api isolate test in artificial hot-reload scenarios
The vm/dart{,_2}/isolates/dart_api_create_lightweight_isolate_test test
shouldn't run in our artificial hot-reload configurations since it is
effectively doing embedder related code in Dart instead of C.

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

TEST=ci

Change-Id: I3be86d627fef8c3f8aa61f62ec01ef36d1768ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208182
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-07-27 15:48:07 +00:00
Tess Strickland c49560cd37 [platform] Make NBitMask, Bit, and TestBit constexpr.
Also make NBitMask generic, replace uses of SignedNBitMask
with generic NBitMask, and remove SignedNBitMask.

TEST=No changes to functionality for existing callers, so existing tests.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try
Change-Id: Ic33785e50be98123c75782c6e62ef32ec45f4191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208181
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-07-27 11:22:47 +00:00
Daco Harkes 0e815baac6 [vm] Reorder fields in LinkedHashBase
Split off https://dart-review.googlesource.com/c/sdk/+/203765 to make
that diff smaller.

Serializing the index incurs a large size penalty to snapshots. Rather
than serializing, we reconstruct the index based on the hashes that we
do serialize for all canonical objects. (Reconstructing the index is a
relatively cheap operation, recomputing the hashes is not.)

Note that to_snapshot is currently dead code, because we never serialize
non-const maps and sets in clustered snapshots.

Of course we do exercise the layout of the maps and sets itself.

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

TEST=The whole test suite including all map and set tests.

Change-Id: If54117497029e4da212c702a76c82de6d1531092
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208086
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-07-27 10:34:47 +00:00
Martin Kustermann 87eb37a19a [vm] Encapsulate lookup of Symbol members in ObjectStore
For members of program structure that we cache in the ObjectStore we try
to provide only read-only access in the public API. The lazy population
is encapculated in the ObjectStore class.

Use the same mechanism we use for core/isolate/... library members also
for the `dart:_internal` members.

Furthermore cache the Symbol._name field in the ObjectStore to avoid
expensive lookup as well as avoid an extra TLS lookup.

TEST=Existing test suite.

Change-Id: I299faceb39f20576e23244c71c58d698f80f80c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208180
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-07-27 09:58:58 +00:00
Daco Harkes 6c4f9f0045 [vm] Use ClassId in Instance::CanonicalizeHash
We want to reuse CanonicalizeHash for const maps and sets. See design in
go/dart-vm-const-maps.

Before, we only used CanonicalizeHash on a per-class basis. However,
when we start using it for const maps and sets we don't want hash
collisions between const instances with identical layout but a different
class id. So we include the class id into the hash rather than the size.

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

TEST=vm/cc/CanonicalizeHash_Const_Instances
TEST=A ton of bots for existing tests.

Change-Id: Idc0eed49fbae8f76dcfdda21dd9fe2674dc4a240
Cq-Include-Trybots: luci.dart.try:analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208085
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-07-26 16:05:36 +00:00
Daco Harkes 12d1bc7236 [vm] Change Symbol CanonicalizeHash to hashCode
Aligns the CanonicalizeHash for Symbol with it's hashCode in Dart.

Motivation for aligning hashCode and CanonicalizeHash in
go/dart-vm-const-maps.
Bug: https://github.com/dart-lang/sdk/issues/45908

TEST=runtime/vm/object_test.cc

Change-Id: I228405364c930d81a269fd87cbc59cf95e97c649
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206260
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-07-26 11:39:54 +00:00
asiva 34724ec715 [VM/Runtime] Expose OS::GetCurrentMonotonicTicks as Dart_TimelineGetTicks
Add Dart_TimelineGetTicks and Dart_TImelineGetTicksFrequency to the
dart_api.h per the request made in
https://github.com/dart-lang/sdk/issues/46665

TEST=added new unit test in dart_api_impl_test.cc

Change-Id: Ib37ec2088d2e61f56e61026e431c3777608cd9a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207900
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2021-07-23 15:19:30 +00:00
Ryan Macnak e8ee5d4791 [vm] Make Windows and Posix agree on the layout of AbstractType and subclasses.
TEST=ci
Change-Id: I9299853a99aad247f8e8ec1c4d2fbbfc462a4067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207702
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-07-23 02:28:05 +00:00
Alexander Aprelev f4efd1dc44 [vm/concurrency] Remove file_write_as_test from iso-stress test suite.
The test seems to be hanging, remove it to green the bot.

BUG=https://github.com/dart-lang/sdk/issues/46694
TEST=iso-stress test bot

Change-Id: I4b1f27354208f24395d41bfca0403cbabdb4ce35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207922
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-07-23 02:17:40 +00:00
Ben Konyi bfff8613b7 [ VM / Service ] Add function signature, type parameter information to the service protocol
Allows for function objects to be displayed in an understandable fashion
in developer tooling (e.g., a DevTools program structure inspector).

Also adds 'implicit' property to @Function which specifies whether or not a function was defined implicitly (e.g., getter/setter).

TEST=service/get_object_rpc_test.dart

Change-Id: I2da1aa15c58635046b905e205bfd29d654bbde2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203200
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-07-23 01:20:25 +00:00
Alexander Aprelev 3b7b45b909 [vm/concurrency] Remove stream_from_iterable_test from iso-stress test suite.
The test seems to be hanging, remove it to green the bot.

BUG=https://github.com/dart-lang/sdk/issues/46694
TEST=iso-stress test bot

Change-Id: I9013819a3367bb24a130f28e4791035ae9801f8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207780
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-07-22 19:00:25 +00:00
Ben Konyi 3b1e83387f [ VM ] Add --mark-main-isolate-as-system-isolate flag
Allows for tools like the Dart test runner to hide the main isolate by
marking it as a system isolate, only showing the isolates users are
interested in.

TEST=pkg/vm_service/mark_main_isolate_as_system_isolate_test.dart

Change-Id: I24d0f20614e89076a05499c206d576c355489a13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207203
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-07-22 18:15:10 +00:00
Alexander Markov 6128a39d85 [vm/compiler] Fix handling of delayed type arguments in case of inlined closure call
Previously, prologue builder omitted loading of delayed type arguments
from closure object in case of inling. This would effectively switch
from using delayed type arguments of an instantiated generic closure to
type arguments passed on the stack (null/all-dynamic if none), which is
not correct.

The fix is to load delayed type arguments from closure object even
in case of inlining.

TEST=tests/language/regress/regress46550_test.dart
Fixes https://github.com/dart-lang/sdk/issues/46550

Change-Id: Ibe50b0bc2ebda1d3638c4940fe9a26cd5ba7ce32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207704
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-07-22 17:33:39 +00:00
asiva be3c482bc3 Reinitialize the static fields in the corresponding Init functions so
that we do not have any state mismatch when the Dart VM is initialzed
and cleaned up multiple times.

TEST=existing unit test in the engine which is failing in a flaky manner

Change-Id: I073ca2b53a8c3d386be46b5222d547a29513714a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207642
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-07-21 18:12:34 +00:00
Alexander Markov 303b7a7ced [vm] Make ObjectStore::future_{timeout,wait}_future_index fields atomic
TEST=iso-stress bot
Fixes https://github.com/dart-lang/sdk/issues/46664

Change-Id: I37aeb3bb420d3d524e93564630b674728c995061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207504
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-07-20 22:36:40 +00:00