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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>