diff --git a/pkg/frontend_server/test/frontend_server_test.dart b/pkg/frontend_server/test/frontend_server_test.dart index 97f69f6ba3c..ddd8d8874d9 100644 --- a/pkg/frontend_server/test/frontend_server_test.dart +++ b/pkg/frontend_server/test/frontend_server_test.dart @@ -1773,11 +1773,6 @@ extension type Foo(int value) { } } - Uri registerKernelBlob(Uint8List bytes) { - bytes = new Uint8List.fromList(bytes); - return (Isolate.current as dynamic).createUriForKernelBlob(bytes); - } - Future runWithServer( Future Function(RequestChannel) f, ) async { @@ -1941,11 +1936,6 @@ void main(List arguments, SendPort sendPort) { ); expect(kernelBytes, hasLength(greaterThan(200))); - final Uri kernelUri = registerKernelBlob(kernelBytes); - - final ReceivePort receivePort = new ReceivePort(); - await Isolate.spawnUri(kernelUri, [], receivePort.sendPort); - expect(await receivePort.first, 42); }); }); }); diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc index 12e2546bba2..6df231470ba 100644 --- a/runtime/bin/dfe.cc +++ b/runtime/bin/dfe.cc @@ -9,7 +9,6 @@ #include "bin/error_exit.h" #include "bin/exe_utils.h" #include "bin/file.h" -#include "bin/lockers.h" #include "bin/platform.h" #include "bin/snapshot_utils.h" #include "bin/utils.h" @@ -67,9 +66,7 @@ DFE::DFE() use_incremental_compiler_(false), frontend_filename_(nullptr), application_kernel_buffer_(nullptr), - application_kernel_buffer_size_(0), - kernel_blobs_(&SimpleHashMap::SameStringValue, 4), - kernel_blobs_lock_() {} + application_kernel_buffer_size_(0) {} DFE::~DFE() { if (frontend_filename_ != nullptr) { @@ -80,9 +77,6 @@ DFE::~DFE() { free(application_kernel_buffer_); application_kernel_buffer_ = nullptr; application_kernel_buffer_size_ = 0; - - kernel_blobs_.Clear( - [](void* value) { delete reinterpret_cast(value); }); } void DFE::Init() { @@ -242,19 +236,14 @@ void DFE::ReadScript(const char* script_uri, const AppSnapshot* app_snapshot, uint8_t** kernel_buffer, intptr_t* kernel_buffer_size, - bool decode_uri, - std::shared_ptr* kernel_blob_ptr) { + bool decode_uri) const { int64_t start = Dart_TimelineGetMicros(); if (!TryReadKernelFile(script_uri, app_snapshot, kernel_buffer, - kernel_buffer_size, decode_uri, kernel_blob_ptr)) { + kernel_buffer_size, decode_uri)) { return; } if (!Dart_IsKernel(*kernel_buffer, *kernel_buffer_size)) { - if (kernel_blob_ptr != nullptr && *kernel_blob_ptr) { - *kernel_blob_ptr = nullptr; - } else { - free(*kernel_buffer); - } + free(*kernel_buffer); *kernel_buffer = nullptr; *kernel_buffer_size = -1; } @@ -438,20 +427,10 @@ bool DFE::TryReadKernelFile(const char* script_uri, const AppSnapshot* app_snapshot, uint8_t** kernel_ir, intptr_t* kernel_ir_size, - bool decode_uri, - std::shared_ptr* kernel_blob_ptr) { + bool decode_uri) const { *kernel_ir = nullptr; *kernel_ir_size = -1; - if (decode_uri && kernel_blob_ptr != nullptr) { - *kernel_blob_ptr = TryFindKernelBlob(script_uri, kernel_ir_size); - if (*kernel_blob_ptr) { - *kernel_ir = kernel_blob_ptr->get(); - ASSERT(DartUtils::SniffForMagicNumber(*kernel_ir, *kernel_ir_size) == - DartUtils::kKernelMagicNumber); - return true; - } - } if (app_snapshot == nullptr || app_snapshot->IsKernel() || app_snapshot->IsKernelList()) { uint8_t* buffer; @@ -479,72 +458,5 @@ bool DFE::TryReadKernelFile(const char* script_uri, return false; } -const char* DFE::RegisterKernelBlob(const uint8_t* kernel_buffer, - intptr_t kernel_buffer_size) { - ASSERT(DartUtils::SniffForMagicNumber(kernel_buffer, kernel_buffer_size) == - DartUtils::kKernelMagicNumber); - uint8_t* buffer_copy = reinterpret_cast(malloc(kernel_buffer_size)); - if (buffer_copy == nullptr) { - return nullptr; - } - memmove(buffer_copy, kernel_buffer, kernel_buffer_size); - - MutexLocker ml(&kernel_blobs_lock_); - ++kernel_blob_counter_; - char* uri = - Utils::SCreate("dart-kernel-blob://blob%" Pd, kernel_blob_counter_); - KernelBlob* blob = new KernelBlob(uri, buffer_copy, kernel_buffer_size); - - const uint32_t hash = SimpleHashMap::StringHash(uri); - SimpleHashMap::Entry* entry = - kernel_blobs_.Lookup(uri, hash, /*insert=*/true); - ASSERT(entry != nullptr); - ASSERT(entry->value == nullptr); - entry->value = blob; - - return uri; -} - -std::shared_ptr DFE::TryFindKernelBlob(const char* uri, - intptr_t* kernel_length) { - *kernel_length = -1; - - MutexLocker ml(&kernel_blobs_lock_); - if (kernel_blob_counter_ == 0) { - return nullptr; - } - - // This const_cast is safe as this 'key' is only used to find entry, not add. - void* key = const_cast(uri); - const uint32_t hash = SimpleHashMap::StringHash(uri); - SimpleHashMap::Entry* entry = - kernel_blobs_.Lookup(key, hash, /*insert=*/false); - if (entry == nullptr) { - return nullptr; - } - - KernelBlob* blob = reinterpret_cast(entry->value); - *kernel_length = blob->size(); - return blob->buffer(); -} - -void DFE::UnregisterKernelBlob(const char* uri) { - MutexLocker ml(&kernel_blobs_lock_); - - // This const_cast is safe as this 'key' is only used to find entry, not add. - void* key = const_cast(uri); - const uint32_t hash = SimpleHashMap::StringHash(uri); - SimpleHashMap::Entry* entry = - kernel_blobs_.Lookup(key, hash, /*insert=*/false); - if (entry == nullptr) { - return; - } - - KernelBlob* blob = reinterpret_cast(entry->value); - entry->value = nullptr; - kernel_blobs_.Remove(key, hash); - delete blob; -} - } // namespace bin } // namespace dart diff --git a/runtime/bin/dfe.h b/runtime/bin/dfe.h index 9b0e4c55040..3a5f1aadfeb 100644 --- a/runtime/bin/dfe.h +++ b/runtime/bin/dfe.h @@ -7,12 +7,10 @@ #include -#include "bin/thread.h" #include "include/dart_api.h" #include "include/dart_native_api.h" #include "platform/assert.h" #include "platform/globals.h" -#include "platform/hashmap.h" #include "platform/utils.h" namespace dart { @@ -97,16 +95,12 @@ class DFE { // Returns an in memory kernel representation of the specified script is a // valid kernel file, sets 'kernel_buffer' to nullptr otherwise. // - // If 'kernel_blob_ptr' is not nullptr, then this function can also - // read kernel blobs. In such case it sets 'kernel_blob_ptr' - // to a shared pointer which owns the kernel buffer. - // Otherwise, the caller is responsible for free()ing 'kernel_buffer'. + // The caller is responsible for free()ing 'kernel_buffer'. void ReadScript(const char* script_uri, const AppSnapshot* app_snapshot, uint8_t** kernel_buffer, intptr_t* kernel_buffer_size, - bool decode_uri = true, - std::shared_ptr* kernel_blob_ptr = nullptr); + bool decode_uri = true) const; bool KernelServiceDillAvailable() const; @@ -114,17 +108,13 @@ class DFE { // Returns `true` if successful and sets 'kernel_buffer' and 'kernel_length' // to be the kernel IR contents. // - // If 'kernel_blob_ptr' is not nullptr, then this function can also - // read kernel blobs. In such case it sets 'kernel_blob_ptr' - // to a shared pointer which owns the kernel buffer. - // Otherwise, the caller is responsible for free()ing 'kernel_buffer' + // The caller is responsible for free()ing 'kernel_buffer' // if `true` was returned. bool TryReadKernelFile(const char* script_uri, const AppSnapshot* app_snapshot, uint8_t** kernel_buffer, intptr_t* kernel_buffer_size, - bool decode_uri = true, - std::shared_ptr* kernel_blob_ptr = nullptr); + bool decode_uri = true) const; // We distinguish between "intent to use Dart frontend" vs "can actually // use Dart frontend". The method UseDartFrontend tells us about the @@ -137,22 +127,6 @@ class DFE { void LoadKernelService(const uint8_t** kernel_service_buffer, intptr_t* kernel_service_buffer_size); - // Registers given kernel blob and returns blob URI which - // can be used in TryReadKernelFile later to load the given kernel. - // Data from [kernel_buffer] is copied, it doesn't need to stay alive. - // Returns nullptr if failed to allocate memory. - const char* RegisterKernelBlob(const uint8_t* kernel_buffer, - intptr_t kernel_buffer_size); - - // Looks for kernel blob using the given [uri]. - // Returns non-null pointer to the kernel blob if successful and - // sets [kernel_length]. - std::shared_ptr TryFindKernelBlob(const char* uri, - intptr_t* kernel_length); - - // Unregisters kernel blob with given URI. - void UnregisterKernelBlob(const char* uri); - private: bool use_dfe_; bool use_incremental_compiler_; @@ -164,33 +138,11 @@ class DFE { uint8_t* application_kernel_buffer_; intptr_t application_kernel_buffer_size_; - // Registry of kernel blobs. Maps URI (char *) to KernelBlob. - SimpleHashMap kernel_blobs_; - intptr_t kernel_blob_counter_ = 0; - Mutex kernel_blobs_lock_; - void InitKernelServiceAndPlatformDills(); DISALLOW_COPY_AND_ASSIGN(DFE); }; -class KernelBlob { - public: - // Takes ownership over [uri] and [buffer]. - KernelBlob(char* uri, uint8_t* buffer, intptr_t size) - : uri_(uri), buffer_(buffer, std::free), size_(size) {} - - std::shared_ptr buffer() { return buffer_; } - intptr_t size() const { return size_; } - - private: - CStringUniquePtr uri_; - std::shared_ptr buffer_; - const intptr_t size_; - - DISALLOW_COPY_AND_ASSIGN(KernelBlob); -}; - class PathSanitizer { public: explicit PathSanitizer(const char* path); diff --git a/runtime/bin/isolate_data.h b/runtime/bin/isolate_data.h index 9bd5f068c4c..e82b2ec71c8 100644 --- a/runtime/bin/isolate_data.h +++ b/runtime/bin/isolate_data.h @@ -66,16 +66,6 @@ class IsolateGroupData { kernel_buffer_size_ = size; } - // Associate the given kernel buffer with this IsolateGroupData and give it - // ownership of the buffer. The buffer is already owned by another - // IsolateGroupData. - void SetKernelBufferAlreadyOwned(std::shared_ptr buffer, - intptr_t size) { - ASSERT(kernel_buffer_.get() == nullptr); - kernel_buffer_ = std::move(buffer); - kernel_buffer_size_ = size; - } - const char* resolved_packages_config() const { return resolved_packages_config_; } diff --git a/runtime/bin/main_impl.cc b/runtime/bin/main_impl.cc index 40f5db8087d..29fbeb98ae7 100644 --- a/runtime/bin/main_impl.cc +++ b/runtime/bin/main_impl.cc @@ -696,7 +696,6 @@ static Dart_Isolate CreateIsolateGroupAndSetupHelper( int64_t start = Dart_TimelineGetMicros(); ASSERT(script_uri != nullptr); uint8_t* kernel_buffer = nullptr; - std::shared_ptr kernel_buffer_ptr; intptr_t kernel_buffer_size = 0; AppSnapshot* app_snapshot = nullptr; @@ -762,8 +761,7 @@ static Dart_Isolate CreateIsolateGroupAndSetupHelper( if (kernel_buffer == nullptr && !isolate_run_app_snapshot) { dfe.ReadScript(script_uri, app_snapshot, &kernel_buffer, - &kernel_buffer_size, /*decode_uri=*/true, - &kernel_buffer_ptr); + &kernel_buffer_size, /*decode_uri=*/true); } PathSanitizer script_uri_sanitizer(script_uri); PathSanitizer packages_config_sanitizer(packages_config); @@ -772,13 +770,8 @@ static Dart_Isolate CreateIsolateGroupAndSetupHelper( auto isolate_group_data = new IsolateGroupData( script_uri, packages_config, app_snapshot, isolate_run_app_snapshot); if (kernel_buffer != nullptr) { - if (kernel_buffer_ptr) { - isolate_group_data->SetKernelBufferAlreadyOwned( - std::move(kernel_buffer_ptr), kernel_buffer_size); - } else { - isolate_group_data->SetKernelBufferNewlyOwned(kernel_buffer, - kernel_buffer_size); - } + isolate_group_data->SetKernelBufferNewlyOwned(kernel_buffer, + kernel_buffer_size); } Dart_Isolate isolate = nullptr; @@ -896,16 +889,6 @@ static Dart_Isolate CreateIsolateGroupAndSetup(const char* script_uri, error, &exit_code); } -#if !defined(DART_PRECOMPILED_RUNTIME) -static const char* RegisterKernelBlob(const uint8_t* kernel_buffer, - intptr_t kernel_buffer_size) { - return dfe.RegisterKernelBlob(kernel_buffer, kernel_buffer_size); -} -static void UnregisterKernelBlob(const char* kernel_blob_uri) { - dfe.UnregisterKernelBlob(kernel_blob_uri); -} -#endif // !defined(DART_PRECOMPILED_RUNTIME) - static void OnIsolateShutdown(void* isolate_group_data, void* isolate_data) { Dart_EnterScope(); Dart_Handle sticky_error = Dart_GetStickyError(); @@ -1399,10 +1382,6 @@ void main(int argc, char** argv) { #if !defined(DART_PRECOMPILED_RUNTIME) init_params.start_kernel_isolate = dfe.UseDartFrontend() && dfe.CanUseDartFrontend(); - if (init_params.start_kernel_isolate) { - init_params.register_kernel_blob = RegisterKernelBlob; - init_params.unregister_kernel_blob = UnregisterKernelBlob; - } #else init_params.start_kernel_isolate = false; #endif diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h index 1d83c9038fc..6f73d7fd85e 100644 --- a/runtime/include/dart_api.h +++ b/runtime/include/dart_api.h @@ -837,7 +837,7 @@ typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)(void); * The current version of the Dart_InitializeFlags. Should be incremented every * time Dart_InitializeFlags changes in a binary incompatible way. */ -#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000008) +#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000009) /** Forward declaration */ struct Dart_CodeObserver; @@ -863,36 +863,6 @@ typedef struct Dart_CodeObserver { Dart_OnNewCodeCallback on_new_code; } Dart_CodeObserver; -/** - * Optional callback provided by the embedder that is used by the VM to - * implement registration of kernel blobs for the subsequent Isolate.spawnUri - * If no callback is provided, the registration of kernel blobs will throw - * an error. - * - * \param kernel_buffer A buffer which contains a kernel program. Callback - * should copy the contents of `kernel_buffer` as - * it may be freed immediately after registration. - * \param kernel_buffer_size The size of `kernel_buffer`. - * - * \return A C string representing URI which can be later used - * to spawn a new isolate. This C String should be scope allocated - * or owned by the embedder. - * Returns NULL if embedder runs out of memory. - */ -typedef const char* (*Dart_RegisterKernelBlobCallback)( - const uint8_t* kernel_buffer, - intptr_t kernel_buffer_size); - -/** - * Optional callback provided by the embedder that is used by the VM to - * unregister kernel blobs. - * If no callback is provided, the unregistration of kernel blobs will throw - * an error. - * - * \param kernel_blob_uri URI of the kernel blob to unregister. - */ -typedef void (*Dart_UnregisterKernelBlobCallback)(const char* kernel_blob_uri); - /** * Describes how to initialize the VM. Used with Dart_Initialize. */ @@ -971,16 +941,6 @@ typedef struct { */ Dart_CodeObserver* code_observer; - /** - * Kernel blob registration callback function. See Dart_RegisterKernelBlobCallback. - */ - Dart_RegisterKernelBlobCallback register_kernel_blob; - - /** - * Kernel blob unregistration callback function. See Dart_UnregisterKernelBlobCallback. - */ - Dart_UnregisterKernelBlobCallback unregister_kernel_blob; - #if defined(__Fuchsia__) /** * The resource needed to use zx_vmo_replace_as_executable. Can be diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc index 3e3ba4d4777..53d56b609c8 100644 --- a/runtime/lib/isolate.cc +++ b/runtime/lib/isolate.cc @@ -1249,53 +1249,6 @@ DEFINE_NATIVE_ENTRY(Isolate_getCurrentRootUriStr, 0, 0) { return root_lib.url(); } -DEFINE_NATIVE_ENTRY(Isolate_registerKernelBlob, 0, 1) { - GET_NON_NULL_NATIVE_ARGUMENT(TypedData, kernel_blob, - arguments->NativeArgAt(0)); - auto register_kernel_blob_callback = Isolate::RegisterKernelBlobCallback(); - if (register_kernel_blob_callback == nullptr) { - Exceptions::ThrowUnsupportedError( - "Registration of kernel blobs is not supported by this Dart embedder."); - } - bool is_kernel = false; - { - NoSafepointScope no_safepoint; - is_kernel = - Dart_IsKernel(reinterpret_cast(kernel_blob.DataAddr(0)), - kernel_blob.LengthInBytes()); - } - if (!is_kernel) { - const auto& error = String::Handle( - zone, String::New("kernelBlob doesn\'t contain a valid kernel.\n")); - Exceptions::ThrowArgumentError(error); - UNREACHABLE(); - } - const char* uri = nullptr; - { - NoSafepointScope no_safepoint; - uri = register_kernel_blob_callback( - reinterpret_cast(kernel_blob.DataAddr(0)), - kernel_blob.LengthInBytes()); - } - if (uri == nullptr) { - Exceptions::ThrowOOM(); - } - return String::New(uri); -} - -DEFINE_NATIVE_ENTRY(Isolate_unregisterKernelBlob, 0, 1) { - GET_NON_NULL_NATIVE_ARGUMENT(String, kernel_blob_uri, - arguments->NativeArgAt(0)); - auto unregister_kernel_blob_callback = - Isolate::UnregisterKernelBlobCallback(); - if (unregister_kernel_blob_callback == nullptr) { - Exceptions::ThrowUnsupportedError( - "Registration of kernel blobs is not supported by this Dart embedder."); - } - unregister_kernel_blob_callback(kernel_blob_uri.ToCString()); - return Object::null(); -} - DEFINE_NATIVE_ENTRY(Isolate_sendOOB, 0, 2) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Array, msg, arguments->NativeArgAt(1)); diff --git a/runtime/tests/vm/dart/spawn_uri_from_kernel_blob_script.dart b/runtime/tests/vm/dart/spawn_uri_from_kernel_blob_script.dart deleted file mode 100644 index 43a200d869e..00000000000 --- a/runtime/tests/vm/dart/spawn_uri_from_kernel_blob_script.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import "dart:convert"; -import "dart:isolate"; - -main(List args, SendPort replyPort) { - final String encoded = base64.encode(args[0].codeUnits); - replyPort.send(String.fromCharCodes(base64.decode(encoded))); -} diff --git a/runtime/tests/vm/dart/spawn_uri_from_kernel_blob_test.dart b/runtime/tests/vm/dart/spawn_uri_from_kernel_blob_test.dart deleted file mode 100644 index 1c9397b7aaa..00000000000 --- a/runtime/tests/vm/dart/spawn_uri_from_kernel_blob_test.dart +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// OtherResources=spawn_uri_from_kernel_blob_script.dart - -// Test for Isolate.createUriForKernelBlob and subsequent Isolate.spawnUri. - -import 'dart:io' show Platform; -import 'dart:isolate' show Isolate, ReceivePort; - -import "package:expect/expect.dart"; -import "package:expect/variations.dart" show unsoundNullSafety; -import 'package:front_end/src/api_unstable/vm.dart' - show CompilerOptions, DiagnosticMessage, kernelForProgram, NnbdMode; -import 'package:kernel/kernel.dart'; -import 'package:kernel/target/targets.dart'; -import 'package:vm/modular/target/vm.dart' show VmTarget; - -import 'snapshot_test_helper.dart'; - -main() async { - final sourceUri = - Platform.script.resolve('spawn_uri_from_kernel_blob_script.dart'); - final options = new CompilerOptions() - ..target = VmTarget(TargetFlags()) - ..additionalDills = [Uri.file(platformDill)] - ..environmentDefines = {} - ..nnbdMode = unsoundNullSafety ? NnbdMode.Weak : NnbdMode.Strong - ..onDiagnostic = (DiagnosticMessage message) { - Expect.fail( - "Compilation error: ${message.plainTextFormatted.join('\n')}"); - }; - final Component component = - (await kernelForProgram(sourceUri, options))!.component!; - final kernelBlob = writeComponentToBytes(component); - - final kernelBlobUri = - (Isolate.current as dynamic).createUriForKernelBlob(kernelBlob); - - print('URI: $kernelBlobUri'); - - for (int i = 0; i < 2; ++i) { - final receivePort = ReceivePort(); - receivePort.listen((message) { - Expect.equals(message, 'Hello'); - print('ok'); - receivePort.close(); - }); - - await Isolate.spawnUri(kernelBlobUri, ['Hello'], receivePort.sendPort); - } - - (Isolate.current as dynamic).unregisterKernelBlobUri(kernelBlobUri); - - try { - await Isolate.spawnUri(kernelBlobUri, ['Hello'], null); - Expect.fail( - "Isolate.spawnUri didn't complete with error after unregisterKernelBlobUri"); - } catch (e) { - print('Got exception: $e'); - } -} diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status index b2dea92ab45..7f3bf68a67e 100644 --- a/runtime/tests/vm/vm.status +++ b/runtime/tests/vm/vm.status @@ -74,7 +74,6 @@ dart/entrypoints/jit/*: SkipByDesign # These tests should only run on JIT. dart/kernel_determinism_test: SkipByDesign # Test needs to run from source dart/minimal_kernel_test: SkipByDesign # Test needs to run from source dart/snapshot_depfile_test: SkipByDesign # Test needs to run from source -dart/spawn_uri_from_kernel_blob_test: SkipByDesign # Only run in JIT. [ $compiler == dartkp ] dart/await_type_check_with_dynamic_loading_test: SkipByDesign # Uses dart:mirrors. diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h index ad015401566..67b33db7917 100644 --- a/runtime/vm/bootstrap_natives.h +++ b/runtime/vm/bootstrap_natives.h @@ -250,8 +250,6 @@ namespace dart { V(Isolate_getCurrentRootUriStr, 0) \ V(Isolate_getDebugName, 1) \ V(Isolate_getPortAndCapabilitiesOfCurrentIsolate, 0) \ - V(Isolate_registerKernelBlob, 1) \ - V(Isolate_unregisterKernelBlob, 1) \ V(Isolate_sendOOB, 2) \ V(Isolate_spawnFunction, 10) \ V(Isolate_spawnUri, 12) \ diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc index 6c02a5ac894..0aac4a2dc6a 100644 --- a/runtime/vm/dart.cc +++ b/runtime/vm/dart.cc @@ -499,8 +499,6 @@ char* Dart::DartInit(const Dart_InitializeParams* params) { Isolate::SetShutdownCallback(params->shutdown_isolate); Isolate::SetCleanupCallback(params->cleanup_isolate); Isolate::SetGroupCleanupCallback(params->cleanup_group); - Isolate::SetRegisterKernelBlobCallback(params->register_kernel_blob); - Isolate::SetUnregisterKernelBlobCallback(params->unregister_kernel_blob); return nullptr; } diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc index 7f5baf64462..79308e28545 100644 --- a/runtime/vm/isolate.cc +++ b/runtime/vm/isolate.cc @@ -1815,8 +1815,6 @@ void Isolate::InitVM() { shutdown_callback_ = nullptr; cleanup_callback_ = nullptr; cleanup_group_callback_ = nullptr; - register_kernel_blob_callback_ = nullptr; - unregister_kernel_blob_callback_ = nullptr; if (isolate_creation_monitor_ == nullptr) { isolate_creation_monitor_ = new Monitor(); } @@ -2692,10 +2690,6 @@ Dart_IsolateGroupCreateCallback Isolate::create_group_callback_ = nullptr; Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = nullptr; Dart_IsolateCleanupCallback Isolate::cleanup_callback_ = nullptr; Dart_IsolateGroupCleanupCallback Isolate::cleanup_group_callback_ = nullptr; -Dart_RegisterKernelBlobCallback Isolate::register_kernel_blob_callback_ = - nullptr; -Dart_UnregisterKernelBlobCallback Isolate::unregister_kernel_blob_callback_ = - nullptr; Random* IsolateGroup::isolate_group_random_ = nullptr; Monitor* Isolate::isolate_creation_monitor_ = nullptr; diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h index 202727b78a8..d3736802d97 100644 --- a/runtime/vm/isolate.h +++ b/runtime/vm/isolate.h @@ -1228,20 +1228,6 @@ class Isolate : public IntrusiveDListEntry { static Dart_IsolateGroupCleanupCallback GroupCleanupCallback() { return cleanup_group_callback_; } - static void SetRegisterKernelBlobCallback( - Dart_RegisterKernelBlobCallback cb) { - register_kernel_blob_callback_ = cb; - } - static Dart_RegisterKernelBlobCallback RegisterKernelBlobCallback() { - return register_kernel_blob_callback_; - } - static void SetUnregisterKernelBlobCallback( - Dart_UnregisterKernelBlobCallback cb) { - unregister_kernel_blob_callback_ = cb; - } - static Dart_UnregisterKernelBlobCallback UnregisterKernelBlobCallback() { - return unregister_kernel_blob_callback_; - } #if !defined(PRODUCT) // This method first ensures that the default Service ID zone for this isolate @@ -1729,8 +1715,6 @@ class Isolate : public IntrusiveDListEntry { static Dart_IsolateShutdownCallback shutdown_callback_; static Dart_IsolateCleanupCallback cleanup_callback_; static Dart_IsolateGroupCleanupCallback cleanup_group_callback_; - static Dart_RegisterKernelBlobCallback register_kernel_blob_callback_; - static Dart_UnregisterKernelBlobCallback unregister_kernel_blob_callback_; #if !defined(PRODUCT) static void WakePauseEventHandler(Dart_Isolate isolate); diff --git a/sdk/lib/_internal/vm/lib/isolate_patch.dart b/sdk/lib/_internal/vm/lib/isolate_patch.dart index 8f835a14c07..ebb7cc74ca4 100644 --- a/sdk/lib/_internal/vm/lib/isolate_patch.dart +++ b/sdk/lib/_internal/vm/lib/isolate_patch.dart @@ -742,33 +742,6 @@ final class Isolate { } _exit(finalMessagePort, message); } - - /** - * Creates an Uri representing the script which was compiled into kernel - * binary in [kernelBlob]. - * The resulting Uri can be used for the subsequent spawnUri calls. - * Such spawnUri will start an isolate which would run the given - * compiled script in [kernelBlob]. - */ - /*static*/ - Uri createUriForKernelBlob(Uint8List kernelBlob) { - return Uri.parse(_registerKernelBlob(kernelBlob)); - } - - /** - * Unregisters kernel blob previously registered with - * [createUriForKernelBlob] and frees underlying resources. - */ - /*static*/ - void unregisterKernelBlobUri(Uri kernelBlobUri) { - _unregisterKernelBlob(kernelBlobUri.toString()); - } - - @pragma("vm:external-name", "Isolate_registerKernelBlob") - external static String _registerKernelBlob(Uint8List kernelBlob); - - @pragma("vm:external-name", "Isolate_unregisterKernelBlob") - external static void _unregisterKernelBlob(String kernelBlobUri); } @patch