From d05981a611eb9fc1a1bdf95035e527c92da1cd5d Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sat, 3 Jun 2023 21:22:32 +0100 Subject: [PATCH] refactor(core): remove force_op_registration and cleanup JsRuntimeForSnapshot (#19353) Addresses https://github.com/denoland/deno/pull/19308#discussion_r1212248194. Removes force_op_registration as it is no longer necessary. --- cli/lsp/tsc.rs | 3 - cli/ops/bench.rs | 3 - cli/ops/mod.rs | 3 - cli/ops/testing.rs | 3 - cli/tsc/mod.rs | 11 +- core/bindings.rs | 23 +- core/extensions.rs | 15 - core/runtime.rs | 390 +++++++----------- core/snapshot_util.rs | 38 +- ops/lib.rs | 2 - ops/optimizer_tests/async_nop.out | 1 - ops/optimizer_tests/async_result.out | 1 - ops/optimizer_tests/callback_options.out | 1 - ops/optimizer_tests/cow_str.out | 1 - ops/optimizer_tests/f64_slice.out | 1 - ops/optimizer_tests/incompatible_1.out | 1 - ops/optimizer_tests/issue16934.out | 1 - ops/optimizer_tests/issue16934_fast.out | 1 - .../op_blob_revoke_object_url.out | 1 - ops/optimizer_tests/op_ffi_ptr_value.out | 1 - ops/optimizer_tests/op_print.out | 1 - ops/optimizer_tests/op_state.out | 1 - ops/optimizer_tests/op_state_basic1.out | 1 - ops/optimizer_tests/op_state_generics.out | 1 - ops/optimizer_tests/op_state_result.out | 1 - ops/optimizer_tests/op_state_warning.out | 1 - .../op_state_with_transforms.out | 1 - ops/optimizer_tests/opstate_with_arity.out | 1 - ops/optimizer_tests/option_arg.out | 1 - ops/optimizer_tests/owned_string.out | 1 - .../param_mut_binding_warning.out | 1 - ops/optimizer_tests/raw_ptr.out | 1 - ops/optimizer_tests/serde_v8_value.out | 1 - ops/optimizer_tests/strings.out | 1 - ops/optimizer_tests/strings_result.out | 1 - ops/optimizer_tests/u64_result.out | 1 - ops/optimizer_tests/uint8array.out | 1 - ops/optimizer_tests/unit_result.out | 1 - ops/optimizer_tests/unit_result2.out | 1 - ops/optimizer_tests/unit_ret.out | 1 - ops/optimizer_tests/wasm_op.out | 1 - runtime/examples/extension_with_ops/main.rs | 8 +- runtime/ops/fs_events.rs | 3 - runtime/ops/http.rs | 3 - runtime/ops/os/mod.rs | 6 - runtime/ops/permissions.rs | 3 - runtime/ops/process.rs | 3 - runtime/ops/runtime.rs | 3 - runtime/ops/signal.rs | 3 - runtime/ops/tty.rs | 3 - runtime/ops/web_worker.rs | 3 - runtime/ops/worker_host.rs | 3 - 52 files changed, 161 insertions(+), 402 deletions(-) diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index bfbb5cf9ac..0e52f8d873 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -3261,9 +3261,6 @@ deno_core::extension!(deno_tsc, options.performance, )); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); /// Instruct a language server runtime to start the language server and provide diff --git a/cli/ops/bench.rs b/cli/ops/bench.rs index da0f3d959a..f569a8cbb4 100644 --- a/cli/ops/bench.rs +++ b/cli/ops/bench.rs @@ -42,9 +42,6 @@ deno_core::extension!(deno_bench, state.put(options.sender); state.put(BenchContainer::default()); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[derive(Clone)] diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index d39f19270a..5066c44b9f 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -23,9 +23,6 @@ deno_core::extension!(deno_cli, state = |state, options| { state.put(options.npm_resolver); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[op] diff --git a/cli/ops/testing.rs b/cli/ops/testing.rs index 3f9ade7c9e..b4d9b451a0 100644 --- a/cli/ops/testing.rs +++ b/cli/ops/testing.rs @@ -43,9 +43,6 @@ deno_core::extension!(deno_test, state.put(options.sender); state.put(TestContainer::default()); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[derive(Clone)] diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 2b8a210ab0..d9f9b8b531 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -117,13 +117,7 @@ pub fn get_types_declaration_file_text(unstable: bool) -> String { } fn get_asset_texts_from_new_runtime() -> Result, AnyError> { - deno_core::extension!( - deno_cli_tsc, - ops_fn = deno_ops, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, - ); + deno_core::extension!(deno_cli_tsc, ops_fn = deno_ops); // the assets are stored within the typescript isolate, so take them out of there let mut runtime = JsRuntime::new(RuntimeOptions { @@ -780,9 +774,6 @@ pub fn exec(request: Request) -> Result { .unwrap(), )); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); let startup_source = ascii_str!("globalThis.startup({ legacyFlag: false })"); diff --git a/core/bindings.rs b/core/bindings.rs index d91e4c309d..2be9b35b65 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -15,19 +15,10 @@ use crate::modules::ImportAssertionsKind; use crate::modules::ModuleMap; use crate::modules::ResolutionKind; use crate::ops::OpCtx; +use crate::runtime::InitMode; use crate::JsRealm; use crate::JsRuntime; -#[derive(Copy, Clone, Eq, PartialEq)] -pub(crate) enum BindingsMode { - /// We have no snapshot -- this is a pristine context. - New, - /// We have initialized before, are reloading a snapshot, and will snapshot. - Loaded, - /// We have initialized before, are reloading a snapshot, and will not snapshot again. - LoadedFinal, -} - pub(crate) fn external_references(ops: &[OpCtx]) -> v8::ExternalReferences { // Overallocate a bit, it's better than having to resize the vector. let mut references = Vec::with_capacity(4 + ops.len() * 4); @@ -127,7 +118,7 @@ pub(crate) fn initialize_context<'s>( scope: &mut v8::HandleScope<'s>, context: v8::Local<'s, v8::Context>, op_ctxs: &[OpCtx], - bindings_mode: BindingsMode, + init_mode: InitMode, ) -> v8::Local<'s, v8::Context> { let global = context.global(scope); @@ -137,17 +128,11 @@ pub(crate) fn initialize_context<'s>( codegen, "Deno.__op__ = function(opFns, callConsole, console) {{" ); - if bindings_mode == BindingsMode::New { + if init_mode == InitMode::New { _ = writeln!(codegen, "Deno.__op__console(callConsole, console);"); } for op_ctx in op_ctxs { if op_ctx.decl.enabled { - // If we're loading from a snapshot, we can skip registration for most ops - if bindings_mode == BindingsMode::LoadedFinal - && !op_ctx.decl.force_registration - { - continue; - } _ = writeln!( codegen, "Deno.__op__registerOp({}, opFns[{}], \"{}\");", @@ -182,7 +167,7 @@ pub(crate) fn initialize_context<'s>( let op_fn = op_ctx_function(scope, op_ctx); op_fns.set_index(scope, op_ctx.id as u32, op_fn.into()); } - if bindings_mode != BindingsMode::New { + if init_mode == InitMode::FromSnapshot { op_fn.call(scope, recv.into(), &[op_fns.into()]); } else { // Bind functions to Deno.core.* diff --git a/core/extensions.rs b/core/extensions.rs index ff86fec648..fa6d7851e7 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -72,7 +72,6 @@ pub struct OpDecl { pub is_async: bool, pub is_unstable: bool, pub is_v8: bool, - pub force_registration: bool, pub arg_count: u8, pub fast_fn: Option, } @@ -360,7 +359,6 @@ pub struct Extension { initialized: bool, enabled: bool, deps: Option<&'static [&'static str]>, - force_op_registration: bool, pub(crate) is_core: bool, } @@ -431,7 +429,6 @@ impl Extension { let mut ops = self.ops.take()?; for op in ops.iter_mut() { op.enabled = self.enabled && op.enabled; - op.force_registration = self.force_op_registration; } Some(ops) } @@ -485,7 +482,6 @@ pub struct ExtensionBuilder { event_loop_middleware: Option>, name: &'static str, deps: &'static [&'static str], - force_op_registration: bool, is_core: bool, } @@ -534,15 +530,6 @@ impl ExtensionBuilder { self } - /// Mark that ops from this extension should be added to `Deno.core.ops` - /// unconditionally. This is useful is some ops are not available - /// during snapshotting, as ops are not registered by default when a - /// `JsRuntime` is created with an existing snapshot. - pub fn force_op_registration(&mut self) -> &mut Self { - self.force_op_registration = true; - self - } - /// Consume the [`ExtensionBuilder`] and return an [`Extension`]. pub fn take(self) -> Extension { let js_files = Some(self.js); @@ -560,7 +547,6 @@ impl ExtensionBuilder { initialized: false, enabled: true, name: self.name, - force_op_registration: self.force_op_registration, deps, is_core: self.is_core, } @@ -583,7 +569,6 @@ impl ExtensionBuilder { enabled: true, name: self.name, deps, - force_op_registration: self.force_op_registration, is_core: self.is_core, } } diff --git a/core/runtime.rs b/core/runtime.rs index f95c4a8ef5..fdcb81e9e2 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1,7 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. use crate::bindings; -use crate::bindings::BindingsMode; use crate::error::generic_error; use crate::error::to_v8_type_error; use crate::error::JsError; @@ -24,8 +23,6 @@ use crate::realm::ContextState; use crate::realm::JsRealm; use crate::realm::JsRealmInner; use crate::snapshot_util; -use crate::snapshot_util::SnapshotOptions; -use crate::snapshot_util::SnapshottedData; use crate::source_map::SourceMapCache; use crate::source_map::SourceMapGetter; use crate::Extension; @@ -63,7 +60,6 @@ use std::sync::Mutex; use std::sync::Once; use std::task::Context; use std::task::Poll; -use v8::CreateParams; const STATE_DATA_OFFSET: u32 = 0; const MODULE_MAP_DATA_OFFSET: u32 = 1; @@ -121,7 +117,7 @@ impl DerefMut for ManuallyDropRc { /// This inner struct allows us to let the outer JsRuntime drop normally without a Drop impl, while we /// control dropping more closely here using ManuallyDrop. struct InnerIsolateState { - snapshotting: bool, + will_snapshot: bool, state: ManuallyDropRc>, v8_isolate: ManuallyDrop, } @@ -182,7 +178,7 @@ impl Drop for InnerIsolateState { // SAFETY: We gotta drop these unsafe { ManuallyDrop::drop(&mut self.state.0); - if self.snapshotting { + if self.will_snapshot { // Create the snapshot and just drop it. eprintln!("WARNING: v8::OwnedIsolate for snapshot was leaked"); } else { @@ -192,47 +188,46 @@ impl Drop for InnerIsolateState { } } +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +pub(crate) enum InitMode { + /// We have no snapshot -- this is a pristine context. + New, + /// We are using a snapshot, thus certain initialization steps are skipped. + FromSnapshot, +} + +impl InitMode { + fn from_options(options: &RuntimeOptions) -> Self { + match options.startup_snapshot { + None => Self::New, + Some(_) => Self::FromSnapshot, + } + } +} + /// A single execution context of JavaScript. Corresponds roughly to the "Web /// Worker" concept in the DOM. //// -/// The JsRuntimeImpl future completes when there is an error or when all +/// The JsRuntime future completes when there is an error or when all /// pending ops have completed. /// -/// API consumers will want to use either the [`JsRuntime`] or [`JsRuntimeForSnapshot`] -/// type aliases. -pub struct JsRuntimeImpl { +/// Use [`JsRuntimeForSnapshot`] to be able to create a snapshot. +pub struct JsRuntime { inner: InnerIsolateState, module_map: Rc>, allocations: IsolateAllocations, extensions: Vec, event_loop_middlewares: Vec>, - bindings_mode: BindingsMode, + init_mode: InitMode, // Marks if this is considered the top-level runtime. Used only be inspector. is_main: bool, } -/// The runtime type that most users will use when not creating a snapshot. -pub struct JsRuntime(JsRuntimeImpl); - -impl Deref for JsRuntime { - type Target = JsRuntimeImpl; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for JsRuntime { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - /// The runtime type used for snapshot creation. -pub struct JsRuntimeForSnapshot(JsRuntimeImpl); +pub struct JsRuntimeForSnapshot(JsRuntime); impl Deref for JsRuntimeForSnapshot { - type Target = JsRuntimeImpl; + type Target = JsRuntime; fn deref(&self) -> &Self::Target { &self.0 @@ -301,7 +296,7 @@ pub type SharedArrayBufferStore = pub type CompiledWasmModuleStore = CrossIsolateStore; -/// Internal state for JsRuntimeImpl which is stored in one of v8::Isolate's +/// Internal state for JsRuntime which is stored in one of v8::Isolate's /// embedder slots. pub struct JsRuntimeState { global_realm: Option, @@ -398,7 +393,7 @@ pub struct RuntimeOptions { /// executed tries to load modules. pub module_loader: Option>, - /// JsRuntimeImpl extensions, not to be confused with ES modules. + /// JsRuntime extensions, not to be confused with ES modules. /// Only ops registered by extensions will be initialized. If you need /// to execute JS code from extensions, pass source files in `js` or `esm` /// option on `ExtensionBuilder`. @@ -448,21 +443,60 @@ pub struct RuntimeSnapshotOptions { pub snapshot_module_load_cb: Option, } -trait JsRuntimeInternalTrait { - fn create_raw_isolate( - refs: &'static v8::ExternalReferences, - params: Option, - snapshot: SnapshotOptions, - ) -> v8::OwnedIsolate; -} +impl JsRuntime { + /// Only constructor, configuration is done through `options`. + pub fn new(mut options: RuntimeOptions) -> JsRuntime { + JsRuntime::init_v8(options.v8_platform.take(), cfg!(test)); + JsRuntime::new_inner(options, false, None) + } -impl JsRuntimeImpl { - fn init_v8(v8_platform: Option>) { + pub(crate) fn state_from( + isolate: &v8::Isolate, + ) -> Rc> { + let state_ptr = isolate.get_data(STATE_DATA_OFFSET); + let state_rc = + // SAFETY: We are sure that it's a valid pointer for whole lifetime of + // the runtime. + unsafe { Rc::from_raw(state_ptr as *const RefCell) }; + let state = state_rc.clone(); + std::mem::forget(state_rc); + state + } + + pub(crate) fn module_map_from( + isolate: &v8::Isolate, + ) -> Rc> { + let module_map_ptr = isolate.get_data(MODULE_MAP_DATA_OFFSET); + let module_map_rc = + // SAFETY: We are sure that it's a valid pointer for whole lifetime of + // the runtime. + unsafe { Rc::from_raw(module_map_ptr as *const RefCell) }; + let module_map = module_map_rc.clone(); + std::mem::forget(module_map_rc); + module_map + } + + pub(crate) fn event_loop_pending_state_from_scope( + scope: &mut v8::HandleScope, + ) -> EventLoopPendingState { + let state = JsRuntime::state_from(scope); + let module_map = JsRuntime::module_map_from(scope); + let state = EventLoopPendingState::new( + scope, + &mut state.borrow_mut(), + &module_map.borrow(), + ); + state + } + + fn init_v8( + v8_platform: Option>, + predictable: bool, + ) { static DENO_INIT: Once = Once::new(); static DENO_PREDICTABLE: AtomicBool = AtomicBool::new(false); static DENO_PREDICTABLE_SET: AtomicBool = AtomicBool::new(false); - let predictable = FOR_SNAPSHOT || cfg!(test); if DENO_PREDICTABLE_SET.load(Ordering::SeqCst) { let current = DENO_PREDICTABLE.load(Ordering::SeqCst); assert_eq!(current, predictable, "V8 may only be initialized once in either snapshotting or non-snapshotting mode. Either snapshotting or non-snapshotting mode may be used in a single process, not both."); @@ -473,15 +507,13 @@ impl JsRuntimeImpl { DENO_INIT.call_once(move || v8_init(v8_platform, predictable)); } - fn new_runtime( + fn new_inner( mut options: RuntimeOptions, - snapshot_options: SnapshotOptions, + will_snapshot: bool, maybe_load_callback: Option, - ) -> JsRuntimeImpl - where - JsRuntimeImpl: JsRuntimeInternalTrait, - { - let (op_state, ops) = Self::create_opstate(&mut options, &snapshot_options); + ) -> JsRuntime { + let init_mode = InitMode::from_options(&options); + let (op_state, ops) = Self::create_opstate(&mut options, init_mode); let op_state = Rc::new(RefCell::new(op_state)); // Collect event-loop middleware @@ -546,19 +578,56 @@ impl JsRuntimeImpl { // V8 takes ownership of external_references. let refs: &'static v8::ExternalReferences = Box::leak(Box::new(refs)); - let bindings_mode = match snapshot_options { - SnapshotOptions::None => bindings::BindingsMode::New, - SnapshotOptions::Create => bindings::BindingsMode::New, - SnapshotOptions::Load(_) => bindings::BindingsMode::LoadedFinal, - SnapshotOptions::CreateFromExisting(_) => bindings::BindingsMode::Loaded, + let mut isolate = if will_snapshot { + snapshot_util::create_snapshot_creator( + refs, + options.startup_snapshot.take(), + ) + } else { + let mut params = options + .create_params + .take() + .unwrap_or_default() + .embedder_wrapper_type_info_offsets( + V8_WRAPPER_TYPE_INDEX, + V8_WRAPPER_OBJECT_INDEX, + ) + .external_references(&**refs); + if let Some(snapshot) = options.startup_snapshot.take() { + params = match snapshot { + Snapshot::Static(data) => params.snapshot_blob(data), + Snapshot::JustCreated(data) => params.snapshot_blob(data), + Snapshot::Boxed(data) => params.snapshot_blob(data), + }; + } + v8::Isolate::new(params) }; - let snapshotting = snapshot_options.will_snapshot(); - - let (mut isolate, global_context, snapshotted_data) = Self::create_isolate( - refs, - options.create_params.take(), - snapshot_options, + isolate.set_capture_stack_trace_for_uncaught_exceptions(true, 10); + isolate.set_promise_reject_callback(bindings::promise_reject_callback); + isolate.set_host_initialize_import_meta_object_callback( + bindings::host_initialize_import_meta_object_callback, ); + isolate.set_host_import_module_dynamically_callback( + bindings::host_import_module_dynamically_callback, + ); + isolate.set_wasm_async_resolve_promise_callback( + bindings::wasm_async_resolve_promise_callback, + ); + + let (global_context, snapshotted_data) = { + let scope = &mut v8::HandleScope::new(&mut isolate); + let context = v8::Context::new(scope); + + // Get module map data from the snapshot + let snapshotted_data = if init_mode == InitMode::FromSnapshot { + Some(snapshot_util::get_snapshotted_data(scope, context)) + } else { + None + }; + + (v8::Global::new(scope, context), snapshotted_data) + }; + // SAFETY: this is first use of `isolate_ptr` so we are sure we're // not overwriting an existing pointer. isolate = unsafe { @@ -575,7 +644,7 @@ impl JsRuntimeImpl { scope, context, &context_state.borrow().op_ctxs, - bindings_mode, + init_mode, ); context.set_slot(scope, context_state.clone()); @@ -619,13 +688,13 @@ impl JsRuntimeImpl { drop(context_scope); - let mut js_runtime = JsRuntimeImpl { + let mut js_runtime = JsRuntime { inner: InnerIsolateState { - snapshotting, + will_snapshot, state: ManuallyDropRc(ManuallyDrop::new(state_rc)), v8_isolate: ManuallyDrop::new(isolate), }, - bindings_mode, + init_mode, allocations: IsolateAllocations::default(), event_loop_middlewares, extensions: options.extensions, @@ -641,51 +710,6 @@ impl JsRuntimeImpl { js_runtime } - /// Create a new [`v8::OwnedIsolate`] and its global [`v8::Context`] from optional parameters and snapshot. - fn create_isolate( - refs: &'static v8::ExternalReferences, - params: Option, - snapshot: SnapshotOptions, - ) -> ( - v8::OwnedIsolate, - v8::Global, - Option, - ) - where - JsRuntimeImpl: JsRuntimeInternalTrait, - { - let has_snapshot = snapshot.loaded(); - let mut isolate = Self::create_raw_isolate(refs, params, snapshot); - - isolate.set_capture_stack_trace_for_uncaught_exceptions(true, 10); - isolate.set_promise_reject_callback(bindings::promise_reject_callback); - isolate.set_host_initialize_import_meta_object_callback( - bindings::host_initialize_import_meta_object_callback, - ); - isolate.set_host_import_module_dynamically_callback( - bindings::host_import_module_dynamically_callback, - ); - isolate.set_wasm_async_resolve_promise_callback( - bindings::wasm_async_resolve_promise_callback, - ); - - let (context, snapshotted_data) = { - let scope = &mut v8::HandleScope::new(&mut isolate); - let context = v8::Context::new(scope); - - // Get module map data from the snapshot - let snapshotted_data = if has_snapshot { - Some(snapshot_util::get_snapshotted_data(scope, context)) - } else { - None - }; - - (v8::Global::new(scope, context), snapshotted_data) - }; - - (isolate, context, snapshotted_data) - } - #[cfg(test)] #[inline] pub(crate) fn module_map(&self) -> &Rc> { @@ -728,7 +752,7 @@ impl JsRuntimeImpl { /// Creates a new realm (V8 context) in this JS execution context, /// pre-initialized with all of the extensions that were passed in - /// [`RuntimeOptions::extensions`] when the [`JsRuntimeImpl`] was + /// [`RuntimeOptions::extensions`] when the [`JsRuntime`] was /// constructed. pub fn create_realm(&mut self) -> Result { let realm = { @@ -768,7 +792,7 @@ impl JsRuntimeImpl { scope, context, &context_state.borrow().op_ctxs, - self.bindings_mode, + self.init_mode, ); context.set_slot(scope, context_state.clone()); let realm = JsRealmInner::new( @@ -946,10 +970,10 @@ impl JsRuntimeImpl { /// Initializes ops of provided Extensions fn create_opstate( options: &mut RuntimeOptions, - snapshot_options: &SnapshotOptions, + init_mode: InitMode, ) -> (OpState, Vec) { // Add built-in extension - if snapshot_options.loaded() { + if init_mode == InitMode::FromSnapshot { options .extensions .insert(0, crate::ops_builtin::core::init_ops()); @@ -1470,78 +1494,15 @@ impl JsRuntimeImpl { } } -impl JsRuntime { - /// Only constructor, configuration is done through `options`. - pub fn new(mut options: RuntimeOptions) -> JsRuntime { - JsRuntimeImpl::::init_v8(options.v8_platform.take()); - - let snapshot_options = snapshot_util::SnapshotOptions::new_from( - options.startup_snapshot.take(), - false, - ); - - JsRuntime(JsRuntimeImpl::::new_runtime( - options, - snapshot_options, - None, - )) - } - - pub(crate) fn state_from( - isolate: &v8::Isolate, - ) -> Rc> { - let state_ptr = isolate.get_data(STATE_DATA_OFFSET); - let state_rc = - // SAFETY: We are sure that it's a valid pointer for whole lifetime of - // the runtime. - unsafe { Rc::from_raw(state_ptr as *const RefCell) }; - let state = state_rc.clone(); - std::mem::forget(state_rc); - state - } - - pub(crate) fn module_map_from( - isolate: &v8::Isolate, - ) -> Rc> { - let module_map_ptr = isolate.get_data(MODULE_MAP_DATA_OFFSET); - let module_map_rc = - // SAFETY: We are sure that it's a valid pointer for whole lifetime of - // the runtime. - unsafe { Rc::from_raw(module_map_ptr as *const RefCell) }; - let module_map = module_map_rc.clone(); - std::mem::forget(module_map_rc); - module_map - } - - pub(crate) fn event_loop_pending_state_from_scope( - scope: &mut v8::HandleScope, - ) -> EventLoopPendingState { - let state = JsRuntime::state_from(scope); - let module_map = JsRuntime::module_map_from(scope); - let state = EventLoopPendingState::new( - scope, - &mut state.borrow_mut(), - &module_map.borrow(), - ); - state - } -} - impl JsRuntimeForSnapshot { pub fn new( mut options: RuntimeOptions, runtime_snapshot_options: RuntimeSnapshotOptions, ) -> JsRuntimeForSnapshot { - JsRuntimeImpl::::init_v8(options.v8_platform.take()); - - let snapshot_options = snapshot_util::SnapshotOptions::new_from( - options.startup_snapshot.take(), - true, - ); - - JsRuntimeForSnapshot(JsRuntimeImpl::::new_runtime( + JsRuntime::init_v8(options.v8_platform.take(), true); + JsRuntimeForSnapshot(JsRuntime::new_inner( options, - snapshot_options, + true, runtime_snapshot_options.snapshot_module_load_cb, )) } @@ -1590,42 +1551,6 @@ impl JsRuntimeForSnapshot { } } -impl JsRuntimeInternalTrait for JsRuntimeImpl { - fn create_raw_isolate( - refs: &'static v8::ExternalReferences, - _params: Option, - snapshot: SnapshotOptions, - ) -> v8::OwnedIsolate { - snapshot_util::create_snapshot_creator(refs, snapshot) - } -} - -impl JsRuntimeInternalTrait for JsRuntimeImpl { - fn create_raw_isolate( - refs: &'static v8::ExternalReferences, - params: Option, - snapshot: SnapshotOptions, - ) -> v8::OwnedIsolate { - let mut params = params - .unwrap_or_default() - .embedder_wrapper_type_info_offsets( - V8_WRAPPER_TYPE_INDEX, - V8_WRAPPER_OBJECT_INDEX, - ) - .external_references(&**refs); - - if let Some(snapshot) = snapshot.snapshot() { - params = match snapshot { - Snapshot::Static(data) => params.snapshot_blob(data), - Snapshot::JustCreated(data) => params.snapshot_blob(data), - Snapshot::Boxed(data) => params.snapshot_blob(data), - }; - } - - v8::Isolate::new(params) - } -} - fn get_stalled_top_level_await_message_for_module( scope: &mut v8::HandleScope, module_id: ModuleId, @@ -1731,7 +1656,7 @@ where F: FnMut(usize, usize) -> usize, { // SAFETY: The data is a pointer to the Rust callback function. It is stored - // in `JsRuntimeImpl::allocations` and thus is guaranteed to outlive the isolate. + // in `JsRuntime::allocations` and thus is guaranteed to outlive the isolate. let callback = unsafe { &mut *(data as *mut F) }; callback(current_heap_limit, initial_heap_limit) } @@ -1800,7 +1725,7 @@ pub(crate) fn exception_to_err_result( } // Related to module loading -impl JsRuntimeImpl { +impl JsRuntime { pub(crate) fn instantiate_module( &mut self, id: ModuleId, @@ -1916,11 +1841,11 @@ impl JsRuntimeImpl { /// Evaluates an already instantiated ES module. /// /// Returns a receiver handle that resolves when module promise resolves. - /// Implementors must manually call [`JsRuntimeImpl::run_event_loop`] to drive + /// Implementors must manually call [`JsRuntime::run_event_loop`] to drive /// module evaluation future. /// /// `Error` can usually be downcast to `JsError` and should be awaited and - /// checked after [`JsRuntimeImpl::run_event_loop`] completion. + /// checked after [`JsRuntime::run_event_loop`] completion. /// /// This function panics if module has not been instantiated. pub fn mod_evaluate( @@ -1953,7 +1878,7 @@ impl JsRuntimeImpl { // Because that promise is created internally by V8, when error occurs during // module evaluation the promise is rejected, and since the promise has no rejection // handler it will result in call to `bindings::promise_reject_callback` adding - // the promise to pending promise rejection table - meaning JsRuntimeImpl will return + // the promise to pending promise rejection table - meaning JsRuntime will return // error on next poll(). // // This situation is not desirable as we want to manually return error at the @@ -2362,7 +2287,7 @@ impl JsRuntimeImpl { /// The module will be marked as "main", and because of that /// "import.meta.main" will return true when checked inside that module. /// - /// User must call [`JsRuntimeImpl::mod_evaluate`] with returned `ModuleId` + /// User must call [`JsRuntime::mod_evaluate`] with returned `ModuleId` /// manually after load is finished. pub async fn load_main_module( &mut self, @@ -2417,7 +2342,7 @@ impl JsRuntimeImpl { /// This method is meant to be used when loading some utility code that /// might be later imported by the main module (ie. an entry point module). /// - /// User must call [`JsRuntimeImpl::mod_evaluate`] with returned `ModuleId` + /// User must call [`JsRuntime::mod_evaluate`] with returned `ModuleId` /// manually after load is finished. pub async fn load_side_module( &mut self, @@ -2563,7 +2488,7 @@ pub fn queue_fast_async_op( ) { let runtime_state = match ctx.runtime_state.upgrade() { Some(rc_state) => rc_state, - // at least 1 Rc is held by the JsRuntimeImpl. + // at least 1 Rc is held by the JsRuntime. None => unreachable!(), }; let get_class = { @@ -2661,7 +2586,7 @@ pub fn queue_async_op<'s>( ) -> Option> { let runtime_state = match ctx.runtime_state.upgrade() { Some(rc_state) => rc_state, - // at least 1 Rc is held by the JsRuntimeImpl. + // at least 1 Rc is held by the JsRuntime. None => unreachable!(), }; @@ -3559,8 +3484,8 @@ pub mod tests { } } - fn create_module( - runtime: &mut JsRuntimeImpl, + fn create_module( + runtime: &mut JsRuntime, i: usize, main: bool, ) -> ModuleInfo { @@ -3603,10 +3528,7 @@ pub mod tests { } } - fn assert_module_map( - runtime: &mut JsRuntimeImpl, - modules: &Vec, - ) { + fn assert_module_map(runtime: &mut JsRuntime, modules: &Vec) { let module_map = runtime.module_map.borrow(); assert_eq!(module_map.handles.len(), modules.len()); assert_eq!(module_map.info.len(), modules.len()); @@ -4679,13 +4601,7 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", { Ok(String::from("Test")) } - deno_core::extension!( - test_ext, - ops = [op_test], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, - ); + deno_core::extension!(test_ext, ops = [op_test]); let mut runtime = JsRuntime::new(RuntimeOptions { startup_snapshot: Some(Snapshot::Boxed(snapshot)), extensions: vec![test_ext::init_ops()], diff --git a/core/snapshot_util.rs b/core/snapshot_util.rs index 05a196f50c..88c2731477 100644 --- a/core/snapshot_util.rs +++ b/core/snapshot_util.rs @@ -153,40 +153,6 @@ fn data_error_to_panic(err: v8::DataError) -> ! { } } -pub(crate) enum SnapshotOptions { - Load(Snapshot), - CreateFromExisting(Snapshot), - Create, - None, -} - -impl SnapshotOptions { - pub fn new_from(snapshot: Option, will_snapshot: bool) -> Self { - match (snapshot, will_snapshot) { - (Some(snapshot), true) => Self::CreateFromExisting(snapshot), - (None, true) => Self::Create, - (Some(snapshot), false) => Self::Load(snapshot), - (None, false) => Self::None, - } - } - - pub fn loaded(&self) -> bool { - matches!(self, Self::Load(_) | Self::CreateFromExisting(_)) - } - - pub fn will_snapshot(&self) -> bool { - matches!(self, Self::Create | Self::CreateFromExisting(_)) - } - - pub fn snapshot(self) -> Option { - match self { - Self::CreateFromExisting(snapshot) => Some(snapshot), - Self::Load(snapshot) => Some(snapshot), - _ => None, - } - } -} - pub(crate) struct SnapshottedData { pub module_map_data: v8::Global, pub module_handles: Vec>, @@ -257,9 +223,9 @@ pub(crate) fn set_snapshotted_data( /// Returns an isolate set up for snapshotting. pub(crate) fn create_snapshot_creator( external_refs: &'static v8::ExternalReferences, - maybe_startup_snapshot: SnapshotOptions, + maybe_startup_snapshot: Option, ) -> v8::OwnedIsolate { - if let Some(snapshot) = maybe_startup_snapshot.snapshot() { + if let Some(snapshot) = maybe_startup_snapshot { match snapshot { Snapshot::Static(data) => { v8::Isolate::snapshot_creator_from_existing_snapshot( diff --git a/ops/lib.rs b/ops/lib.rs index d4fa0bb824..d7c8b06402 100644 --- a/ops/lib.rs +++ b/ops/lib.rs @@ -143,7 +143,6 @@ impl Op { is_async: #is_async, is_unstable: #is_unstable, is_v8: #is_v8, - force_registration: false, // TODO(mmastrac) arg_count: 0, } @@ -206,7 +205,6 @@ impl Op { is_async: #is_async, is_unstable: #is_unstable, is_v8: #is_v8, - force_registration: false, arg_count: #arg_count as u8, } } diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out index 3765e611a8..d59967a451 100644 --- a/ops/optimizer_tests/async_nop.out +++ b/ops/optimizer_tests/async_nop.out @@ -40,7 +40,6 @@ impl op_void_async { is_async: true, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out index ca6d13c2e8..6f61a9697c 100644 --- a/ops/optimizer_tests/async_result.out +++ b/ops/optimizer_tests/async_result.out @@ -40,7 +40,6 @@ impl op_async_result { is_async: true, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out index 656124a807..d46d46765d 100644 --- a/ops/optimizer_tests/callback_options.out +++ b/ops/optimizer_tests/callback_options.out @@ -40,7 +40,6 @@ impl op_fallback { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out index ebb2108a21..d52df86ee6 100644 --- a/ops/optimizer_tests/cow_str.out +++ b/ops/optimizer_tests/cow_str.out @@ -40,7 +40,6 @@ impl op_cow_str { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out index 811aee288f..403ec8fa39 100644 --- a/ops/optimizer_tests/f64_slice.out +++ b/ops/optimizer_tests/f64_slice.out @@ -40,7 +40,6 @@ impl op_f64_buf { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/incompatible_1.out b/ops/optimizer_tests/incompatible_1.out index 59eb600bc6..0e8c98fd0a 100644 --- a/ops/optimizer_tests/incompatible_1.out +++ b/ops/optimizer_tests/incompatible_1.out @@ -30,7 +30,6 @@ impl op_sync_serialize_object_with_numbers_as_keys { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out index 35bd383390..355add5e08 100644 --- a/ops/optimizer_tests/issue16934.out +++ b/ops/optimizer_tests/issue16934.out @@ -30,7 +30,6 @@ impl send_stdin { is_async: true, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out index 1291f9cabf..b6e80b5749 100644 --- a/ops/optimizer_tests/issue16934_fast.out +++ b/ops/optimizer_tests/issue16934_fast.out @@ -30,7 +30,6 @@ impl send_stdin { is_async: true, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.out b/ops/optimizer_tests/op_blob_revoke_object_url.out index 1a10a2b0a8..3165430df1 100644 --- a/ops/optimizer_tests/op_blob_revoke_object_url.out +++ b/ops/optimizer_tests/op_blob_revoke_object_url.out @@ -30,7 +30,6 @@ impl op_blob_revoke_object_url { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out index f3da0dfce5..3e4b2571da 100644 --- a/ops/optimizer_tests/op_ffi_ptr_value.out +++ b/ops/optimizer_tests/op_ffi_ptr_value.out @@ -40,7 +40,6 @@ impl op_ffi_ptr_value { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/op_print.out b/ops/optimizer_tests/op_print.out index e0fecd6b29..d79cdfd620 100644 --- a/ops/optimizer_tests/op_print.out +++ b/ops/optimizer_tests/op_print.out @@ -30,7 +30,6 @@ impl op_print { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out index 300dd6fc2f..1d83ae4315 100644 --- a/ops/optimizer_tests/op_state.out +++ b/ops/optimizer_tests/op_state.out @@ -40,7 +40,6 @@ impl op_set_exit_code { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out index 2452e886c0..c1ea447c53 100644 --- a/ops/optimizer_tests/op_state_basic1.out +++ b/ops/optimizer_tests/op_state_basic1.out @@ -40,7 +40,6 @@ impl foo { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out index 3faaa4bf16..24596256ac 100644 --- a/ops/optimizer_tests/op_state_generics.out +++ b/ops/optimizer_tests/op_state_generics.out @@ -46,7 +46,6 @@ impl op_foo { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 0usize as u8, } } diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out index 137eeeac04..4c58de8d6e 100644 --- a/ops/optimizer_tests/op_state_result.out +++ b/ops/optimizer_tests/op_state_result.out @@ -40,7 +40,6 @@ impl foo { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out index ce677f0fa8..97d76aa975 100644 --- a/ops/optimizer_tests/op_state_warning.out +++ b/ops/optimizer_tests/op_state_warning.out @@ -40,7 +40,6 @@ impl op_listen { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 0usize as u8, } } diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out index 4347f63e45..3bbb7289fc 100644 --- a/ops/optimizer_tests/op_state_with_transforms.out +++ b/ops/optimizer_tests/op_state_with_transforms.out @@ -46,7 +46,6 @@ impl op_now { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out index a1ae081270..88651ce765 100644 --- a/ops/optimizer_tests/opstate_with_arity.out +++ b/ops/optimizer_tests/opstate_with_arity.out @@ -40,7 +40,6 @@ impl op_add_4 { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 4usize as u8, } } diff --git a/ops/optimizer_tests/option_arg.out b/ops/optimizer_tests/option_arg.out index adfc8da19d..f00937a745 100644 --- a/ops/optimizer_tests/option_arg.out +++ b/ops/optimizer_tests/option_arg.out @@ -30,7 +30,6 @@ impl op_try_close { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out index d8c0842ac5..d186e5108b 100644 --- a/ops/optimizer_tests/owned_string.out +++ b/ops/optimizer_tests/owned_string.out @@ -40,7 +40,6 @@ impl op_string_length { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/param_mut_binding_warning.out b/ops/optimizer_tests/param_mut_binding_warning.out index e99606b377..5435b21db6 100644 --- a/ops/optimizer_tests/param_mut_binding_warning.out +++ b/ops/optimizer_tests/param_mut_binding_warning.out @@ -30,7 +30,6 @@ impl op_read_sync { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out index 3eefb5e7f4..a1bacbfc83 100644 --- a/ops/optimizer_tests/raw_ptr.out +++ b/ops/optimizer_tests/raw_ptr.out @@ -51,7 +51,6 @@ impl op_ffi_ptr_of { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out index 867d89e43c..1a3d1ed31c 100644 --- a/ops/optimizer_tests/serde_v8_value.out +++ b/ops/optimizer_tests/serde_v8_value.out @@ -40,7 +40,6 @@ impl op_is_proxy { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out index 523736d70e..a1e684caf3 100644 --- a/ops/optimizer_tests/strings.out +++ b/ops/optimizer_tests/strings.out @@ -40,7 +40,6 @@ impl op_string_length { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/strings_result.out b/ops/optimizer_tests/strings_result.out index aae8b356bc..46e27e7629 100644 --- a/ops/optimizer_tests/strings_result.out +++ b/ops/optimizer_tests/strings_result.out @@ -30,7 +30,6 @@ impl op_string_length { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/ops/optimizer_tests/u64_result.out b/ops/optimizer_tests/u64_result.out index a0d7465125..46ccd53e1a 100644 --- a/ops/optimizer_tests/u64_result.out +++ b/ops/optimizer_tests/u64_result.out @@ -30,7 +30,6 @@ impl op_bench_now { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 0usize as u8, } } diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out index 124f2ac576..31915d2fed 100644 --- a/ops/optimizer_tests/uint8array.out +++ b/ops/optimizer_tests/uint8array.out @@ -40,7 +40,6 @@ impl op_import_spki_x25519 { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out index 9a46ee0874..cab67c0ea9 100644 --- a/ops/optimizer_tests/unit_result.out +++ b/ops/optimizer_tests/unit_result.out @@ -40,7 +40,6 @@ impl op_unit_result { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 0usize as u8, } } diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out index c2e6708a03..3d84797911 100644 --- a/ops/optimizer_tests/unit_result2.out +++ b/ops/optimizer_tests/unit_result2.out @@ -40,7 +40,6 @@ impl op_set_nodelay { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 2usize as u8, } } diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out index 538674068e..523ae6504d 100644 --- a/ops/optimizer_tests/unit_ret.out +++ b/ops/optimizer_tests/unit_ret.out @@ -40,7 +40,6 @@ impl op_unit { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 0usize as u8, } } diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out index cc8e3b8472..5a8996cd03 100644 --- a/ops/optimizer_tests/wasm_op.out +++ b/ops/optimizer_tests/wasm_op.out @@ -40,7 +40,6 @@ impl op_wasm { is_async: false, is_unstable: false, is_v8: false, - force_registration: false, arg_count: 1usize as u8, } } diff --git a/runtime/examples/extension_with_ops/main.rs b/runtime/examples/extension_with_ops/main.rs index 47feaeaeb5..1feb4ba279 100644 --- a/runtime/examples/extension_with_ops/main.rs +++ b/runtime/examples/extension_with_ops/main.rs @@ -11,13 +11,7 @@ use deno_runtime::permissions::PermissionsContainer; use deno_runtime::worker::MainWorker; use deno_runtime::worker::WorkerOptions; -deno_core::extension!( - hello_runtime, - ops = [op_hello], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, -); +deno_core::extension!(hello_runtime, ops = [op_hello]); #[op] fn op_hello(text: &str) { diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs index 27e76b3d34..2668431ebf 100644 --- a/runtime/ops/fs_events.rs +++ b/runtime/ops/fs_events.rs @@ -31,9 +31,6 @@ use tokio::sync::mpsc; deno_core::extension!( deno_fs_events, ops = [op_fs_events_open, op_fs_events_poll], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); struct FsEventsResource { diff --git a/runtime/ops/http.rs b/runtime/ops/http.rs index 767fc3ae01..eb27112570 100644 --- a/runtime/ops/http.rs +++ b/runtime/ops/http.rs @@ -30,9 +30,6 @@ use tokio::net::UnixStream; deno_core::extension!( deno_http_runtime, ops = [op_http_start, op_http_upgrade], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[op] diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs index b997a89d9d..043dec7000 100644 --- a/runtime/ops/os/mod.rs +++ b/runtime/ops/os/mod.rs @@ -48,9 +48,6 @@ deno_core::extension!( state = |state, options| { state.put::(options.exit_code); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - } ); deno_core::extension!( @@ -63,9 +60,6 @@ deno_core::extension!( }, _ => op, }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - } ); #[op] diff --git a/runtime/ops/permissions.rs b/runtime/ops/permissions.rs index 6f7b98a304..663b1d2409 100644 --- a/runtime/ops/permissions.rs +++ b/runtime/ops/permissions.rs @@ -18,9 +18,6 @@ deno_core::extension!( op_revoke_permission, op_request_permission, ], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[derive(Deserialize)] diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index a2eace8b6a..44429fdab7 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -112,9 +112,6 @@ deno_core::extension!( deprecated::op_run_status, deprecated::op_kill, ], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); /// Second member stores the pid separately from the RefCell. It's needed for diff --git a/runtime/ops/runtime.rs b/runtime/ops/runtime.rs index 9f2e48d7aa..3f60c74379 100644 --- a/runtime/ops/runtime.rs +++ b/runtime/ops/runtime.rs @@ -13,9 +13,6 @@ deno_core::extension!( state = |state, options| { state.put::(options.main_module); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[op] diff --git a/runtime/ops/signal.rs b/runtime/ops/signal.rs index ba9a2a1785..934192c777 100644 --- a/runtime/ops/signal.rs +++ b/runtime/ops/signal.rs @@ -32,9 +32,6 @@ use tokio::signal::windows::CtrlC; deno_core::extension!( deno_signal, ops = [op_signal_bind, op_signal_unbind, op_signal_poll], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[cfg(unix)] diff --git a/runtime/ops/tty.rs b/runtime/ops/tty.rs index 7f24daec4b..b4e4d73400 100644 --- a/runtime/ops/tty.rs +++ b/runtime/ops/tty.rs @@ -79,9 +79,6 @@ deno_core::extension!( #[cfg(unix)] state.put(TtyModeStore::default()); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); // ref: diff --git a/runtime/ops/web_worker.rs b/runtime/ops/web_worker.rs index 7952a03f26..e62642fdd6 100644 --- a/runtime/ops/web_worker.rs +++ b/runtime/ops/web_worker.rs @@ -25,9 +25,6 @@ deno_core::extension!( op_worker_get_type, op_worker_sync_fetch, ], - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[op] diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index d5285ec890..f96ae38e8a 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -119,9 +119,6 @@ deno_core::extension!( FormatJsErrorFnHolder(options.format_js_error_fn); state.put::(format_js_error_fn_holder); }, - customizer = |ext: &mut deno_core::ExtensionBuilder| { - ext.force_op_registration(); - }, ); #[derive(Deserialize)]