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>
When several isolates share same isolate group, they share the same heap.
This change iterates over isolate groups and aggregates their heap size instead of iterating over isolates.
Change-Id: I83b04110277b3a2d22ab758b50ee8c4ce480ea7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212382
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
* Update tearoff runtime equality algorithm with newly specified
requirements.
* Update kernel golden files for the dartdevc target to include
the static method lowering for constructor tearoffs.
* Avoid adding source maps and debug symbols to the static methods
created by the CFE lowering.
* Add additional expected non-nullable values detected in the
nullable inference tests. These correspond to the values that
appear in the static method return statements.
Measurements taken from large applications show the lowering causes
a code size increase of 2.5%-3.5%. That increase did not appear to
create any measurable difference in initial page load time but if
there turns out to be a regression we can revisit each of the various
lowerings to implement support in DDC at the site where the constructor
is torn off.
Fixes: https://github.com/dart-lang/sdk/issues/46486
Fixes: https://github.com/dart-lang/sdk/issues/46837
Change-Id: I01fa39d4f1d0e937919dd1466bb6a34c91a10e75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206960
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
loaded_blobs need to be visited as part of IsolateGroup::Visit method rather than Isolate::Visit one.
Before this change loaded_blobs could become corrupted because GC requires objects being visited only once during collection cycles.
Fixes https://github.com/flutter/flutter/issues/89406
TEST=ci, flutter
Change-Id: Ic61498c205c5cc072e5f45928264a507a7752e0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212440
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Also update some TODOs.
Change-Id: I02c883e717a3315892a99879ef45aba804183c86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212020
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
The destructor of [IsolateSpawnState] might call destructors on
[Message] which may want to delete persistent handles. Doing so requires
an active isolate group.
This CL ensure that in shutdown races (main isolate exists which
triggers VM shutdown, helper islate is about to start but fails to start
due to VM shutdown request), we still ensure to properly delete the
persistent handles.
TEST=Fixes vm/dart_2/spawn_shutdown_test/0 on app-jit configurations.
Change-Id: I0c3e0ceca7faab36f298953dabb1ccae3a0ecc8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212464
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
The allocation routine for allocating context objects (used for copying
closures) has to use uncompressed mode - since [Context] objects aren't
compressed yet.
This is a follow-up to https://dart-review.googlesource.com/c/sdk/+/209110
TEST=Fixes closure tests in vm/dart_2/isolates/fast_object_copy2_test/<num> in compressed mode.
Change-Id: I3a16701fe662ff7ea501a238653c7efb376cda55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212465
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
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 sgrekhov@unipro.ru Fixes 1187. Roll failures fixed
Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I168b3dff190ea889eba23aad0159a5d130251718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212463
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Now that support for native extensions (aka dart-ext:*) has been
removed, the kernel loader is guaranteed not to call out to embedder
anymore (it did so before for loading shared libraries).
This allos us to clean up some code as well as extend the scope of our
NoActiveIsolateScope.
TEST=ci
Change-Id: I5c8c9ee47298fdd316583ba3aed74772c1c7783f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212296
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-08-31 irina.arkhipets@gmail.com Issue 1094: Tests updated.
2021-08-31 irina.arkhipets@gmail.com Issue 1094: Missing issue tags added.
2021-08-31 irina.arkhipets@gmail.com Issue 1094: LibTest/core test updated.
2021-08-31 sgrekhov@unipro.ru 1177. Tests updated to expect compile errors according to the new behaviour
2021-08-30 irina.arkhipets@gmail.com Fixes 1176: regression tests updated, missing issue tags added.
2021-08-25 irina.arkhipets@gmail.com Fixes 1170: tests re-named.
2021-08-24 sgrekhov@unipro.ru 1169. Change error expectation for CFE according to the new behaviour
2021-08-17 irina.arkhipets@gmail.com Issue 1158: Language/Expressions/Numbers test splitted to web and non-web ones. Non-web ones should be excluded for dart2js in status files. Minor changes.
2021-08-17 irina.arkhipets@gmail.com Issue 1158: Some tests splitted to web and non-web ones. Non-web ones should be excluded for dart2js in status files.
2021-08-16 irina.arkhipets@gmail.com Issue 1158: Changes from master moved to pre-nnbd branch, CyclicInitialization test corrected.
2021-08-16 irina.arkhipets@gmail.com Issue 1164: Got rid of toInt32, toInt16, toInt8 functions.
2021-08-13 irina.arkhipets@gmail.com Issue 1094: missing Issue tags and additional note added.
Change-Id: If6649c595fd6c820e157bdcb462bb6d7a08194e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212460
Reviewed-by: William Hesse <whesse@google.com>
Change-Id: Ia1c5b6b2365849a6c69b1db2bf1878ca64dfd65b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211420
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-09-03 sgrekhov@unipro.ru Add const and factory constructors tests for constructor 'new' syntax
2021-09-03 sgrekhov@unipro.ru Fixes 1186. Add @dart=2.14 to the test that uses C.new()
2021-09-02 sgrekhov@unipro.ru Fixes 1185. Add test for flow analysis fix implemented under constructor tears-off flag
2021-09-02 sgrekhov@unipro.ru Fixes 1184. Disambiguate by 'is' and 'as' tokens added. Existing test fixed
2021-09-01 sgrekhov@unipro.ru Fixes 1183. Add tests for late final variable in class with constant final constructor
2021-09-01 sgrekhov@unipro.ru Fixes 1182. Add tests for f<int>.toString()
2021-09-01 sgrekhov@unipro.ru Fixes 1157. Use constructor name after '.' to test disambiguate by '.' token
2021-09-01 irina.arkhipets@gmail.com Issue 1178: Test expectation corrected.
2021-08-31 sgrekhov@unipro.ru Issue number added
2021-08-31 sgrekhov@unipro.ru Fixes 1181. Test fixed to not to fail on web platforms
2021-08-31 irina.arkhipets@gmail.com Issue 1094: Missing issue tags added.
2021-08-31 irina.arkhipets@gmail.com Issue 1094: Test updated: microseconds are not supported in dart2js.
Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I59c3622984645c8a2de5a7b699f004d326b7035d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212299
Reviewed-by: William Hesse <whesse@google.com>
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>
Apparently this is no longer the default.
Change-Id: Ia7f8e8b3e383144ff5b42446add21e6f658a55fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212320
Reviewed-by: Alexander Aprelev <aam@google.com>
This makes the self-detection of whether isolate groups are enabled work
correctly in the test.
TEST=Fixes lib_2/isolate/message3_test test failures on CI
Change-Id: I71965236444af71e6deb4df6a77911144af9af91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212294
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Purely mechanical except for moving a comment in one typedef.
Change-Id: I460d14aabb6081c92dd37bdfe835f7c3ad59c0f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212025
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
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>
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>
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>
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>