Commit Graph

13467 Commits

Author SHA1 Message Date
Tess Strickland 8239fecf1a [gardening] Fix build errors on GCC bot.
TEST=Build succeeds on GCC trybot.

Cq-Include-Trybots: luci.dart.try:vm-kernel-gcc-linux-try
Change-Id: I986137795edd28f7ad5bd42dcfe83af4576641f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209903
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-11 11:54:01 +00:00
Tess Strickland 45e6b6970e [gardening] Restrict ReloadTestScript to non-PRODUCT mode.
Fixes linking error on vm-kernel-win-product-x64.

TEST=Build succeeds on Windows PRODUCT trybot.

Cq-Include-Trybots: luci.dart.try:vm-kernel-win-product-x64-try
Change-Id: I6b433441ce0b1a112a03c9e8fb61d1bb59a2322c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209904
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-11 10:32:30 +00:00
Ben Konyi 2831d8af85 [ VM / Profiler ] Fix case where EnterSampleReaderLock could set the lock count using an uninitialized variable
TEST=Ran all service tests in parallel, was no longer able to reproduce
assertion failure

Change-Id: I884f160ce267ca2b7c4684ace901caa88ce19924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209762
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-10 22:38:51 +00:00
Ryan Macnak ae0880a5c0 [vm] Globally intercept new (zone) DoesNotExtendZoneAllocated().
Cf. 479430235c

TEST=ci
Change-Id: Ice55e5083096591b1c7e1243a12ea4aa160efb0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209740
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-08-10 21:10:01 +00:00
asiva f21c9d54ea [VM/Runtime] - Remove TimelineEventBlockIterator which is dead code.
Dead since ff2fd8fe54.

TEST=Deleted code, no new functionality added. Regular CI runs.
Change-Id: I95716abfe9807eba48dbbc7fa3efc7f58cd1b11d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209760
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-08-10 19:53:41 +00:00
Martin Kustermann 049921b45f [vm/concurrency] Add optimizations to avoid O(N) cost to find ICData in certain switchable call miss handler cases
This fixes a huge performance regression (introduced in [0]) of a
synthetic microbenchmark - MicroClosureCreateTearoffClassSecondTime -
that happens to have a gigantic function with a large number of call
sites in them.

All of those call sites stay monomorphic but all of them will have to
go to runtime for miss handler because the target code was disabled (the
unoptimized code got disabled, since optimized target code was
installed). The particular target function in question is
`_GrowableArray.add()`.

The cause for the regression is that the miss handler will lookup the
ICData based on linearly walking PcDescriptors to find deopt-id which it
uses to get ICData from function's ic-data array.

Interestingly enough it only regresses ia32 but not x64 (the only two
architectures this benchmark is run on). The reason for that is that
x64 uses exactness tracking and therefore doesn't switch to
monomorphic calls.

This CL:

If a monomorphic call site had a miss because the cached old target
was disabled, we go to runtime to find the real target. Another thread
may have transitioned the call site already from monomorphic to
polymorphic.

When resolving the target function we take advantage of a back reference
from the `ICData::entries()` back to the `ICData` to avoid the O(N)
lookups.

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

TEST=Existing test suite.

Change-Id: Ia066a846f5f50e5a575f0734c9453d2368f80780
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207133
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-10 18:03:21 +00:00
Tess Strickland 2c89455557 [vm/compiler] Create optimized TTS for plain Function type.
This does not handle more specific function types (those represented
using FunctionType objects), but just Type::DartFunctionType().

TEST=vm/cc/TTS_Function

Change-Id: I42ddd8818da5331eed748784b051cd2c78547b5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209703
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-10 17:54:42 +00:00
Vyacheslav Egorov 493fe772d0 [vm] Rewrite Double.~/ in pure Dart
Avoid going into runtime for every operation.

https://github.com/dart-lang/sdk/issues/46855

TEST=ci

Change-Id: I5ab1d224f895342c8dd7fb9b8a7a98cfb0359db0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209705
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2021-08-10 17:54:40 +00:00
Tess Strickland 51649b702d [vm] Allow optimized type testing stubs to be partial.
Previously, the code in the TypeCheck runtime entry assumed that if a
lazily specialized type testing stub (TTS) returned a false negative in
JIT mode, that it should always be regenerated and that regeneration
would always result in different code. In AOT mode, false negatives
instead always cause the stub to go to runtime, even if that false
negative had been seen before, because the assumption is that false
negatives shouldn't happen when the whole class hierarchy is known at
compile time.

However, even in the current implementation of optimized TTSes, there
are cases where this assumption is false. For example, the code
generated by BuildOptimizedSubclassRangeCheckWithTypeArguments allows
for provided type arguments to be type parameters. When this happens,
the type parameter is instantiated at runtime using the instantiator or
function type arguments, and the instantiated type parameter must be
identical to the result retrieved from the type arguments of the
instance. That means that if the instantiated type parameter is not the
same type, but a supertype, of the result, then a false negative is
generated.

This CL changes TypeCheck's handling of false negatives from lazily
specialized TTSes as follows: in JIT, if the regenerated stub is the
same as the old stub, or in AOT, a false negative causes the same fall
back to SubtypeTestCaches as unoptimized stubs.  This way, further
checks with the same false negative will be caught via the STC before
going to runtime, assuming the STC hasn't already filled up with false
negatives.

Currently, we only generate false negatives for reasons that will not
change when respecialization occurs due to additions to the hierarchy,
so we do not need to clear affected STCs during respecialization.
However, the previous approach to resetting STCs on reload (in
CallSiteResetter::ResetCaches) is insufficient, since there may be
caches containing reloaded types in non-reloaded code (like the TTS
invoker stub created by the TTS testing framework). Instead, clear
all caches on reload using the same ObjectVisitor as deoptimizing type
testing stubs.

Since we now have to check instruction equality to determine whether
to add to the STC, we now only replace the existing stub if the
instructions are different. This makes it easier to test whether a
TTS invocation on a false positive caused respecialization or not.

This CL also reworks the testing framework for type testing stubs,
1) creating a test case object that stores the particulars of a given
invocation, including expectations, and 2) moving most checks and
access to appropriate data structures into a state object that handles
setup and performing invocations given test cases.

TEST=vm/cc/TTS_Partial

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Change-Id: I139608c5a0f2442a85a1cf39d1c04104db7a5593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208653
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-10 13:56:33 +00:00
Alexander Thomas c040c050d6 [release] Bump language version to 2.15
TEST=Standard CQ.
Change-Id: Ib50b4d23f25ea4bd074904a87068a4a8774932aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209561
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-10 13:06:53 +00:00
Martin Kustermann d7c0271ac0 [vm/concurrency] Add missing WeakProperty support to transitive copy
The transitive copy algorithm was missing support for [WeakProperty]s,
thereby ensuring that we only copy the values if the keys are reachable.

Furthermore we might need to re-hash [Expando]s - since the copied
objects start with no identity hash codes.

The CL also makes us avoid calling to Dart for each [Expando]
separately and instead use a list - just as we do in the re-hashing of
maps/sets.

We also move the C++ code to invoke rehashing logic into
DartLibraryCalls::*.

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

TEST=vm/dart{,_2}/isolates/fast_object_copy{,2}_test

Change-Id: I836745feef8a6d7573faa94e29a19c1eca0c39f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209106
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-08-09 23:56:19 +00:00
Ryan Macnak 735f96d6a6 [vm] Avoid eagerly committing the whole 4GB compressed heap.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46810
Change-Id: If1a23e4c49ff970760badd6415837e79f8616b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209261
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-08-09 22:57:16 +00:00
Alexander Markov 3097b72b2b [vm] Ignore differences in generic-covariant-impl flags of type parameters when doing a subtype check
We might get different flags on lhs and rhs of a subtype check as
lhs might come from a tear-off which has generic-covariant-impl type
parameters and rhs is a standalone function type.

TEST=language/regress/regress46816_test
Fixes https://github.com/dart-lang/sdk/issues/46816

Change-Id: Ic0f1b4a9fdf0f4c9ae65c8c372d12c1e51ad8050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209265
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-07 21:03:46 +00:00
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 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 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 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
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