Commit Graph

1374 Commits

Author SHA1 Message Date
Tess Strickland 8debbd0725 [vm] Fix writing v8 snapshot profiles for core snapshots.
Fixes a crash when SetObjectTypeAndName is called twice for the
same object id with different types.

Don't add Code objects to the profile for non-Code carrying snapshots,
as references to the Code object are replaced with references to null.

TEST=vm/dart{_2}/v8_snapshot_profile_writer_test

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try
Change-Id: Id9abf66509d422551ad5797744265eeb2c2ba2b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217643
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-10-21 19:39:15 +00:00
Martin Kustermann fb59277b4a [vm/concurrency] Remove vm/dart/regress_40753_test in iso-stress tests
This particular test causes thousands of exceptions to be thrown. This
is not a problem in itself, but it is when running under TSAN because it
will cause a buffer-overflow in TSAN's fixed-size shadow stack.

The buffer overflow will override data structures that often causes the
iso-stress runs to crash.

See more information in the issue.

Issue https://github.com/dart-lang/sdk/issues/47472#issuecomment-948235479

TEST=Should eliminate certain causes of crashes on "iso-stress" builder.

Change-Id: I9c3357eb49a31daf1cb728d745eeb405f2ff4a81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217600
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-10-21 10:48:53 +00:00
Daco Harkes 41434e148a [vm] Fix non-const empty map and set messages
Before https://dart-review.googlesource.com/c/sdk/+/176583, the index
of maps was always at least length 8. However, after the change the
length can be 1. Using this uninitialized index for creating a hash
mask makes the hashmask 31 1s instead of 29 1s on ia32, which is not a
Smi.

This CL changes _indexSizeToHashMask to return the uninitialized hash
mask (0) for when the index is uninitialized (length 1).

The behavior is exercised by sending a non-const map through a message
to another isolate, which calls `_regenerateIndex`.

https://dart-review.googlesource.com/c/sdk/+/210860 introduced the same
issue for sets.

TEST=runtime/tests/vm/dart/isolates/fast_object_copy_test.dart
TEST=runtime/tests/vm/dart/regress_47468_test.dart

If only assert `assert(indexSize >= _INITIAL_INDEX_SIZE);` is added to
`_indexSizeToHashMask`, it makes the test reliably fail.

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

Change-Id: I3bc40a289c16b58c3d740373bc9ed7bcad2f41c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217362
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-10-21 07:19:12 +00:00
Martin Kustermann 1be6f891de [gardening] Try to configure TSAN to produce coredumps on aborts
We seemingly don't get coredumps on the "iso-stress" builder when
running under TSAN. This is an attempt of setting TSAN settings via
an environment variable to explicitly force this behavior.

We also add a print to an existing test to help identify in which
section a crash happens.

TEST=Attempt to obtain cores on iso-stress when running under TSAN.

Change-Id: I698eb62e537923dc6733b4ed496a47f67338da34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217010
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-10-15 11:47:42 +00:00
Alexander Markov 4b04219d94 [vm] Fix intrinsified Type.operator== for generic types with not finalized classes
UntaggedClass::host_type_arguments_field_offset_in_words_ is initialized
when class is finalized. When comparing generic types for the class
which was not finalized, we cannot rely on the value of that field.

Intrinsified Type.operator== has been using host_type_arguments_field_offset_in_words_
to check if the class is generic, and has been treating classes which
are not finalized as non-generic. This has been causing the wrong
result for generic types which are different only in type arguments.

This change fixes Type.operator== intrinsics to check if
type arguments match even if class was not finalized.

Also, EquivalentClassIds helper was revised to take 3 labels
explicitly for all possible outcomes (instead of 2 labels and
a fall-through).

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

Change-Id: I3f49114644d44808c668df7cbb8a702cd42b3673
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216270
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-10-12 17:03:00 +00:00
Alexander Markov 6535fe9fd0 [vm/test] Avoid timeout in vm/dart_2/rematerialize_unboxed_double_field_test
This test has been using --optimization-counter-threshold=10 which
makes it extremely slow if kernel service snapshot is not used
(on ia32), as kernel service compiles a huge number of functions.

This change increases --optimization-counter-threshold to 100.

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

Change-Id: Iee49d5a97cc89f124b7f296ff70ebb6c5f359528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216262
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-10-12 08:32:24 +00:00
Martin Kustermann b7909e132a [vm/concurrency] Allow StackTrace objects to be shared
The existing lib/isolate/stacktrace_message_test was failing and also
incorrectly written due to "!" in front of the expected stringification
of the stacktrace.

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

TEST=vm/dart{,_2}/isolates/fast_object_copy2_test, lib{,_2}/isolate/stacktrace_message_test

Change-Id: I169d8fd7a7c3cb3b8c57e00287565e3a5c622acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216041
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-10-11 09:01:44 +00:00
Alexander Aprelev 9f9834c08e [vm/isolates] Ensure that only closure's context is inspected when closure is sent out.
Fixes https://github.com/dart-lang/sdk/issues/47381

TEST=sendandexit_test on Windows

Change-Id: I4fe298ccbcf79131994619a11aeac4b11dbdfec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215686
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-10-07 15:27:43 +00:00
Alexander Aprelev c0e5cec5da [vm/isolates] Fix Isolate.exit() message validation.
Isolate.exit() message validation diverged from SendPort.send one, so this CL aligns them back.

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

TEST=sendandexit_test

Change-Id: I4c85933acb87a29892df5eb3cd2843e3207418b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215502
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-10-05 20:44:31 +00:00
Martin Kustermann 0cab42bbea [gardening] Ignore normal exceptions/compile-time errors when trying to archive coredumps
TEST=Makes iso-stress builder not run into issues during coredump archiving

Change-Id: I2998328f63759cf4c02d29e6480b3d8410730e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215548
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-10-05 16:56:40 +00:00
Martin Kustermann 7abf6bfab7 [gardening] Add coredump archiving support to iso-stress builder.
This is an attempt to enable archiving of coredumps on the
"iso-stress" builder, since we're often unable to reproduce crashes from
that builder.

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

TEST=Adds test infra.

Change-Id: I9b7276198db9a6c98a74f55d466bf832b03e24f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214407
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-10-04 08:49:28 +00:00
Robert Nystrom 3ac34f791d Change references to "dartfmt" in runtime and tools to "dart format".
In Dart 2.15, we're removing "dartfmt" in favor of "dart format", so I'm
going through and fixing all the dangling references to the old name.

TEST=Only changing tools

Change-Id: I83a5c00be925fdb536014a47dff2b488ed9f478b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215186
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-10-01 18:16:27 +00:00
Alexander Aprelev 56403a0d35 [vm/sendandexit] Introduce Isolate.exit([port, message]).
This exits current isolate immediately. If [port] is provided, then [message] is verified and sent out as isolate exits.

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

Change-Id: I513f4d7ceb5d74820f4aee60f5799b7b5193f2e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214312
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-30 20:20:24 +00:00
Vyacheslav Egorov 62a903fe11 [vm/aot] Prefer EqualityCompare to avoid redundant boxing
When specializing x == y comparisons where one of the operands is known
to be a Smi but the other one is *not* only emit StrictCompare
if either x or y are nullable. For non-nullable equality comparisons
prefer EqualityCompare which allows to avoid redundant boxing as
non-nullable integer values are highly likely to be unboxed.

TEST=vm/dart{,_2}/aot_prefer_equality_comparison_il_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try
Change-Id: I1153f111dcbb518d25d753dc4357c72522389951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214962
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-09-30 13:37:21 +00:00
Tess Strickland d16ad3d64b [vm/elf] Reorder non-NOBITS sections before NOBITS sections.
This ensures that the relocated addresses of sections with file contents
are contained in the loaded segment.

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

TEST=vm/dart{,_2}/use_save_debugging_info_flag

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I6f7f94900ab1f9f0cb5ead4b0dd63bd2402e5a19
Fixed: 47289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214800
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-28 17:23:32 +00:00
Clement Skau 629803d782 [vm/ffi] Skips new DartAPI FFI tests on simarm.
TEST=None. Status file change.

Bug: https://github.com/dart-lang/sdk/issues/47284
Fixes: https://github.com/dart-lang/sdk/issues/47284
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simarm64c-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try
Change-Id: Ifacf1057cca181aed27e461b69f4bb4231cf57fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214408
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-09-27 10:22:33 +00:00
Alexander Markov 7cd65a7a0c [gardening] Skip vm/dart_2/v8_snapshot_profile_writer_test on tsan bot
This test was flaky and started timing out consistently on
vm-kernel-precomp-tsan-linux-release-x64 bot.
It times out even if marked 'Pass, Slow' in status file.

Change-Id: Id3af3fafd0939e61b5efd3adcedc966548ac8bb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213623
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-16 18:09:35 +00:00
Martin Kustermann 260eac5f80 [gardening] Give vm/dart{,_2}/use_strip_flag_test more time in TSAN mode
Issue https://github.com/dart-lang/sdk/issues/42986

TEST=Updating status file

Change-Id: I30a6cbb2926145e393287fbc684615fa00911bb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213045
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-10 13:34:29 +00:00
Ryan Macnak 31a1fd4b6b [vm, gc] Fix a bug handling WeakProperties under the combination of concurrent marking and write-barrier elimination.
The compiler will in certain cases eliminate write barriers and the runtime will compensate by adding certain objects to a deferred marking stack. These objects will be revisited when marking is finalized. There is no header bit indicating an object has already been added to the deferred marking stack. The same object may be seen by markers multiple times: once as part of ordinary marking and several times as part of deferred marking.

When visiting a WeakProperty, if the fate of its key is not yet known, it is placed in a (worker-local) delayed weak properties list, which is a linked list threaded through the WeakProperties themselves. If more than one worker adds the same WeakProperty to its list, or a single worker does so multiple times, the lists will be corrupted. A previous fix (40cd5fc5f6) attempted to avoid this by ensuring only the worker which marked the WeakProperty would add it to a delayed weak properties list, but this can result in no worker adding the WeakProperty if the WeakProperty is allocated marked and added to the deferred marking stack.

This CL changes the processing of the deferred marking stack to treat WeakProperties as strong references. This ensures a WeakProperty will only be added to a delayed weak properties list by the single worker that encounters it during ordinary marking. This is also very similar to what would happen if the write barrier had not been eliminated: the writes into the marked WeakProperty would cause the new key and value to also become marked.

This CL also fixes another bug where when processing the delayed weak properties lists, the worker would try to ask whether a new-space object was marked.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47128
Change-Id: Id9abaeb4dd52538ebc22ac58e48abcb7ed760854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212612
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-09-08 17:40:19 +00:00
Daco Harkes 015c4e604a [vm] Bail out inlining on wrong optional arguments
TEST=runtime/tests/vm/dart/regress_flutter89482_test.dart

Before: assert (debug mode)
After:
  Closure Calls (1)
  => other (deopt count 0)
     Bailout: optional arg mismatch

Bug: https://github.com/flutter/flutter/issues/89482

Change-Id: I5b0a9b738465d12c47304e9309bfa8f701c5aae6
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212570
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-07 14:32:22 +00:00
Alexander Aprelev 21298ee884 Reland "[vm/concurrency] Enable isolate groups by-default in all modes"
This reverts commit d0a3daffb7 that
reverted the initial land.

The fix for the problem that required the revert landed in
https://dart.googlesource.com/sdk/+/5ccf97a5a950ef70f41d84f186dad550d4acda01

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

TEST=ci

Change-Id: Ie92074059319e046809169d9e16d459ce1c2848f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212481
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-03 23:29:08 +00:00
Martin Kustermann 5f9ec9f52a [vm/concurrency] Allow closures as entrypoints in Isolate.spawn calls
We already allow sending closures (if immutable via sharing
otherwise via copying). This CL makes use of this to allow the argument
to `Isolate.spawn()` to be any closure.

Similar to normal message sending, the spawn will fail if the closure
cannot be sent (or causes an error on the new isolate, e.g. rehashing
error).

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

TEST=vm/dart{_2,}/isolates/closure_entrypoint_test

Change-Id: Iab342267d87bd87bc8c0c82d16aec58a69a3df44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212295
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-03 19:08:37 +00:00
Martin Kustermann e9b56794fc [vm/compiler] Make closures have no context if no variables are closed over
As a side-effect of making closures without captured variables have an
empty context, we not only avoid a memory leak, but also allow such
closures to be sent across [SendPort]s.

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

TEST=vm/dart{_2,}/isolates/closures_without_captured_variables_test

Change-Id: I5e8845203059ff625f7cff3f072d845b5e48ba36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212297
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-03 12:35:58 +00:00
Brandon DeRosier d0a3daffb7 Revert "[vm/concurrency] Enable isolate groups by-default in all modes"
This reverts commit 57de39d07a.

Reason for revert: Breakage in flutter engine roll -- see: https://github.com/flutter/flutter/issues/89406

Original change's description:
> [vm/concurrency] Enable isolate groups by-default in all modes
>
> Various VM embedders have already explicitly opted into it
> AOT mode for a long time.
>
> Now we turn it on by default, also because we'd like to collect
> feedback from the field on this - in good time before the next
> stable branch will be released.
>
> All of our isolate related tests have already
>
>     // VMOptions=--enable-isolate-groups ...
>     // VMOptions=--no-enable-isolate-groups ...
>
> So they will continue to exercise the tests in both modes.
>
> Issue https://github.com/dart-lang/sdk/issues/36097
>
> TEST=Existing test suite.
>
> Change-Id: I1d031e8a5f2173b48eb32c53b08daccda75dc51d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208649
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

TBR=vegorov@google.com,kustermann@google.com,aam@google.com,asiva@google.com

Change-Id: I4f20f3a998508b2465e5c16b64b363419da62775
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212345
Auto-Submit: Brandon DeRosier <bdero@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-03 01:14:38 +00:00
Ryan Macnak 192d909101 [vm] Fix crashes when passing bad paths to --write_retained_reasons_to or --trace_precompiler_to.
TEST=ci
Change-Id: I42465be8cd8a05835d1cc1e5fb23a1fe2d075614
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212263
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-02 19:47:45 +00:00
Martin Kustermann 26ef8f6947 [vm] Allow sending closures between isolates of the same isolate group
Closures can be shared if they have no state they capture (i.e. a null
context). Otherwise we copy them by also transitively copying the
parent context chain.

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

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

Change-Id: Ie641b97806edd0c21f0a8d5c514f8e850823e165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209110
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-09-02 19:45:55 +00:00
Martin Kustermann eab69f12f8 [vm/concurrency] Fix isolate failure shutdown crash
This particular test was not run in both modes (--enable-isolate-groups
and --no-enable-isolate-groups). So enabling the flag made this test
fail.

It fails because it shutdown the isolate before destroying the
[IsolateSpawnState] - which in return destroys persistant handles which
needs the isolate to be still alive.

TEST=Fixes vm/dart{,_2}/spawn_shutdown_test

Change-Id: Ib06e1149c4066fa993e899bbd3bfdba8a2533b48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212292
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-02 18:47:25 +00:00
Vyacheslav Egorov bda70c8489 [vm] Remove support for dart-ext: imports
Per breaking change #45451 we are removing support for dart-ext:
style native extensions from the Dart VM.

This CL removes the associated VM code, tests and samples. It also ports
a single test which used dart-ext: import to use FFI instead.

TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/45451
Change-Id: Iae984bce32baf29a950b5de1323939006a217b94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212050
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-02 14:14:35 +00:00
Martin Kustermann 57de39d07a [vm/concurrency] Enable isolate groups by-default in all modes
Various VM embedders have already explicitly opted into it
AOT mode for a long time.

Now we turn it on by default, also because we'd like to collect
feedback from the field on this - in good time before the next
stable branch will be released.

All of our isolate related tests have already

    // VMOptions=--enable-isolate-groups ...
    // VMOptions=--no-enable-isolate-groups ...

So they will continue to exercise the tests in both modes.

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

TEST=Existing test suite.

Change-Id: I1d031e8a5f2173b48eb32c53b08daccda75dc51d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208649
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-02 13:45:50 +00:00
Alexander Markov 4e660ab787 [gardening] Mark vm/dart_2/regress_45898_test as Slow on dartkp-tsan-*
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/47062

Change-Id: Ia0a33a10ddc00d80a90ee645325d52f43c3638cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212028
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-31 23:44:56 +00:00
Lasse R.H. Nielsen ed3824a220 Tweaks, refactoring and updates on DoubleLinkedQueue.
It's a badly designed class, but this change makes it slightly better.
(We should consider moving it to package:collection and removing it from
the platform libraries. Eventually.)

The changes decouples the public `DoubleLinkedQueueEntry` class from
the actual queue implementation classes, avoiding the latter having
to share a generic `_Link<DoubleLinkedQueueEntry>` interface
which would force them to do otherwise unnecessary casts.

The public class should have been abstract, but isn't.
It's mainly used as the API of the entries exposed by DoubleLinkedQueue,
but it can also be used by itself to build double-linked lists that are
not part of a Queue, and the class can be extended.
If anyone does either, it should keep working, so it needs to be a concrete,
self-contained class with a generative constructor.

That class is moved to dart:_internal to avoid its private
implementation fields from interfering with the queue implementation classes,
which have similar fields, but can now have them at different types.
That's a hack, but it works.

The internal implementation of the DoubleLinkedQueue and its entries
are updated to better follow current programming idioms, and avoids
having fields on classes which don't need them.

Also fixes #27920
(`clear`ing a list now detaches each entry from the list so later `.contains`
won't give the wrong answer).

And moves queue tests from tests/corelib to tests/lib/collection,
since Queue isn't exposed by `dart:core`.

BUG= https://github.com/dart-lang/sdk/issues/27920

Change-Id: Ia3bb340a75886de160cc0e449947e8e7ee587061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211265
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-08-31 12:44:39 +00:00
Ryan Macnak 6433038907 [vm] Use stricter checks when deciding to keep a switchable call in the monomorphic state.
- Don't stay in the monomorphic state if the corresponding ICData is no longer monomorphic, even if the call site itself encountered the same CID as before.
 - Don't assume the ICData's entries array hasn't been replaced.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47010
Change-Id: I00f59eb59ed52e21bd638fec876accda42db0e2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211464
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-30 22:53:37 +00:00
Ryan Macnak 93d111d92d [vm, compiler] Add missing deopt info to CheckNullInstr.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46790
Bug: https://github.com/dart-lang/sdk/issues/47044
Change-Id: I6f4fc095ddb7701c9b61434d85839cb6d5dccc1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208687
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-30 22:00:57 +00:00
Ryan Macnak b761b9d757 [vm] Fix a false-positive keeping switchable calls in the monomorphic state.
When checking if the guarded receiver CID has changed, we must find the original guarded CID by looking in the original ICData entries array. The first entry in the current ICData entries array might not correspond to the original entry because we sometimes re-order entries. For example, insert the Smi case at the beginning.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46948
Bug: https://github.com/dart-lang/sdk/issues/46980
Change-Id: Id0904de3a68fbb77842f552329a14c3127ee9fc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211082
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-08-25 16:32:32 +00:00
Ryan Macnak 0c165830b8 [vm, compiler] Fix saving an invalid pointer to the stack in the BuildMethodExtractor stub.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46796
Bug: https://github.com/dart-lang/sdk/issues/46954
Change-Id: I7e32fd28cdaebdf7b4ddde484a21cbe7c49f23e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210620
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-23 20:05:27 +00:00
Alexander Aprelev 064a9a50a0 [vm/regexp] Ensure regex interpreter checks and yields to safepoints, handles OOB messages periodically.
Fixes https://github.com/flutter/flutter/issues/88063
Fixes https://github.com/dart-lang/sdk/issues/26041

TEST=benchmarks/EventLoopLatencyRegexp,
long_regexp_process_oob_messages_test

Change-Id: I2bb10b332768f794b902b58be18d437cc07a59a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210065
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-08-20 16:19:16 +00:00
Martin Kustermann 0201d76154 [vm/concurrency] Remove internal-only "Isolate.spawn() into new group" functionality
This was mainly used as a backup plan which is no longer needed at this
point.

This CL removes internal only functionality that couldn't be used by
end-users.

TEST=ci

Change-Id: Ie0828bda1ba48ee6a5a460ff039267e0549e0060
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210340
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-08-19 15:19:00 +00:00
Ryan Macnak 37ea0f8cb4 [vm, compiler] Don't clobber non-writable inputs in BinarySmiOp(>>>).
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46797
Change-Id: Ia9494ddc1d39b83e2572b8b5a7f208da2540ccd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210501
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-18 23:19:55 +00:00
Alexander Markov cfb057ddca Reland "[vm] Hide internal implementation List types and expose them as List"
This is a reland of 824bec596f

Original change's description:
> [vm] Hide internal implementation List types and expose them as List
>
> When taking a type of an instance with x.runtimeType we can map
> internal classes _List, _ImmutableList and _GrowableList to a
> user-visible List class. This is similar to what we do for
> implementation classes of int, String and Type.
> After that, result of x.runtimeType for built-in lists would be
> compatible with List<T> type literals.
>
> Also, both intrinsic and native implementations of _haveSameRuntimeType
> are updated to agree with new semantic of runtimeType.
>
> TEST=co19/LanguageFeatures/Constructor-tear-offs/type_literal_A01_t01
> TEST=runtime/tests/vm/dart/have_same_runtime_type_test
>
> Fixes https://github.com/dart-lang/sdk/issues/46893
> Issue https://github.com/dart-lang/sdk/issues/46231
>
> Change-Id: Ie24a9f527f66a06118427b7a09e49c03dff93d8e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210066
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>

TEST=co19/LanguageFeatures/Constructor-tear-offs/type_literal_A01_t01
TEST=runtime/tests/vm/dart/have_same_runtime_type_test
TEST=lib/mirrors/regress_b196606044_test
Fixes https://github.com/dart-lang/sdk/issues/46893
Issue https://github.com/dart-lang/sdk/issues/46231

Change-Id: I79b587540338808bd73a6554f00a5eed042f4c26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210201
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-08-16 22:52:21 +00:00
Alexander Markov af2ec43d44 [vm/compiler] Fix incorrect assertion in LoadOptimizer
Unreachable code can contain LoadIndex/StoreIndex instructions
which take result of AllocateObject as input. For example:

    v5 <- AllocateObject:18(cls=MapEntry, v4, <not-aliased>) T{MapEntry}
    ...
    v33 <- InstanceOf:14(v5 IS String, instantiator_type_args(v0), function_type_args(v0)) T{bool}
    Branch if StrictCompare:18(===, v33, v3) goto (15, 21)
B15[target]:22
    CheckClass:24(v5 Cids[1: _OneByteString@0150898 etc.  cid 82])
    ...
    v51 <- LoadIndexed(v5, v49) [0, 255] T{_Smi}

This assertion was added recently in
https://dart-review.googlesource.com/c/sdk/+/198406.

TEST=vm/dart/regress_46798_test
Fixes https://github.com/dart-lang/sdk/issues/46798

Change-Id: I9d8627768c9f477b187f2b67d70f0a9fc7d952be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210180
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-13 22:18:17 +00:00
Alexander Markov 16ff4aec0e Revert "[vm] Hide internal implementation List types and expose them as List"
This reverts commit 824bec596f.

Reason for revert: b/196606044

Original change's description:
> [vm] Hide internal implementation List types and expose them as List
>
> When taking a type of an instance with x.runtimeType we can map
> internal classes _List, _ImmutableList and _GrowableList to a
> user-visible List class. This is similar to what we do for
> implementation classes of int, String and Type.
> After that, result of x.runtimeType for built-in lists would be
> compatible with List<T> type literals.
>
> Also, both intrinsic and native implementations of _haveSameRuntimeType
> are updated to agree with new semantic of runtimeType.
>
> TEST=co19/LanguageFeatures/Constructor-tear-offs/type_literal_A01_t01
> TEST=runtime/tests/vm/dart/have_same_runtime_type_test
>
> Fixes https://github.com/dart-lang/sdk/issues/46893
> Issue https://github.com/dart-lang/sdk/issues/46231
>
> Change-Id: Ie24a9f527f66a06118427b7a09e49c03dff93d8e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210066
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>

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

Change-Id: I4c3dddbc358d6ad3b14081706f7aec110a2e0562
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210200
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-13 21:40:53 +00:00
Alexander Markov 824bec596f [vm] Hide internal implementation List types and expose them as List
When taking a type of an instance with x.runtimeType we can map
internal classes _List, _ImmutableList and _GrowableList to a
user-visible List class. This is similar to what we do for
implementation classes of int, String and Type.
After that, result of x.runtimeType for built-in lists would be
compatible with List<T> type literals.

Also, both intrinsic and native implementations of _haveSameRuntimeType
are updated to agree with new semantic of runtimeType.

TEST=co19/LanguageFeatures/Constructor-tear-offs/type_literal_A01_t01
TEST=runtime/tests/vm/dart/have_same_runtime_type_test

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

Change-Id: Ie24a9f527f66a06118427b7a09e49c03dff93d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210066
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-08-13 18:20:51 +00:00
Martin Kustermann d6807670c0 [gardening] Mark dart/byte_array_optimized_test as slow.
The test is flakily timing out on dartk-win-debug-ia32. In general it is
a quite large test and should just be given more time.

TEST=Give dart/byte_array_optimized_test more time, avoid flaky timeout

Change-Id: Ifeadc5f777b019ca4c04c5c8e6072fae1c00c0a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210121
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-08-13 10:33:01 +00:00
Martin Kustermann 0ce43763a2 [vm/concurrency] Check for message deserialization errors in isolate spawning
Fixes https://github.com/dart-lang/sdk/issues/46878

TEST=vm/dart{,_2}/regress_46878_test

Change-Id: Iaf497b0ca6efab4f9982c50f7e55b165c47fd057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209905
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-08-12 09:44:58 +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
Alexander Aprelev 7c772a653b [benchmarks] Add IsolateFibonacci benchmark wrapper around existing test.
Change-Id: I66268cd24bcf55dd75baf7000948dcbe81928001
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209180
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-08-09 15:02:28 +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
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
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
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