This reverts commit f8df8ca78e.
Reason for revert: breaks google3 (b/205519688)
Original change's description:
> [vm/concurrency] Remove --(no-)enable-isolate-groups flag in Dart VM
>
> The --enable-isolate-groups flag has been turned on by-default for
> months now. In this CL we're going to remove the opt-out of this (which
> was possible by explicitly passing --no-enable-isolate-groups to the VM)
>
> TEST=Existing CI. Removes flag and simplifies runtime.
>
> Change-Id: I8706b9e30df437548a81846e75e67a658d6d49d4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219480
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Iabe6ccda6c184bb183b54a056d5011e657265d1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219700
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
This fixes failures of standalone{,_2}/io/platform_test in AOT / AppJIT modes
(and removes old status file markers which are ignored by approval system).
It also fixes a Crash in vm/dart{,_2}/spawn_shutdown_test - where error
handling was not correctly done - a `Dart_ExitScope()` was missing
before a return.
Issue https://github.com/dart-lang/sdk/issues/47632
TEST=standalone{,_2}/io/platform_test & vm/dart{,_2}/spawn_shutdown_test
Change-Id: Ic4a8bcaa243c514b11f5127d77ec77259d60ca68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219520
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
In async/async* methods synthetic :try_finally_return_value variable
(which is used to hold return value across finally) could be
captured, so flow graph builder needs to have correct context_depth_
in order to access it using LoadLocal(finally_return_variable)
when building flow graph for return statement.
Previously, flow graph builder left context in an unspecified state
and depth after TranslateFinallyFinalizers(NULL, -1), which caused
incorrect code being generated for LoadLocal(finally_return_variable).
This change fixes this problem by
* passing correct target_context_depth to TranslateFinallyFinalizers
so context is adjusted to a known depth regardless of context
depth which is used by finally;
* setting context_depth_ for LoadLocal(finally_return_variable)
and then restoring it (to be able to continue building flow graph
for the enclosing AST nodes).
TEST=tests/language/async_star/regression_47610_test.dart
Fixes https://github.com/dart-lang/sdk/issues/47610
Change-Id: Id15ea719ddda892eaff0b06f6450b1a8de36e8da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219283
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The --enable-isolate-groups flag has been turned on by-default for
months now. In this CL we're going to remove the opt-out of this (which
was possible by explicitly passing --no-enable-isolate-groups to the VM)
TEST=Existing CI. Removes flag and simplifies runtime.
Change-Id: I8706b9e30df437548a81846e75e67a658d6d49d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219480
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This is a preparation CL to remove the --enable-isolate-groups flag in
the VM.
The following tests were only running in --no-enable-isolate-groups and
are therefore obsolete now:
- runtime/tests/vm/dart/regress_47468_test.dart
- runtime/tests/vm/dart_2/regress_47468_test.dart
- tests/lib/isolate/illegal_msg_function_test.dart
- tests/lib_2/isolate/illegal_msg_function_test.dart
TEST=Changes tests only.
Change-Id: I6257cb667eebca66a649614d3010139dd2cdd3ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219100
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This CL expands the ABIs in the FFI transform and VM from 3 groups to
18 individual ABIs in preparation of adding ABI-specific integer sizes
and structs.
This increases const lists with offsets in the kernel representation
from 3 to 18 elements. We do not expect significant size increases or
performance regressions from this. The constants are deduplicated in
Dart and the optimizer should optimize indexed lookups in const lists
away. However, landing this separately will enable us to verify that
assumption.
This also moves `Abi` to its own file and makes it an opaque class with
a predefined set of instances so that we do not depend on its internals.
That will enable us to keep `pkg/vm/lib/transformations/ffi/abi.dart`
consistent with the `Abi` abstraction to be introduced in `dart:ffi`
later for specifying ABI-specific integer sizes.
Bug: https://github.com/dart-lang/sdk/issues/42563
Bug: https://github.com/dart-lang/sdk/issues/42816
List of ABIs decided based on what's currently used (as Dart SDK target
platform, or Flutter target platform, or G3 target) and added
windows_arm64 in anticipation of
(https://github.com/flutter/flutter/issues/53120).
Excluded are macos_ia32 (https://github.com/dart-lang/sdk/issues/39810)
because we discontinued support; and windows_arm, fuchsia_arm,
fuchsia_ia32, ios_ia32, and macos_arm because these are
unlikely to be added.
TEST=pkg/front_end/testcases/*.expect
TEST=tests/ffi/*
Change-Id: I437707c18d8667490c063272a5f8a33d846e6061
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-ffi-android-debug-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-ffi-android-debug-arm64c-try,vm-kernel-mac-release-arm64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217184
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
This is the final cleanup of try_index from ThrowErrorSlowPathCode.
try_index is currently passed to ThrowErrorSlowPathCode and all its
subclasses only to assert that slow path code is generated with the same
FlowGraphCompiler::CurrentTryIndex(). This is now guaranteed by
FlowGraphCompiler::GenerateDeferredCode().
TEST=ci
Change-Id: Ia1fa3c63b7428294535da0ef93e1c7f14154ac74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218984
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
When we rehash a linked hash map, we rebuild the index but keep the
existing data array. The [_deletedKeys] specifies the number of entries in the
[_index] which were marked as deleted. The Dart code that triggers
rehashing and initializes a new [_index] didn't initialize
[_deletedKeys].
=> We'll fix this in the Dart code and as a precaution also in the
transitive object copy code.
Furthermore we add a missing optimization: In the example from the bug
report we shouldn't even have attempted to re-hash, because the maps
have only primitive keys (which do not rely on identity or user-defined
hashcodes).
=> We'll change the existing optimization to ignore deleted entries when
determining whether a rehash is needed.
The rehashing code for Sets works differently and takes this already
into account.
Closes https://github.com/dart-lang/sdk/issues/47598
TEST=vm/dart{,_2}/isolates/fast_object_copy_test
Change-Id: I3529ecbf500009ab0c72b98e6c427b8840a69371
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219000
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This makes the ParallelScavenge and ParallelMark tasks safe to be run by an embedder-provided task runner that doesn't guarantee immediate execution.
TEST=ci
Change-Id: I485c1873a5eb7a208a9cc4fb32aa770c0ad6f773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214870
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Write barriers should not be eliminated for a StoreInstanceField
if there is a Dart call between store and object allocation.
This is implemented using Instruction::CanCallDart()
predicate, which is overridden for TemplateDartCall.
However, LoadField instructions for late fields with initializers can
also call initializer function directly without entering runtime.
This change introduces LoadFieldInstr::CanCallDart() to avoid
incorrect write barrier elimination across such LoadField instructions.
TEST=vm/cc/IRTest_WriteBarrierElimination_LoadLateField
Bug: b/204355807
Change-Id: Ibd9fe61e9723f1f4ecc9e4f5cedc3024d9d03c75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218583
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Instead of the background compiler task waiting forever for functions to show up in its queue, it performs a single compilation and schedules a new task if the queue is not empty.
This means an inactive isolate no longer consumes a thread. It also creates interrupt points and better fits with an embedder-provided task runner abstraction.
TEST=ci
Change-Id: I13960c776590b884fdee278d2f292bb0fa725fad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214242
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Handles cases where the SDK is installed on a path which includes
percent encoded characters. The OS doesn't decode these characters, so
decoding them before trying to load a snapshot with said characters in
their path will result in files not being found.
Fixes https://github.com/dart-lang/sdk/issues/46364
TEST=pkg/dartdev/test/regress_46364_test.dart
Change-Id: I5f78e8a2049cc0c83555528fcc8f41be946141f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218082
Reviewed-by: Ryan Macnak <rmacnak@google.com>
The fdio_flat_namespace_t returned by fdio_ns_export holds memory for
the paths of the prefixes. If this is freed then the fdio_spawn_action_t
entries point to freed memory.
Now we explicitly copy the prefix path strings and move the handles out.
TEST=internal testing
Change-Id: If8e1e0ded86003a618610a98dd571826a6ca40c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218087
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Auto-Submit: Ian McKellar <ianloic@google.com>
This region is mostly unused after loading, but it may be accessed again if
- Isolate.spawn is invoke with isolate groups disabled
- A secondary snapshot produced by splitting is loaded
- An external typed data in the snapshot is accessed (usually a kernel file)
- Likely other cases
Even if these cases did not exist, the region is often part of a shared library and so unable to be released independently.
madvise(DONT_NEED) on this region will cause the OS to release the memory in this region but keep the address space reservation and mapping. If it is touched again, it will be brought back in from the file. If it is not backed by a file, such as malloc memory, it will be brought back in as zeros and the program will likely fail.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/44019
Bug: https://github.com/flutter/flutter/issues/92120
Change-Id: I315a049b0f7d440e181d0a5e87fa6770a2fd4f79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216580
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
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>
Now that Types are no longer created for top level classes, the type
class id is guaranteed to fit in ClassIdTagType. That means we can
reduce the size of Type objects slightly as well as avoid the need to
tag and untag the type class id.
Also fixes an issue uncovered in GenerateSubtype1TestCacheLookup where
the retrieved super type was not first checked to be non-null.
TEST=Refactoring, so existing tests.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-ia32-try,vm-kernel-linux-release-x64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-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,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-simarm64c-try
Change-Id: I851a827843e34eac6961e0f06f888b40bf16df55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217221
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
The only time we create a Type in the VM for a top level class is as the
"receiver" for a no such method error where the method was either not
found in the top level class or the found method had incompatible
arguments. Unlike other cases, the Dart implementation doesn't directly
use the InvocationMirror receiver for no such method errors at the top
level, but instead just passes it back to the VM.
Now, for the InvocationMirror receiver in the top level class case, we
either
* pass a null receiver if the method wasn't found, or
* pass the signature of the found method as a string, if the arguments
were incompatible, since the only use of the top level class was for
printing the signature.
TEST=vm/cc/DartAPI, service{_2}, vm/cc/Eval, lib{_2}/mirrors
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
Change-Id: I1ac701b0be2aaebbc6163e644262c5f3ead656c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217220
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Otherwise a heap can accumulate just under 128MB (4 * max new-space capacity) worth of new-space external data without triggering a GC.
TEST=--verbose-gc
Change-Id: Ifaa5e4ea9277f1f4a09b722897b508a192c3297f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215142
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
M_ASN1_* is an old quirk from a very very old OpenSSL. They're just
wrappers over identically-named functions at this point.
Bug: none
TEST=ci
Change-Id: I1a204d6c1cca62861d7f11bf3c7adfa24bd47e59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217040
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
This CL adds the `Bool` `NativeType` with support for loading/storing
from `Pointer<Bool>`, `Array<Bool>`, and `Struct` and `Union` fields,
and support for passing booleans through FFI calls and callbacks.
The assumption is that `bool` is always treated as `uint8_t` in the
native ABIs. Including: (1) whether there can be garbage in the upper
bytes in CPU registers, (2) stack alignment, and (3) alignment in
compounds.
The conversion from `bool` to `uint8_t` is implemented as follows:
- bool to int: `value ? 1 : 0`
- int to bool: `value != 0`
The conversion is implemented in Dart in patch files for memory loads
and stores (pointer, array, and struct fields) and kernel_to_il for
FFI call and callback arguments and return value.
TEST=runtime/vm/compiler/ffi/native_type_vm_test.cc
TEST=tests/ffi/bool_test.dart
TEST=tests/ffi/function_callbacks_structs_by_value_generated_test.dart
TEST=tests/ffi/function_structs_by_value_generated_test.dart
Closes: https://github.com/dart-lang/sdk/issues/36855
Change-Id: I75d100340ba41771abfb41c598ca92066a89370b
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-ffi-android-debug-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-ffi-android-debug-arm64c-try,vm-kernel-mac-release-arm64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216900
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Clement Skau <cskau@google.com>