mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:44:27 +00:00
67ab3be10d
An Isolate Group (IG) is a collection of isolates which were spawned from the same source. This allows the VM to: * have a guarantee that all isolates within one IG can safely exchange structured objects (currently we rely on embedder for this guarantee) * hot-reload all isolates together (currently we only reload one isolate, leaving same-source isolates in inconsistent state) * make a shared heap for all isolates from the same IG, which paves the way for faster communication and sharing of immutable objects. All isolates within one IG will share the same IsolateGroupSource. **Embedder changes** This change makes breaking embedder API changes to support this new concept of Isolate Groups: The existing isolate lifecycle callbacks given to Dart_Initialize will become Isolate Group lifecycle callbacks. A new callback `initialize_isolate` callback will be added which can initialize a new isolate within an existing IG. Existing embedders can be updated by performing the following renames Dart_CreateIsolate -> Dart_CreateIsolateGroup Dart_IsolateCreateCallback -> Dart_IsolateGroupCreateCallback Dart_IsolateCleanupCallback -> Dart_IsolateGroupShutdownCallback Dart_CreateIsolateFromKernel -> Dart_CreateIsolateGroupFromKernel Dart_CurrentIsolateData -> Dart_CurrentIsolateGroupData Dart_IsolateData -> Dart_IsolateGroupData Dart_GetNativeIsolateData -> Dart_GetNativeIsolateGroupData Dart_InitializeParams.create -> Dart_InitializeParams.create_group Dart_InitializeParams.cleanup -> Dart_InitializeParams.shutdown_group Dart_InitializeParams.shutdown -> Dart_InitializeParams.shutdown_isolate By default `Isolate.spawn` will cause the creation of a new IG. Though an embedder can opt-into supporting multiple isolates within one IG by providing a callback to the newly added `Dart_InitializeParams.initialize_isolate`. The responsibility of this new callback is to initialize an existing isolate (which was setup by re-using source code from the spawning isolate - i.e. the one which used `Isolate.spawn`) by setting native resolvers, initializing global state, etc. Issue https://github.com/dart-lang/sdk/issues/36648 Issue https://github.com/dart-lang/sdk/issues/36097 Original review: https://dart-review.googlesource.com/c/sdk/+/105241 Difference to original review: * Give each isolate it's own [Loader] (for now) * Sort classes during initialization for spawned isolates if app-jit is used (to match main isolate) * Fix IsolateData memory leak if isolate startup fails Change-Id: I98277d3d10fe275aa9b8a16b6bdd446bbea0b100 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107506 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> |
||
---|---|---|
.. | ||
abiversions | ||
android | ||
apps/update_homebrew | ||
bots | ||
buildtools | ||
dart2js | ||
dom | ||
gardening | ||
linux_dist_support/debian | ||
migration | ||
patches | ||
sdks | ||
spec_parser | ||
test_generators | ||
testing | ||
.gitignore | ||
3xhead_flutter_hooks.sh | ||
addlatexhash.dart | ||
approve_results.dart | ||
archive_crash.py | ||
build.py | ||
canary.dart | ||
clean_output_directory.py | ||
copy_dart.py | ||
copy_tree.py | ||
create_debian_chroot.sh | ||
create_debian_packages.py | ||
create_pkg_manifest.py | ||
create_tarball.py | ||
create_timestamp_file.py | ||
diff_results.dart | ||
disguised_test.py | ||
download_abi_dills.py | ||
download_chromium_sysroot.sh | ||
download_latest_dev_sdk.py | ||
execute_recorded_testcases.py | ||
experimental_features.yaml | ||
FAKE_COMMITS | ||
find_depot_tools.py | ||
gen_fuchsia_test_manifest.py | ||
generate_buildfiles.py | ||
generate_idefiles.py | ||
gn.py | ||
gn_helpers.py | ||
line_doc_comments.dart | ||
list_dart_files.py | ||
list_files.py | ||
make_bundle_unittest.py | ||
make_version.py | ||
minidump.py | ||
only_in_release_mode.py | ||
presubmit.sh | ||
promote.py | ||
publish_pkg.py | ||
revert.py | ||
run_abi_tests.py | ||
run_debian_build.sh | ||
run_offsets_extractor.sh | ||
safari_factory_reset.py | ||
set_ia32_sysroot.sh | ||
set_x64_sysroot.sh | ||
spec_parse.py | ||
task_kill.py | ||
test.dart | ||
test.py | ||
upload_abi_dills.sh | ||
utils.py | ||
VERSION | ||
write_dartdoc_options_file.py | ||
write_revision_file.py | ||
write_version_file.py | ||
yaml2json.dart | ||
yaml2json.py |