diff options
Diffstat (limited to 'ops/optimizer_tests')
93 files changed, 0 insertions, 4549 deletions
diff --git a/ops/optimizer_tests/async_nop.expected b/ops/optimizer_tests/async_nop.expected deleted file mode 100644 index 42a1180bd..000000000 --- a/ops/optimizer_tests/async_nop.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value, I32] -transforms: {} -is_async: true -fast_compatible: true diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out deleted file mode 100644 index 85c55f2f4..000000000 --- a/ops/optimizer_tests/async_nop.out +++ /dev/null @@ -1,137 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_void_async::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_void_async { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_void_async { - const NAME: &'static str = stringify!(op_void_async); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Int32, CallbackOptions], - CType::Void, - Self::op_void_async_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_void_async { - pub const fn name() -> &'static str { - stringify!(op_void_async) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Int32, CallbackOptions], - CType::Void, - Self::op_void_async_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - async fn call<'scope>() {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - use deno_core::futures::FutureExt; - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let promise_id = args.get(0); - let promise_id = deno_core::v8::Local::< - deno_core::v8::Integer, - >::try_from(promise_id) - .map(|l| l.value() as deno_core::PromiseId) - .map_err(deno_core::anyhow::Error::from); - let promise_id: deno_core::PromiseId = match promise_id { - Ok(promise_id) => promise_id, - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!("invalid promise id: {}", err), - ); - return; - } - }; - let fut = deno_core::_ops::map_async_op2(ctx, Self::call()); - let maybe_response = deno_core::_ops::queue_async_op( - ctx, - scope, - false, - promise_id, - fut, - ); - if let Some(response) = maybe_response { - rv.set(response); - } - } -} -impl op_void_async { - #[allow(clippy::too_many_arguments)] - fn op_void_async_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - __promise_id: i32, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let op_state = __ctx.state.clone(); - let result = Self::call(); - let result = _ops::queue_fast_async_op( - __ctx, - __promise_id, - async move { Ok(result.await) }, - ); - result - } -} diff --git a/ops/optimizer_tests/async_nop.rs b/ops/optimizer_tests/async_nop.rs deleted file mode 100644 index 95a1522f1..000000000 --- a/ops/optimizer_tests/async_nop.rs +++ /dev/null @@ -1,3 +0,0 @@ -async fn op_void_async() { - // @test-attr:fast -} diff --git a/ops/optimizer_tests/async_result.expected b/ops/optimizer_tests/async_result.expected deleted file mode 100644 index 87d46977d..000000000 --- a/ops/optimizer_tests/async_result.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: false -has_rc_opstate: true -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: None -fast_parameters: [V8Value, I32, U32] -transforms: {} -is_async: true -fast_compatible: true diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out deleted file mode 100644 index 91117e4a1..000000000 --- a/ops/optimizer_tests/async_result.out +++ /dev/null @@ -1,150 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_async_result::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_async_result { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_async_result { - const NAME: &'static str = stringify!(op_async_result); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Int32, Uint32, CallbackOptions], - CType::Void, - Self::op_async_result_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_async_result { - pub const fn name() -> &'static str { - stringify!(op_async_result) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Int32, Uint32, CallbackOptions], - CType::Void, - Self::op_async_result_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - async fn call<'scope>( - state: Rc<RefCell<OpState>>, - rid: ResourceId, - ) -> Result<u32, Error> {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - use deno_core::futures::FutureExt; - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let promise_id = args.get(0); - let promise_id = deno_core::v8::Local::< - deno_core::v8::Integer, - >::try_from(promise_id) - .map(|l| l.value() as deno_core::PromiseId) - .map_err(deno_core::anyhow::Error::from); - let promise_id: deno_core::PromiseId = match promise_id { - Ok(promise_id) => promise_id, - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!("invalid promise id: {}", err), - ); - return; - } - }; - let arg_0 = args.get(1usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let fut = deno_core::_ops::map_async_op1( - ctx, - Self::call(ctx.state.clone(), arg_0), - ); - let maybe_response = deno_core::_ops::queue_async_op( - ctx, - scope, - false, - promise_id, - fut, - ); - if let Some(response) = maybe_response { - rv.set(response); - } - } -} -impl op_async_result { - #[allow(clippy::too_many_arguments)] - fn op_async_result_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - __promise_id: i32, - rid: ResourceId, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = __ctx.state.clone(); - let result = Self::call(state, rid); - let result = _ops::queue_fast_async_op(__ctx, __promise_id, result); - } -} diff --git a/ops/optimizer_tests/async_result.rs b/ops/optimizer_tests/async_result.rs deleted file mode 100644 index 54ac20d3c..000000000 --- a/ops/optimizer_tests/async_result.rs +++ /dev/null @@ -1,6 +0,0 @@ -async fn op_async_result( - state: Rc<RefCell<OpState>>, - rid: ResourceId, -) -> Result<u32, Error> { - // @test-attr:fast -} diff --git a/ops/optimizer_tests/callback_options.expected b/ops/optimizer_tests/callback_options.expected deleted file mode 100644 index 245fdfd55..000000000 --- a/ops/optimizer_tests/callback_options.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: true -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out deleted file mode 100644 index a868d6393..000000000 --- a/ops/optimizer_tests/callback_options.out +++ /dev/null @@ -1,106 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_fallback::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_fallback { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_fallback { - const NAME: &'static str = stringify!(op_fallback); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_fallback_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_fallback { - pub const fn name() -> &'static str { - stringify!(op_fallback) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_fallback_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(options: Option<&mut FastApiCallbackOptions>) { - if let Some(options) = options { - options.fallback = true; - } - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = None; - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl op_fallback { - #[allow(clippy::too_many_arguments)] - fn op_fallback_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let result = Self::call(options); - result - } -} diff --git a/ops/optimizer_tests/callback_options.rs b/ops/optimizer_tests/callback_options.rs deleted file mode 100644 index c210171d2..000000000 --- a/ops/optimizer_tests/callback_options.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn op_fallback(options: Option<&mut FastApiCallbackOptions>) { - if let Some(options) = options { - options.fallback = true; - } -} diff --git a/ops/optimizer_tests/cow_str.expected b/ops/optimizer_tests/cow_str.expected deleted file mode 100644 index 9db8cfaf3..000000000 --- a/ops/optimizer_tests/cow_str.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(Void) -fast_parameters: [V8Value, SeqOneByteString] -transforms: {0: Transform { kind: SeqOneByteString(Cow), index: 0 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out deleted file mode 100644 index 15c92f346..000000000 --- a/ops/optimizer_tests/cow_str.out +++ /dev/null @@ -1,121 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_cow_str::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_cow_str { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_cow_str { - const NAME: &'static str = stringify!(op_cow_str); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, SeqOneByteString, CallbackOptions], - CType::Void, - Self::op_cow_str_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_cow_str { - pub const fn name() -> &'static str { - stringify!(op_cow_str) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, SeqOneByteString, CallbackOptions], - CType::Void, - Self::op_cow_str_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(c: Cow<'_, str>) {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = match deno_core::v8::Local::< - deno_core::v8::String, - >::try_from(args.get(0usize as i32)) { - Ok(v8_string) => { - ::std::borrow::Cow::Owned(deno_core::serde_v8::to_utf8(v8_string, scope)) - } - Err(_) => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected string at position {}", 0usize), - ); - } - }; - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl op_cow_str { - #[allow(clippy::too_many_arguments)] - fn op_cow_str_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - c: *const deno_core::v8::fast_api::FastApiOneByteString, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let c = ::std::borrow::Cow::Borrowed( - match ::std::str::from_utf8(unsafe { &*c }.as_bytes()) { - Ok(v) => v, - Err(_) => { - unsafe { &mut *fast_api_callback_options }.fallback = true; - return Default::default(); - } - }, - ); - let result = Self::call(c); - result - } -} diff --git a/ops/optimizer_tests/cow_str.rs b/ops/optimizer_tests/cow_str.rs deleted file mode 100644 index b7214bdc7..000000000 --- a/ops/optimizer_tests/cow_str.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_cow_str(c: Cow<'_, str>) { - // ... -} diff --git a/ops/optimizer_tests/f64_slice.expected b/ops/optimizer_tests/f64_slice.expected deleted file mode 100644 index 32182b004..000000000 --- a/ops/optimizer_tests/f64_slice.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(Void) -fast_parameters: [V8Value, Float64Array] -transforms: {0: Transform { kind: SliceF64(true), index: 0 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out deleted file mode 100644 index 183677731..000000000 --- a/ops/optimizer_tests/f64_slice.out +++ /dev/null @@ -1,137 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_f64_buf::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_f64_buf { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_f64_buf { - const NAME: &'static str = stringify!(op_f64_buf); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, TypedArray(CType::Float64), CallbackOptions], - CType::Void, - Self::op_f64_buf_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_f64_buf { - pub const fn name() -> &'static str { - stringify!(op_f64_buf) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, TypedArray(CType::Float64), CallbackOptions], - CType::Void, - Self::op_f64_buf_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(buffer: &mut [f64]) {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = if let Ok(view) - = deno_core::v8::Local::< - deno_core::v8::Float64Array, - >::try_from(args.get(0usize as i32)) { - let (offset, len) = (view.byte_offset(), view.byte_length()); - let buffer = match view.buffer(scope) { - Some(v) => v, - None => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected Float64Array at position {}", 0usize), - ); - } - }; - if let Some(data) = buffer.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { - ::std::slice::from_raw_parts_mut( - store.add(offset) as *mut f64, - len / 8, - ) - } - } else { - &mut [] - } - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected Float64Array at position {}", 0usize), - ); - }; - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl op_f64_buf { - #[allow(clippy::too_many_arguments)] - fn op_f64_buf_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - buffer: *const deno_core::v8::fast_api::FastApiTypedArray<f64>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let buffer = match unsafe { &*buffer }.get_storage_if_aligned() { - Some(v) => v, - None => { - unsafe { &mut *fast_api_callback_options }.fallback = true; - return Default::default(); - } - }; - let result = Self::call(buffer); - result - } -} diff --git a/ops/optimizer_tests/f64_slice.rs b/ops/optimizer_tests/f64_slice.rs deleted file mode 100644 index fa2778531..000000000 --- a/ops/optimizer_tests/f64_slice.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_f64_buf(buffer: &mut [f64]) { - // @test-attr:fast -} diff --git a/ops/optimizer_tests/incompatible_1.expected b/ops/optimizer_tests/incompatible_1.expected deleted file mode 100644 index 250ff1022..000000000 --- a/ops/optimizer_tests/incompatible_1.expected +++ /dev/null @@ -1 +0,0 @@ -FastUnsupportedParamType
\ No newline at end of file diff --git a/ops/optimizer_tests/incompatible_1.out b/ops/optimizer_tests/incompatible_1.out deleted file mode 100644 index d51a1eda8..000000000 --- a/ops/optimizer_tests/incompatible_1.out +++ /dev/null @@ -1,93 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_sync_serialize_object_with_numbers_as_keys::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_sync_serialize_object_with_numbers_as_keys { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_sync_serialize_object_with_numbers_as_keys { - const NAME: &'static str = stringify!(op_sync_serialize_object_with_numbers_as_keys); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_sync_serialize_object_with_numbers_as_keys { - pub const fn name() -> &'static str { - stringify!(op_sync_serialize_object_with_numbers_as_keys) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(value: serde_json::Value) -> Result<(), Error> { - assert_eq!( - value.to_string(), r#"{"lines":{"100":{"unit":"m"},"200":{"unit":"cm"}}}"# - ); - Ok(()) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => {} - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} diff --git a/ops/optimizer_tests/incompatible_1.rs b/ops/optimizer_tests/incompatible_1.rs deleted file mode 100644 index 326189aa1..000000000 --- a/ops/optimizer_tests/incompatible_1.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn op_sync_serialize_object_with_numbers_as_keys( - value: serde_json::Value, -) -> Result<(), Error> { - assert_eq!( - value.to_string(), - r#"{"lines":{"100":{"unit":"m"},"200":{"unit":"cm"}}}"# - ); - Ok(()) -} diff --git a/ops/optimizer_tests/issue16934.expected b/ops/optimizer_tests/issue16934.expected deleted file mode 100644 index 6b75ff5bf..000000000 --- a/ops/optimizer_tests/issue16934.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: None -fast_parameters: [] -transforms: {} -is_async: false -fast_compatible: false diff --git a/ops/optimizer_tests/issue16934.out b/ops/optimizer_tests/issue16934.out deleted file mode 100644 index 0f85b1157..000000000 --- a/ops/optimizer_tests/issue16934.out +++ /dev/null @@ -1,115 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `send_stdin::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct send_stdin { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for send_stdin { - const NAME: &'static str = stringify!(send_stdin); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl send_stdin { - pub const fn name() -> &'static str { - stringify!(send_stdin) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - async fn call<'scope>( - state: &mut OpState, - cmd: String, - ) -> Result<(), anyhow::Error> { - let instance = state.borrow::<MinecraftInstance>().clone(); - instance.send_command(&cmd, CausedBy::Unknown).await?; - Ok(()) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - use deno_core::futures::FutureExt; - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let promise_id = args.get(0); - let promise_id = deno_core::v8::Local::< - deno_core::v8::Integer, - >::try_from(promise_id) - .map(|l| l.value() as deno_core::PromiseId) - .map_err(deno_core::anyhow::Error::from); - let promise_id: deno_core::PromiseId = match promise_id { - Ok(promise_id) => promise_id, - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!("invalid promise id: {}", err), - ); - return; - } - }; - let arg_0 = match deno_core::v8::Local::< - deno_core::v8::String, - >::try_from(args.get(1usize as i32)) { - Ok(v8_string) => deno_core::serde_v8::to_utf8(v8_string, scope), - Err(_) => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected string at position {}", 1usize), - ); - } - }; - let fut = deno_core::_ops::map_async_op1( - ctx, - Self::call( - compile_error!("mutable opstate is not supported in async ops"), - arg_0, - ), - ); - let maybe_response = deno_core::_ops::queue_async_op( - ctx, - scope, - false, - promise_id, - fut, - ); - if let Some(response) = maybe_response { - rv.set(response); - } - } -} diff --git a/ops/optimizer_tests/issue16934.rs b/ops/optimizer_tests/issue16934.rs deleted file mode 100644 index 1e77f1281..000000000 --- a/ops/optimizer_tests/issue16934.rs +++ /dev/null @@ -1,11 +0,0 @@ -async fn send_stdin( - state: &mut OpState, - cmd: String, -) -> Result<(), anyhow::Error> { - // https://github.com/denoland/deno/issues/16934 - // - // OpState borrowed across await point is not allowed, as it will likely panic at runtime. - let instance = state.borrow::<MinecraftInstance>().clone(); - instance.send_command(&cmd, CausedBy::Unknown).await?; - Ok(()) -} diff --git a/ops/optimizer_tests/issue16934_fast.expected b/ops/optimizer_tests/issue16934_fast.expected deleted file mode 100644 index 250ff1022..000000000 --- a/ops/optimizer_tests/issue16934_fast.expected +++ /dev/null @@ -1 +0,0 @@ -FastUnsupportedParamType
\ No newline at end of file diff --git a/ops/optimizer_tests/issue16934_fast.out b/ops/optimizer_tests/issue16934_fast.out deleted file mode 100644 index 2bbbc02bb..000000000 --- a/ops/optimizer_tests/issue16934_fast.out +++ /dev/null @@ -1,110 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `send_stdin::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct send_stdin { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for send_stdin { - const NAME: &'static str = stringify!(send_stdin); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl send_stdin { - pub const fn name() -> &'static str { - stringify!(send_stdin) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: true, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - async fn call<'scope>(state: &mut OpState, v: i32) -> Result<(), anyhow::Error> { - Ok(()) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - use deno_core::futures::FutureExt; - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let promise_id = args.get(0); - let promise_id = deno_core::v8::Local::< - deno_core::v8::Integer, - >::try_from(promise_id) - .map(|l| l.value() as deno_core::PromiseId) - .map_err(deno_core::anyhow::Error::from); - let promise_id: deno_core::PromiseId = match promise_id { - Ok(promise_id) => promise_id, - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!("invalid promise id: {}", err), - ); - return; - } - }; - let arg_0 = args.get(1usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let fut = deno_core::_ops::map_async_op1( - ctx, - Self::call( - compile_error!("mutable opstate is not supported in async ops"), - arg_0, - ), - ); - let maybe_response = deno_core::_ops::queue_async_op( - ctx, - scope, - false, - promise_id, - fut, - ); - if let Some(response) = maybe_response { - rv.set(response); - } - } -} diff --git a/ops/optimizer_tests/issue16934_fast.rs b/ops/optimizer_tests/issue16934_fast.rs deleted file mode 100644 index 8d3488e9d..000000000 --- a/ops/optimizer_tests/issue16934_fast.rs +++ /dev/null @@ -1,8 +0,0 @@ -async fn send_stdin(state: &mut OpState, v: i32) -> Result<(), anyhow::Error> { - // @test-attr:fast - // - // https://github.com/denoland/deno/issues/16934 - // - // OpState borrowed across await point is not allowed, as it will likely panic at runtime. - Ok(()) -} diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.expected b/ops/optimizer_tests/op_blob_revoke_object_url.expected deleted file mode 100644 index a412eceb8..000000000 --- a/ops/optimizer_tests/op_blob_revoke_object_url.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(Void) -fast_parameters: [V8Value, SeqOneByteString] -transforms: {1: Transform { kind: SeqOneByteString(Owned), index: 1 }} -is_async: false -fast_compatible: false diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.out b/ops/optimizer_tests/op_blob_revoke_object_url.out deleted file mode 100644 index 85c6460e9..000000000 --- a/ops/optimizer_tests/op_blob_revoke_object_url.out +++ /dev/null @@ -1,93 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_blob_revoke_object_url::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_blob_revoke_object_url { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_blob_revoke_object_url { - const NAME: &'static str = stringify!(op_blob_revoke_object_url); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_blob_revoke_object_url { - pub const fn name() -> &'static str { - stringify!(op_blob_revoke_object_url) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - pub fn call<'scope>(state: &mut OpState, url: String) -> Result<(), AnyError> { - let url = Url::parse(&url)?; - let blob_store = state.borrow::<Arc<BlobStore>>(); - blob_store.remove_object_url(&url); - Ok(()) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = match deno_core::v8::Local::< - deno_core::v8::String, - >::try_from(args.get(0usize as i32)) { - Ok(v8_string) => deno_core::serde_v8::to_utf8(v8_string, scope), - Err(_) => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected string at position {}", 0usize), - ); - } - }; - let result = Self::call(&mut std::cell::RefCell::borrow_mut(&ctx.state), arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => {} - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.rs b/ops/optimizer_tests/op_blob_revoke_object_url.rs deleted file mode 100644 index 9e82d7b37..000000000 --- a/ops/optimizer_tests/op_blob_revoke_object_url.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub fn op_blob_revoke_object_url( - state: &mut OpState, - url: String, -) -> Result<(), AnyError> { - // TODO(@littledivy): fast compatible https://github.com/denoland/deno/issues/17159 - let url = Url::parse(&url)?; - let blob_store = state.borrow::<Arc<BlobStore>>(); - blob_store.remove_object_url(&url); - Ok(()) -} diff --git a/ops/optimizer_tests/op_ffi_ptr_value.expected b/ops/optimizer_tests/op_ffi_ptr_value.expected deleted file mode 100644 index 00a28591c..000000000 --- a/ops/optimizer_tests/op_ffi_ptr_value.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(Void) -fast_parameters: [V8Value, Pointer, Uint32Array] -transforms: {0: Transform { kind: PtrVoid, index: 0 }, 1: Transform { kind: SliceU32(true), index: 1 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out deleted file mode 100644 index 8fcce53c6..000000000 --- a/ops/optimizer_tests/op_ffi_ptr_value.out +++ /dev/null @@ -1,152 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_ffi_ptr_value::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_ffi_ptr_value { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_ffi_ptr_value { - const NAME: &'static str = stringify!(op_ffi_ptr_value); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Pointer, TypedArray(CType::Uint32), CallbackOptions], - CType::Void, - Self::op_ffi_ptr_value_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_ffi_ptr_value { - pub const fn name() -> &'static str { - stringify!(op_ffi_ptr_value) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Pointer, TypedArray(CType::Uint32), CallbackOptions], - CType::Void, - Self::op_ffi_ptr_value_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - pub fn call<'scope>(ptr: *mut c_void, out: &mut [u32]) {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = { - let value = args.get(0usize as i32); - if value.is_null() { - std::ptr::null_mut() - } else if let Ok(b) - = deno_core::v8::Local::<deno_core::v8::External>::try_from(value) { - b.value() - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected External at position {}", 0usize), - ); - } - }; - let arg_1 = if let Ok(view) - = deno_core::v8::Local::< - deno_core::v8::Uint32Array, - >::try_from(args.get(1usize as i32)) { - let (offset, len) = (view.byte_offset(), view.byte_length()); - let buffer = match view.buffer(scope) { - Some(v) => v, - None => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected Uint32Array at position {}", 1usize), - ); - } - }; - if let Some(data) = buffer.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { - ::std::slice::from_raw_parts_mut( - store.add(offset) as *mut u32, - len / 4, - ) - } - } else { - &mut [] - } - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected Uint32Array at position {}", 1usize), - ); - }; - let result = Self::call(arg_0, arg_1); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl op_ffi_ptr_value { - #[allow(clippy::too_many_arguments)] - fn op_ffi_ptr_value_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - ptr: *mut ::std::ffi::c_void, - out: *const deno_core::v8::fast_api::FastApiTypedArray<u32>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let out = match unsafe { &*out }.get_storage_if_aligned() { - Some(v) => v, - None => { - unsafe { &mut *fast_api_callback_options }.fallback = true; - return Default::default(); - } - }; - let result = Self::call(ptr, out); - result - } -} diff --git a/ops/optimizer_tests/op_ffi_ptr_value.rs b/ops/optimizer_tests/op_ffi_ptr_value.rs deleted file mode 100644 index 4c3364507..000000000 --- a/ops/optimizer_tests/op_ffi_ptr_value.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn op_ffi_ptr_value(ptr: *mut c_void, out: &mut [u32]) { - // ... -} diff --git a/ops/optimizer_tests/op_print.expected b/ops/optimizer_tests/op_print.expected deleted file mode 100644 index 6095c138e..000000000 --- a/ops/optimizer_tests/op_print.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(Void) -fast_parameters: [V8Value, SeqOneByteString, Bool] -transforms: {1: Transform { kind: SeqOneByteString(Ref), index: 1 }} -is_async: false -fast_compatible: false diff --git a/ops/optimizer_tests/op_print.out b/ops/optimizer_tests/op_print.out deleted file mode 100644 index 5023a6b03..000000000 --- a/ops/optimizer_tests/op_print.out +++ /dev/null @@ -1,108 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_print::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_print { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_print { - const NAME: &'static str = stringify!(op_print); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_print { - pub const fn name() -> &'static str { - stringify!(op_print) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>( - state: &mut OpState, - msg: &str, - is_err: bool, - ) -> Result<(), AnyError> {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = match deno_core::v8::Local::< - deno_core::v8::String, - >::try_from(args.get(0usize as i32)) { - Ok(v8_string) => deno_core::serde_v8::to_utf8(v8_string, scope), - Err(_) => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected string at position {}", 0usize), - ); - } - }; - let arg_0 = arg_0.as_ref(); - let arg_1 = args.get(1usize as i32); - let arg_1 = match deno_core::serde_v8::from_v8(scope, arg_1) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call( - &mut std::cell::RefCell::borrow_mut(&ctx.state), - arg_0, - arg_1, - ); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => {} - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} diff --git a/ops/optimizer_tests/op_print.rs b/ops/optimizer_tests/op_print.rs deleted file mode 100644 index 776ee8418..000000000 --- a/ops/optimizer_tests/op_print.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn op_print( - state: &mut OpState, - msg: &str, - is_err: bool, -) -> Result<(), AnyError> { - // TODO(@littledivy): fast compatible https://github.com/denoland/deno/issues/17159 -} diff --git a/ops/optimizer_tests/op_state.expected b/ops/optimizer_tests/op_state.expected deleted file mode 100644 index 241ea7693..000000000 --- a/ops/optimizer_tests/op_state.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value, I32] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out deleted file mode 100644 index 1b6d86b06..000000000 --- a/ops/optimizer_tests/op_state.out +++ /dev/null @@ -1,120 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_set_exit_code::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_set_exit_code { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_set_exit_code { - const NAME: &'static str = stringify!(op_set_exit_code); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Int32, CallbackOptions], - CType::Void, - Self::op_set_exit_code_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_set_exit_code { - pub const fn name() -> &'static str { - stringify!(op_set_exit_code) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Int32, CallbackOptions], - CType::Void, - Self::op_set_exit_code_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(state: &mut OpState, code: i32) { - state.borrow_mut::<ExitCode>().set(code); - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call(&mut std::cell::RefCell::borrow_mut(&ctx.state), arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl op_set_exit_code { - #[allow(clippy::too_many_arguments)] - fn op_set_exit_code_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - code: i32, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(state, code); - result - } -} diff --git a/ops/optimizer_tests/op_state.rs b/ops/optimizer_tests/op_state.rs deleted file mode 100644 index 04e9a886d..000000000 --- a/ops/optimizer_tests/op_state.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_set_exit_code(state: &mut OpState, code: i32) { - state.borrow_mut::<ExitCode>().set(code); -} diff --git a/ops/optimizer_tests/op_state_basic1.expected b/ops/optimizer_tests/op_state_basic1.expected deleted file mode 100644 index e325dd2f7..000000000 --- a/ops/optimizer_tests/op_state_basic1.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(U32) -fast_parameters: [V8Value, U32, U32] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out deleted file mode 100644 index 284232a3a..000000000 --- a/ops/optimizer_tests/op_state_basic1.out +++ /dev/null @@ -1,148 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `foo::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct foo { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for foo { - const NAME: &'static str = stringify!(foo); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Uint32, CallbackOptions], - CType::Uint32, - Self::foo_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl foo { - pub const fn name() -> &'static str { - stringify!(foo) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Uint32, CallbackOptions], - CType::Uint32, - Self::foo_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(state: &mut OpState, a: u32, b: u32) -> u32 { - a + b - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let arg_1 = args.get(1usize as i32); - let arg_1 = match deno_core::serde_v8::from_v8(scope, arg_1) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call( - &mut std::cell::RefCell::borrow_mut(&ctx.state), - arg_0, - arg_1, - ); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } -} -impl foo { - #[allow(clippy::too_many_arguments)] - fn foo_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - a: u32, - b: u32, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> u32 { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(state, a, b); - result - } -} diff --git a/ops/optimizer_tests/op_state_basic1.rs b/ops/optimizer_tests/op_state_basic1.rs deleted file mode 100644 index 9c89b41ce..000000000 --- a/ops/optimizer_tests/op_state_basic1.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn foo(state: &mut OpState, a: u32, b: u32) -> u32 { - a + b -} diff --git a/ops/optimizer_tests/op_state_generics.expected b/ops/optimizer_tests/op_state_generics.expected deleted file mode 100644 index c29258d75..000000000 --- a/ops/optimizer_tests/op_state_generics.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out deleted file mode 100644 index a3e476d9e..000000000 --- a/ops/optimizer_tests/op_state_generics.out +++ /dev/null @@ -1,115 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_foo::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_foo<SP> { - _phantom_data: ::std::marker::PhantomData<(SP)>, -} -impl<SP> deno_core::_ops::Op for op_foo<SP> -where - SP: SomePermission + 'static, -{ - const NAME: &'static str = stringify!(op_foo); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_foo_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl<SP> op_foo<SP> -where - SP: SomePermission + 'static, -{ - pub const fn name() -> &'static str { - stringify!(op_foo) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_foo_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - pub fn call<'scope>(state: &mut OpState) {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let result = Self::call(&mut std::cell::RefCell::borrow_mut(&ctx.state)); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl<SP> op_foo<SP> -where - SP: SomePermission + 'static, -{ - #[allow(clippy::too_many_arguments)] - fn op_foo_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(state); - result - } -} diff --git a/ops/optimizer_tests/op_state_generics.rs b/ops/optimizer_tests/op_state_generics.rs deleted file mode 100644 index 7fa498981..000000000 --- a/ops/optimizer_tests/op_state_generics.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub fn op_foo<SP>(state: &mut OpState) -where - SP: SomePermission + 'static, -{ -} diff --git a/ops/optimizer_tests/op_state_result.expected b/ops/optimizer_tests/op_state_result.expected deleted file mode 100644 index 15ac033f3..000000000 --- a/ops/optimizer_tests/op_state_result.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(U32) -fast_parameters: [V8Value, U32, U32] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out deleted file mode 100644 index 67793d93a..000000000 --- a/ops/optimizer_tests/op_state_result.out +++ /dev/null @@ -1,168 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `foo::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct foo { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for foo { - const NAME: &'static str = stringify!(foo); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Uint32, CallbackOptions], - CType::Uint32, - Self::foo_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl foo { - pub const fn name() -> &'static str { - stringify!(foo) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Uint32, CallbackOptions], - CType::Uint32, - Self::foo_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(state: &mut OpState, a: u32, b: u32) -> Result<u32, AnyError> { - Ok(a + b) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - { - let op_state = &mut std::cell::RefCell::borrow_mut(&ctx.state); - if let Some(err) = op_state.last_fast_op_error.take() { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - return; - } - } - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let arg_1 = args.get(1usize as i32); - let arg_1 = match deno_core::serde_v8::from_v8(scope, arg_1) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call( - &mut std::cell::RefCell::borrow_mut(&ctx.state), - arg_0, - arg_1, - ); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => { - rv.set_uint32(result as u32); - } - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} -impl foo { - #[allow(clippy::too_many_arguments)] - fn foo_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - a: u32, - b: u32, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> u32 { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(state, a, b); - match result { - Ok(result) => result, - Err(err) => { - state.last_fast_op_error.replace(err); - __opts.fallback = true; - Default::default() - } - } - } -} diff --git a/ops/optimizer_tests/op_state_result.rs b/ops/optimizer_tests/op_state_result.rs deleted file mode 100644 index 331005c08..000000000 --- a/ops/optimizer_tests/op_state_result.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn foo(state: &mut OpState, a: u32, b: u32) -> Result<u32, AnyError> { - Ok(a + b) -} diff --git a/ops/optimizer_tests/op_state_warning.expected b/ops/optimizer_tests/op_state_warning.expected deleted file mode 100644 index 7b33ad1ef..000000000 --- a/ops/optimizer_tests/op_state_warning.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(U32) -fast_parameters: [V8Value] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out deleted file mode 100644 index 51947f90a..000000000 --- a/ops/optimizer_tests/op_state_warning.out +++ /dev/null @@ -1,157 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_listen::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_listen { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_listen { - const NAME: &'static str = stringify!(op_listen); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Uint32, - Self::op_listen_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_listen { - pub const fn name() -> &'static str { - stringify!(op_listen) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Uint32, - Self::op_listen_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(state: &mut OpState) -> Result<ResourceId, Error> { - log::debug!("listen"); - let addr = "127.0.0.1:4570".parse::<SocketAddr>().unwrap(); - let std_listener = std::net::TcpListener::bind(&addr)?; - std_listener.set_nonblocking(true)?; - let listener = TcpListener::try_from(std_listener)?; - let rid = state.resource_table.add(listener); - Ok(rid) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - { - let op_state = &mut std::cell::RefCell::borrow_mut(&ctx.state); - if let Some(err) = op_state.last_fast_op_error.take() { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - return; - } - } - let result = Self::call(&mut std::cell::RefCell::borrow_mut(&ctx.state)); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => { - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} -impl op_listen { - #[allow(clippy::too_many_arguments)] - fn op_listen_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> u32 { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(state); - match result { - Ok(result) => result, - Err(err) => { - state.last_fast_op_error.replace(err); - __opts.fallback = true; - Default::default() - } - } - } -} diff --git a/ops/optimizer_tests/op_state_warning.rs b/ops/optimizer_tests/op_state_warning.rs deleted file mode 100644 index a725e6f7e..000000000 --- a/ops/optimizer_tests/op_state_warning.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn op_listen(state: &mut OpState) -> Result<ResourceId, Error> { - log::debug!("listen"); - let addr = "127.0.0.1:4570".parse::<SocketAddr>().unwrap(); - let std_listener = std::net::TcpListener::bind(&addr)?; - std_listener.set_nonblocking(true)?; - let listener = TcpListener::try_from(std_listener)?; - let rid = state.resource_table.add(listener); - Ok(rid) -} diff --git a/ops/optimizer_tests/op_state_with_transforms.expected b/ops/optimizer_tests/op_state_with_transforms.expected deleted file mode 100644 index f5f236b7d..000000000 --- a/ops/optimizer_tests/op_state_with_transforms.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value, Uint8Array] -transforms: {1: Transform { kind: SliceU8(true), index: 1 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out deleted file mode 100644 index 09303e269..000000000 --- a/ops/optimizer_tests/op_state_with_transforms.out +++ /dev/null @@ -1,162 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_now::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_now<TP> { - _phantom_data: ::std::marker::PhantomData<(TP)>, -} -impl<TP> deno_core::_ops::Op for op_now<TP> -where - TP: TimersPermission + 'static, -{ - const NAME: &'static str = stringify!(op_now); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, TypedArray(CType::Uint8), CallbackOptions], - CType::Void, - Self::op_now_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl<TP> op_now<TP> -where - TP: TimersPermission + 'static, -{ - pub const fn name() -> &'static str { - stringify!(op_now) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, TypedArray(CType::Uint8), CallbackOptions], - CType::Void, - Self::op_now_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - pub fn call<'scope>(state: &mut OpState, buf: &mut [u8]) {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = { - let value = args.get(0usize as i32); - match deno_core::v8::Local::<deno_core::v8::ArrayBuffer>::try_from(value) { - Ok(b) => { - let byte_length = b.byte_length(); - if let Some(data) = b.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { ::std::slice::from_raw_parts_mut(store, byte_length) } - } else { - &mut [] - } - } - Err(_) => { - if let Ok(view) - = deno_core::v8::Local::< - deno_core::v8::ArrayBufferView, - >::try_from(value) { - let len = view.byte_length(); - let offset = view.byte_offset(); - let buffer = match view.buffer(scope) { - Some(v) => v, - None => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 0usize), - ); - } - }; - if let Some(data) = buffer.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { - ::std::slice::from_raw_parts_mut(store.add(offset), len) - } - } else { - &mut [] - } - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 0usize), - ); - } - } - } - }; - let result = Self::call(&mut std::cell::RefCell::borrow_mut(&ctx.state), arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl<TP> op_now<TP> -where - TP: TimersPermission + 'static, -{ - #[allow(clippy::too_many_arguments)] - fn op_now_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - buf: *const deno_core::v8::fast_api::FastApiTypedArray<u8>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let buf = unsafe { (&*buf).get_storage_if_aligned().unwrap_unchecked() }; - let result = Self::call(state, buf); - result - } -} diff --git a/ops/optimizer_tests/op_state_with_transforms.rs b/ops/optimizer_tests/op_state_with_transforms.rs deleted file mode 100644 index 4e7e616f3..000000000 --- a/ops/optimizer_tests/op_state_with_transforms.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub fn op_now<TP>(state: &mut OpState, buf: &mut [u8]) -where - TP: TimersPermission + 'static, -{ -} diff --git a/ops/optimizer_tests/opstate_with_arity.expected b/ops/optimizer_tests/opstate_with_arity.expected deleted file mode 100644 index b38455d0d..000000000 --- a/ops/optimizer_tests/opstate_with_arity.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(U32) -fast_parameters: [V8Value, U32, U32, U32, U32] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out deleted file mode 100644 index d7e85328a..000000000 --- a/ops/optimizer_tests/opstate_with_arity.out +++ /dev/null @@ -1,188 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_add_4::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_add_4 { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_add_4 { - const NAME: &'static str = stringify!(op_add_4); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Uint32, Uint32, Uint32, CallbackOptions], - CType::Uint32, - Self::op_add_4_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_add_4 { - pub const fn name() -> &'static str { - stringify!(op_add_4) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Uint32, Uint32, Uint32, CallbackOptions], - CType::Uint32, - Self::op_add_4_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 4usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(x1: u32, x2: u32, x3: u32, x4: u32) -> Result<u32, anyhow::Error> { - Ok(x1 + x2 + x3 + x4) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - { - let op_state = &mut std::cell::RefCell::borrow_mut(&ctx.state); - if let Some(err) = op_state.last_fast_op_error.take() { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - return; - } - } - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let arg_1 = args.get(1usize as i32); - let arg_1 = match deno_core::serde_v8::from_v8(scope, arg_1) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let arg_2 = args.get(2usize as i32); - let arg_2 = match deno_core::serde_v8::from_v8(scope, arg_2) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 2usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let arg_3 = args.get(3usize as i32); - let arg_3 = match deno_core::serde_v8::from_v8(scope, arg_3) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 3usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call(arg_0, arg_1, arg_2, arg_3); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => { - rv.set_uint32(result as u32); - } - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} -impl op_add_4 { - #[allow(clippy::too_many_arguments)] - fn op_add_4_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - x1: u32, - x2: u32, - x3: u32, - x4: u32, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> u32 { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let op_state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(x1, x2, x3, x4); - match result { - Ok(result) => result, - Err(err) => { - op_state.last_fast_op_error.replace(err); - __opts.fallback = true; - Default::default() - } - } - } -} diff --git a/ops/optimizer_tests/opstate_with_arity.rs b/ops/optimizer_tests/opstate_with_arity.rs deleted file mode 100644 index 7212ca975..000000000 --- a/ops/optimizer_tests/opstate_with_arity.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_add_4(x1: u32, x2: u32, x3: u32, x4: u32) -> Result<u32, anyhow::Error> { - Ok(x1 + x2 + x3 + x4) -} diff --git a/ops/optimizer_tests/option_arg.expected b/ops/optimizer_tests/option_arg.expected deleted file mode 100644 index 250ff1022..000000000 --- a/ops/optimizer_tests/option_arg.expected +++ /dev/null @@ -1 +0,0 @@ -FastUnsupportedParamType
\ No newline at end of file diff --git a/ops/optimizer_tests/option_arg.out b/ops/optimizer_tests/option_arg.out deleted file mode 100644 index 5880ec88e..000000000 --- a/ops/optimizer_tests/option_arg.out +++ /dev/null @@ -1,91 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_try_close::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_try_close { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_try_close { - const NAME: &'static str = stringify!(op_try_close); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_try_close { - pub const fn name() -> &'static str { - stringify!(op_try_close) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - pub fn call<'scope>( - state: &mut OpState, - rid: Option<ResourceId>, - ) -> Result<(), Error> {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call(&mut std::cell::RefCell::borrow_mut(&ctx.state), arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => {} - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} diff --git a/ops/optimizer_tests/option_arg.rs b/ops/optimizer_tests/option_arg.rs deleted file mode 100644 index 47a02974d..000000000 --- a/ops/optimizer_tests/option_arg.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub fn op_try_close( - state: &mut OpState, - rid: Option<ResourceId>, -) -> Result<(), Error> { - // ... -} diff --git a/ops/optimizer_tests/owned_string.expected b/ops/optimizer_tests/owned_string.expected deleted file mode 100644 index 4c47a0525..000000000 --- a/ops/optimizer_tests/owned_string.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(U32) -fast_parameters: [V8Value, SeqOneByteString] -transforms: {0: Transform { kind: SeqOneByteString(Owned), index: 0 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out deleted file mode 100644 index 58c7f72ae..000000000 --- a/ops/optimizer_tests/owned_string.out +++ /dev/null @@ -1,131 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_string_length::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_string_length { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_string_length { - const NAME: &'static str = stringify!(op_string_length); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, SeqOneByteString, CallbackOptions], - CType::Uint32, - Self::op_string_length_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_string_length { - pub const fn name() -> &'static str { - stringify!(op_string_length) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, SeqOneByteString, CallbackOptions], - CType::Uint32, - Self::op_string_length_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(string: String) -> u32 { - string.len() as u32 - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = match deno_core::v8::Local::< - deno_core::v8::String, - >::try_from(args.get(0usize as i32)) { - Ok(v8_string) => deno_core::serde_v8::to_utf8(v8_string, scope), - Err(_) => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected string at position {}", 0usize), - ); - } - }; - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } -} -impl op_string_length { - #[allow(clippy::too_many_arguments)] - fn op_string_length_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - string: *const deno_core::v8::fast_api::FastApiOneByteString, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> u32 { - use deno_core::v8; - use deno_core::_ops; - let string = match ::std::str::from_utf8(unsafe { &*string }.as_bytes()) { - Ok(v) => v.to_owned(), - Err(_) => { - unsafe { &mut *fast_api_callback_options }.fallback = true; - return Default::default(); - } - }; - let result = Self::call(string); - result - } -} diff --git a/ops/optimizer_tests/owned_string.rs b/ops/optimizer_tests/owned_string.rs deleted file mode 100644 index 102cf00fb..000000000 --- a/ops/optimizer_tests/owned_string.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_string_length(string: String) -> u32 { - string.len() as u32 -} diff --git a/ops/optimizer_tests/param_mut_binding_warning.expected b/ops/optimizer_tests/param_mut_binding_warning.expected deleted file mode 100644 index 250ff1022..000000000 --- a/ops/optimizer_tests/param_mut_binding_warning.expected +++ /dev/null @@ -1 +0,0 @@ -FastUnsupportedParamType
\ No newline at end of file diff --git a/ops/optimizer_tests/param_mut_binding_warning.out b/ops/optimizer_tests/param_mut_binding_warning.out deleted file mode 100644 index 43a33d6e3..000000000 --- a/ops/optimizer_tests/param_mut_binding_warning.out +++ /dev/null @@ -1,111 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_read_sync::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_read_sync { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_read_sync { - const NAME: &'static str = stringify!(op_read_sync); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_read_sync { - pub const fn name() -> &'static str { - stringify!(op_read_sync) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>( - state: &mut OpState, - rid: ResourceId, - mut buf: ZeroCopyBuf, - ) -> Result<u32, AnyError> { - Ok(23) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let arg_1 = args.get(1usize as i32); - let arg_1 = match deno_core::serde_v8::from_v8(scope, arg_1) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call( - &mut std::cell::RefCell::borrow_mut(&ctx.state), - arg_0, - arg_1, - ); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => { - rv.set_uint32(result as u32); - } - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} diff --git a/ops/optimizer_tests/param_mut_binding_warning.rs b/ops/optimizer_tests/param_mut_binding_warning.rs deleted file mode 100644 index c47122728..000000000 --- a/ops/optimizer_tests/param_mut_binding_warning.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn op_read_sync( - state: &mut OpState, - rid: ResourceId, - mut buf: ZeroCopyBuf, -) -> Result<u32, AnyError> { - // Should not warn about unused `mut buf` binding. - // - // This was caused due to incorrect codegen by fast_call.rs - // on an incompatible op function. - Ok(23) -} diff --git a/ops/optimizer_tests/raw_ptr.expected b/ops/optimizer_tests/raw_ptr.expected deleted file mode 100644 index badd6e3f4..000000000 --- a/ops/optimizer_tests/raw_ptr.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(Void) -fast_parameters: [V8Value, Uint8Array, Uint32Array] -transforms: {1: Transform { kind: PtrU8, index: 1 }, 2: Transform { kind: SliceU32(true), index: 2 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out deleted file mode 100644 index 18d2aaa4a..000000000 --- a/ops/optimizer_tests/raw_ptr.out +++ /dev/null @@ -1,211 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_ffi_ptr_of::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_ffi_ptr_of<FP> { - _phantom_data: ::std::marker::PhantomData<(FP)>, -} -impl<FP> deno_core::_ops::Op for op_ffi_ptr_of<FP> -where - FP: FfiPermissions + 'static, -{ - const NAME: &'static str = stringify!(op_ffi_ptr_of); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[ - V8Value, - TypedArray(CType::Uint8), - TypedArray(CType::Uint32), - CallbackOptions, - ], - CType::Void, - Self::op_ffi_ptr_of_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl<FP> op_ffi_ptr_of<FP> -where - FP: FfiPermissions + 'static, -{ - pub const fn name() -> &'static str { - stringify!(op_ffi_ptr_of) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[ - V8Value, - TypedArray(CType::Uint8), - TypedArray(CType::Uint32), - CallbackOptions, - ], - CType::Void, - Self::op_ffi_ptr_of_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(state: &mut OpState, buf: *const u8, out: &mut [u32]) {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = { - let value = args.get(0usize as i32); - match deno_core::v8::Local::<deno_core::v8::ArrayBuffer>::try_from(value) { - Ok(b) => { - if let Some(data) = b.data() { - data.cast::<u8>().as_ptr() - } else { - std::ptr::null::<u8>() - } - } - Err(_) => { - if let Ok(view) - = deno_core::v8::Local::< - deno_core::v8::ArrayBufferView, - >::try_from(value) { - let offset = view.byte_offset(); - let buffer = match view.buffer(scope) { - Some(v) => v, - None => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 0usize), - ); - } - }; - let store = if let Some(data) = buffer.data() { - data.cast::<u8>().as_ptr() - } else { - std::ptr::null_mut::<u8>() - }; - unsafe { store.add(offset) } - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 0usize), - ); - } - } - } - }; - let arg_1 = if let Ok(view) - = deno_core::v8::Local::< - deno_core::v8::Uint32Array, - >::try_from(args.get(1usize as i32)) { - let (offset, len) = (view.byte_offset(), view.byte_length()); - let buffer = match view.buffer(scope) { - Some(v) => v, - None => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected Uint32Array at position {}", 1usize), - ); - } - }; - if let Some(data) = buffer.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { - ::std::slice::from_raw_parts_mut( - store.add(offset) as *mut u32, - len / 4, - ) - } - } else { - &mut [] - } - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected Uint32Array at position {}", 1usize), - ); - }; - let result = Self::call( - &mut std::cell::RefCell::borrow_mut(&ctx.state), - arg_0, - arg_1, - ); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl<FP> op_ffi_ptr_of<FP> -where - FP: FfiPermissions + 'static, -{ - #[allow(clippy::too_many_arguments)] - fn op_ffi_ptr_of_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - buf: *const deno_core::v8::fast_api::FastApiTypedArray<u8>, - out: *const deno_core::v8::fast_api::FastApiTypedArray<u32>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let buf = unsafe { (&*buf).get_storage_if_aligned().unwrap_unchecked() } - .as_ptr(); - let out = match unsafe { &*out }.get_storage_if_aligned() { - Some(v) => v, - None => { - unsafe { &mut *fast_api_callback_options }.fallback = true; - return Default::default(); - } - }; - let result = Self::call(state, buf, out); - result - } -} diff --git a/ops/optimizer_tests/raw_ptr.rs b/ops/optimizer_tests/raw_ptr.rs deleted file mode 100644 index 249b3b35b..000000000 --- a/ops/optimizer_tests/raw_ptr.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn op_ffi_ptr_of<FP>(state: &mut OpState, buf: *const u8, out: &mut [u32]) -where - FP: FfiPermissions + 'static, -{ - // .. -} diff --git a/ops/optimizer_tests/serde_v8_value.expected b/ops/optimizer_tests/serde_v8_value.expected deleted file mode 100644 index 411fbec0b..000000000 --- a/ops/optimizer_tests/serde_v8_value.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Bool) -fast_parameters: [V8Value, V8Value] -transforms: {0: Transform { kind: V8Value, index: 0 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out deleted file mode 100644 index 20cc97584..000000000 --- a/ops/optimizer_tests/serde_v8_value.out +++ /dev/null @@ -1,124 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_is_proxy::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_is_proxy { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_is_proxy { - const NAME: &'static str = stringify!(op_is_proxy); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, V8Value], - CType::Bool, - Self::op_is_proxy_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_is_proxy { - pub const fn name() -> &'static str { - stringify!(op_is_proxy) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, V8Value], - CType::Bool, - Self::op_is_proxy_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(value: serde_v8::Value) -> bool { - value.v8_value.is_proxy() - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } -} -impl op_is_proxy { - #[allow(clippy::too_many_arguments)] - fn op_is_proxy_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - value: deno_core::v8::Local<deno_core::v8::Value>, - ) -> bool { - use deno_core::v8; - use deno_core::_ops; - let value = serde_v8::Value { v8_value: value }; - let result = Self::call(value); - result - } -} diff --git a/ops/optimizer_tests/serde_v8_value.rs b/ops/optimizer_tests/serde_v8_value.rs deleted file mode 100644 index c986930d9..000000000 --- a/ops/optimizer_tests/serde_v8_value.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_is_proxy(value: serde_v8::Value) -> bool { - value.v8_value.is_proxy() -} diff --git a/ops/optimizer_tests/strings.expected b/ops/optimizer_tests/strings.expected deleted file mode 100644 index 4a6bb1556..000000000 --- a/ops/optimizer_tests/strings.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(U32) -fast_parameters: [V8Value, SeqOneByteString] -transforms: {0: Transform { kind: SeqOneByteString(Ref), index: 0 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out deleted file mode 100644 index c59214f6a..000000000 --- a/ops/optimizer_tests/strings.out +++ /dev/null @@ -1,132 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_string_length::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_string_length { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_string_length { - const NAME: &'static str = stringify!(op_string_length); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, SeqOneByteString, CallbackOptions], - CType::Uint32, - Self::op_string_length_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_string_length { - pub const fn name() -> &'static str { - stringify!(op_string_length) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, SeqOneByteString, CallbackOptions], - CType::Uint32, - Self::op_string_length_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(string: &str) -> u32 { - string.len() as u32 - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = match deno_core::v8::Local::< - deno_core::v8::String, - >::try_from(args.get(0usize as i32)) { - Ok(v8_string) => deno_core::serde_v8::to_utf8(v8_string, scope), - Err(_) => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected string at position {}", 0usize), - ); - } - }; - let arg_0 = arg_0.as_ref(); - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } -} -impl op_string_length { - #[allow(clippy::too_many_arguments)] - fn op_string_length_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - string: *const deno_core::v8::fast_api::FastApiOneByteString, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> u32 { - use deno_core::v8; - use deno_core::_ops; - let string = match ::std::str::from_utf8(unsafe { &*string }.as_bytes()) { - Ok(v) => v, - Err(_) => { - unsafe { &mut *fast_api_callback_options }.fallback = true; - return Default::default(); - } - }; - let result = Self::call(string); - result - } -} diff --git a/ops/optimizer_tests/strings.rs b/ops/optimizer_tests/strings.rs deleted file mode 100644 index 860f1e8ec..000000000 --- a/ops/optimizer_tests/strings.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_string_length(string: &str) -> u32 { - string.len() as u32 -} diff --git a/ops/optimizer_tests/strings_result.expected b/ops/optimizer_tests/strings_result.expected deleted file mode 100644 index 3866751fd..000000000 --- a/ops/optimizer_tests/strings_result.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: true -fast_result: Some(U32) -fast_parameters: [V8Value, SeqOneByteString] -transforms: {0: Transform { kind: SeqOneByteString(Ref), index: 0 }} -is_async: false -fast_compatible: false diff --git a/ops/optimizer_tests/strings_result.out b/ops/optimizer_tests/strings_result.out deleted file mode 100644 index 45ca1fac7..000000000 --- a/ops/optimizer_tests/strings_result.out +++ /dev/null @@ -1,93 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_string_length::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_string_length { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_string_length { - const NAME: &'static str = stringify!(op_string_length); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_string_length { - pub const fn name() -> &'static str { - stringify!(op_string_length) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(string: &str) -> Result<u32, AnyError> { - Ok(string.len() as u32) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = match deno_core::v8::Local::< - deno_core::v8::String, - >::try_from(args.get(0usize as i32)) { - Ok(v8_string) => deno_core::serde_v8::to_utf8(v8_string, scope), - Err(_) => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected string at position {}", 0usize), - ); - } - }; - let arg_0 = arg_0.as_ref(); - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => { - rv.set_uint32(result as u32); - } - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} diff --git a/ops/optimizer_tests/strings_result.rs b/ops/optimizer_tests/strings_result.rs deleted file mode 100644 index f89efaab1..000000000 --- a/ops/optimizer_tests/strings_result.rs +++ /dev/null @@ -1,4 +0,0 @@ -// https://github.com/denoland/deno/issues/16979 -fn op_string_length(string: &str) -> Result<u32, AnyError> { - Ok(string.len() as u32) -} diff --git a/ops/optimizer_tests/u64_result.expected b/ops/optimizer_tests/u64_result.expected deleted file mode 100644 index 250ff1022..000000000 --- a/ops/optimizer_tests/u64_result.expected +++ /dev/null @@ -1 +0,0 @@ -FastUnsupportedParamType
\ No newline at end of file diff --git a/ops/optimizer_tests/u64_result.out b/ops/optimizer_tests/u64_result.out deleted file mode 100644 index 5a4df68b1..000000000 --- a/ops/optimizer_tests/u64_result.out +++ /dev/null @@ -1,94 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_bench_now::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_bench_now { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_bench_now { - const NAME: &'static str = stringify!(op_bench_now); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_bench_now { - pub const fn name() -> &'static str { - stringify!(op_bench_now) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: None, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(state: &mut OpState) -> Result<u64, AnyError> { - let ns = state.borrow::<time::Instant>().elapsed().as_nanos(); - let ns_u64 = u64::try_from(ns)?; - Ok(ns_u64) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let result = Self::call(&mut std::cell::RefCell::borrow_mut(&ctx.state)); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => { - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} diff --git a/ops/optimizer_tests/u64_result.rs b/ops/optimizer_tests/u64_result.rs deleted file mode 100644 index 1cc783db8..000000000 --- a/ops/optimizer_tests/u64_result.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn op_bench_now(state: &mut OpState) -> Result<u64, AnyError> { - let ns = state.borrow::<time::Instant>().elapsed().as_nanos(); - let ns_u64 = u64::try_from(ns)?; - Ok(ns_u64) -} diff --git a/ops/optimizer_tests/uint8array.expected b/ops/optimizer_tests/uint8array.expected deleted file mode 100644 index 49554a2e8..000000000 --- a/ops/optimizer_tests/uint8array.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Bool) -fast_parameters: [V8Value, Uint8Array, Uint8Array] -transforms: {0: Transform { kind: SliceU8(false), index: 0 }, 1: Transform { kind: SliceU8(true), index: 1 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out deleted file mode 100644 index 335bf42f6..000000000 --- a/ops/optimizer_tests/uint8array.out +++ /dev/null @@ -1,205 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_import_spki_x25519::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_import_spki_x25519 { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_import_spki_x25519 { - const NAME: &'static str = stringify!(op_import_spki_x25519); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint8)], - CType::Bool, - Self::op_import_spki_x25519_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_import_spki_x25519 { - pub const fn name() -> &'static str { - stringify!(op_import_spki_x25519) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint8)], - CType::Bool, - Self::op_import_spki_x25519_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - pub fn call<'scope>(key_data: &[u8], out: &mut [u8]) -> bool {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = { - let value = args.get(0usize as i32); - match deno_core::v8::Local::<deno_core::v8::ArrayBuffer>::try_from(value) { - Ok(b) => { - let byte_length = b.byte_length(); - if let Some(data) = b.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { ::std::slice::from_raw_parts_mut(store, byte_length) } - } else { - &mut [] - } - } - Err(_) => { - if let Ok(view) - = deno_core::v8::Local::< - deno_core::v8::ArrayBufferView, - >::try_from(value) { - let len = view.byte_length(); - let offset = view.byte_offset(); - let buffer = match view.buffer(scope) { - Some(v) => v, - None => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 0usize), - ); - } - }; - if let Some(data) = buffer.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { - ::std::slice::from_raw_parts_mut(store.add(offset), len) - } - } else { - &mut [] - } - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 0usize), - ); - } - } - } - }; - let arg_1 = { - let value = args.get(1usize as i32); - match deno_core::v8::Local::<deno_core::v8::ArrayBuffer>::try_from(value) { - Ok(b) => { - let byte_length = b.byte_length(); - if let Some(data) = b.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { ::std::slice::from_raw_parts_mut(store, byte_length) } - } else { - &mut [] - } - } - Err(_) => { - if let Ok(view) - = deno_core::v8::Local::< - deno_core::v8::ArrayBufferView, - >::try_from(value) { - let len = view.byte_length(); - let offset = view.byte_offset(); - let buffer = match view.buffer(scope) { - Some(v) => v, - None => { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 1usize), - ); - } - }; - if let Some(data) = buffer.data() { - let store = data.cast::<u8>().as_ptr(); - unsafe { - ::std::slice::from_raw_parts_mut(store.add(offset), len) - } - } else { - &mut [] - } - } else { - return deno_core::_ops::throw_type_error( - scope, - format!("Expected ArrayBufferView at position {}", 1usize), - ); - } - } - } - }; - let result = Self::call(arg_0, arg_1); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } -} -impl op_import_spki_x25519 { - #[allow(clippy::too_many_arguments)] - fn op_import_spki_x25519_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - key_data: *const deno_core::v8::fast_api::FastApiTypedArray<u8>, - out: *const deno_core::v8::fast_api::FastApiTypedArray<u8>, - ) -> bool { - use deno_core::v8; - use deno_core::_ops; - let key_data = unsafe { - (&*key_data).get_storage_if_aligned().unwrap_unchecked() - }; - let out = unsafe { (&*out).get_storage_if_aligned().unwrap_unchecked() }; - let result = Self::call(key_data, out); - result - } -} diff --git a/ops/optimizer_tests/uint8array.rs b/ops/optimizer_tests/uint8array.rs deleted file mode 100644 index f4507b21f..000000000 --- a/ops/optimizer_tests/uint8array.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn op_import_spki_x25519(key_data: &[u8], out: &mut [u8]) -> bool { - // ... -} diff --git a/ops/optimizer_tests/unit_result.expected b/ops/optimizer_tests/unit_result.expected deleted file mode 100644 index 693a771e9..000000000 --- a/ops/optimizer_tests/unit_result.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out deleted file mode 100644 index 894297255..000000000 --- a/ops/optimizer_tests/unit_result.out +++ /dev/null @@ -1,137 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_unit_result::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_unit_result { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_unit_result { - const NAME: &'static str = stringify!(op_unit_result); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_unit_result_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_unit_result { - pub const fn name() -> &'static str { - stringify!(op_unit_result) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_unit_result_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>() -> Result<(), AnyError> { - Ok(()) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - { - let op_state = &mut std::cell::RefCell::borrow_mut(&ctx.state); - if let Some(err) = op_state.last_fast_op_error.take() { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - return; - } - } - let result = Self::call(); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => {} - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} -impl op_unit_result { - #[allow(clippy::too_many_arguments)] - fn op_unit_result_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let op_state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(); - match result { - Ok(result) => result, - Err(err) => { - op_state.last_fast_op_error.replace(err); - __opts.fallback = true; - } - } - } -} diff --git a/ops/optimizer_tests/unit_result.rs b/ops/optimizer_tests/unit_result.rs deleted file mode 100644 index 207896929..000000000 --- a/ops/optimizer_tests/unit_result.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_unit_result() -> Result<(), AnyError> { - Ok(()) -} diff --git a/ops/optimizer_tests/unit_result2.expected b/ops/optimizer_tests/unit_result2.expected deleted file mode 100644 index d799a77b2..000000000 --- a/ops/optimizer_tests/unit_result2.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: true -has_ref_opstate: true -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value, U32, Bool] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out deleted file mode 100644 index d091b91cd..000000000 --- a/ops/optimizer_tests/unit_result2.out +++ /dev/null @@ -1,172 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_set_nodelay::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_set_nodelay { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_set_nodelay { - const NAME: &'static str = stringify!(op_set_nodelay); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Bool, CallbackOptions], - CType::Void, - Self::op_set_nodelay_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_set_nodelay { - pub const fn name() -> &'static str { - stringify!(op_set_nodelay) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, Uint32, Bool, CallbackOptions], - CType::Void, - Self::op_set_nodelay_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 2usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - pub fn call<'scope>( - state: &mut OpState, - rid: ResourceId, - nodelay: bool, - ) -> Result<(), AnyError> { - let resource: Rc<TcpStreamResource> = state - .resource_table - .get::<TcpStreamResource>(rid)?; - resource.set_nodelay(nodelay) - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - { - let op_state = &mut std::cell::RefCell::borrow_mut(&ctx.state); - if let Some(err) = op_state.last_fast_op_error.take() { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - return; - } - } - let arg_0 = args.get(0usize as i32); - let arg_0 = match deno_core::serde_v8::from_v8(scope, arg_0) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 0usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let arg_1 = args.get(1usize as i32); - let arg_1 = match deno_core::serde_v8::from_v8(scope, arg_1) { - Ok(v) => v, - Err(err) => { - let msg = format!( - "Error parsing args at position {}: {}", 1usize, - deno_core::anyhow::Error::from(err) - ); - return deno_core::_ops::throw_type_error(scope, msg); - } - }; - let result = Self::call( - &mut std::cell::RefCell::borrow_mut(&ctx.state), - arg_0, - arg_1, - ); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match result { - Ok(result) => {} - Err(err) => { - let exception = deno_core::error::to_v8_error( - scope, - op_state.get_error_class_fn, - &err, - ); - scope.throw_exception(exception); - } - }; - } -} -impl op_set_nodelay { - #[allow(clippy::too_many_arguments)] - fn op_set_nodelay_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - rid: ResourceId, - nodelay: bool, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let __ctx = unsafe { - &*(v8::Local::<v8::External>::cast(unsafe { __opts.data.data }).value() - as *const _ops::OpCtx) - }; - let state = &mut ::std::cell::RefCell::borrow_mut(&__ctx.state); - let result = Self::call(state, rid, nodelay); - match result { - Ok(result) => result, - Err(err) => { - state.last_fast_op_error.replace(err); - __opts.fallback = true; - } - } - } -} diff --git a/ops/optimizer_tests/unit_result2.rs b/ops/optimizer_tests/unit_result2.rs deleted file mode 100644 index 83b73e194..000000000 --- a/ops/optimizer_tests/unit_result2.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub fn op_set_nodelay( - state: &mut OpState, - rid: ResourceId, - nodelay: bool, -) -> Result<(), AnyError> { - let resource: Rc<TcpStreamResource> = - state.resource_table.get::<TcpStreamResource>(rid)?; - resource.set_nodelay(nodelay) -} diff --git a/ops/optimizer_tests/unit_ret.expected b/ops/optimizer_tests/unit_ret.expected deleted file mode 100644 index 5d414e1e3..000000000 --- a/ops/optimizer_tests/unit_ret.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value] -transforms: {} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out deleted file mode 100644 index 1a721c407..000000000 --- a/ops/optimizer_tests/unit_ret.out +++ /dev/null @@ -1,109 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_unit::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_unit { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_unit { - const NAME: &'static str = stringify!(op_unit); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value], - CType::Void, - Self::op_unit_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_unit { - pub const fn name() -> &'static str { - stringify!(op_unit) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value], - CType::Void, - Self::op_unit_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>() -> () { - () - } - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let result = Self::call(); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - match deno_core::serde_v8::to_v8(scope, result) { - Ok(ret) => rv.set(ret), - Err(err) => { - deno_core::_ops::throw_type_error( - scope, - format!( - "Error serializing return: {}", - deno_core::anyhow::Error::from(err) - ), - ) - } - }; - } -} -impl op_unit { - #[allow(clippy::too_many_arguments)] - fn op_unit_fast_fn(_: deno_core::v8::Local<deno_core::v8::Object>) -> () { - use deno_core::v8; - use deno_core::_ops; - let result = Self::call(); - result - } -} diff --git a/ops/optimizer_tests/unit_ret.rs b/ops/optimizer_tests/unit_ret.rs deleted file mode 100644 index 4cf3651db..000000000 --- a/ops/optimizer_tests/unit_ret.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_unit() -> () { - () -} diff --git a/ops/optimizer_tests/wasm_op.expected b/ops/optimizer_tests/wasm_op.expected deleted file mode 100644 index 8d3719cf7..000000000 --- a/ops/optimizer_tests/wasm_op.expected +++ /dev/null @@ -1,11 +0,0 @@ -=== Optimizer Dump === -returns_result: false -has_ref_opstate: false -has_rc_opstate: false -has_fast_callback_option: false -needs_fast_callback_option: false -fast_result: Some(Void) -fast_parameters: [V8Value] -transforms: {0: Transform { kind: WasmMemory, index: 0 }} -is_async: false -fast_compatible: true diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out deleted file mode 100644 index 023506fc2..000000000 --- a/ops/optimizer_tests/wasm_op.out +++ /dev/null @@ -1,107 +0,0 @@ -#[allow(non_camel_case_types)] -///Auto-generated by `deno_ops`, i.e: `#[op]` -/// -///Use `op_wasm::decl()` to get an op-declaration -///you can include in a `deno_core::Extension`. -pub struct op_wasm { - _phantom_data: ::std::marker::PhantomData<()>, -} -impl deno_core::_ops::Op for op_wasm { - const NAME: &'static str = stringify!(op_wasm); - const DECL: deno_core::OpDecl = deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_wasm_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 0, - }; -} -#[doc(hidden)] -impl op_wasm { - pub const fn name() -> &'static str { - stringify!(op_wasm) - } - #[allow(clippy::not_unsafe_ptr_arg_deref)] - pub extern "C" fn v8_fn_ptr(info: *const deno_core::v8::FunctionCallbackInfo) { - let info = unsafe { &*info }; - let scope = &mut unsafe { deno_core::v8::CallbackScope::new(info) }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - Self::v8_func(scope, args, rv); - } - pub const fn decl() -> deno_core::OpDecl { - deno_core::OpDecl { - name: Self::name(), - v8_fn_ptr: Self::v8_fn_ptr as _, - enabled: true, - fast_fn: { - use deno_core::v8::fast_api::CType; - use deno_core::v8::fast_api::Type::*; - Some( - deno_core::v8::fast_api::FastFunction::new( - &[V8Value, CallbackOptions], - CType::Void, - Self::op_wasm_fast_fn as *const ::std::ffi::c_void, - ), - ) - }, - is_async: false, - is_unstable: false, - is_v8: false, - arg_count: 1usize as u8, - } - } - #[inline] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::extra_unused_lifetimes)] - fn call<'scope>(memory: Option<&mut [u8]>) {} - pub fn v8_func<'scope>( - scope: &mut deno_core::v8::HandleScope<'scope>, - args: deno_core::v8::FunctionCallbackArguments, - mut rv: deno_core::v8::ReturnValue, - ) { - let ctx = unsafe { - &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()).value() - as *const deno_core::_ops::OpCtx) - }; - let arg_0 = None; - let result = Self::call(arg_0); - let op_state = ::std::cell::RefCell::borrow(&*ctx.state); - op_state.tracker.track_sync(ctx.id); - } -} -impl op_wasm { - #[allow(clippy::too_many_arguments)] - fn op_wasm_fast_fn( - _: deno_core::v8::Local<deno_core::v8::Object>, - fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions, - ) -> () { - use deno_core::v8; - use deno_core::_ops; - let __opts: &mut v8::fast_api::FastApiCallbackOptions = unsafe { - &mut *fast_api_callback_options - }; - let memory = unsafe { - &*(__opts.wasm_memory - as *const deno_core::v8::fast_api::FastApiTypedArray<u8>) - } - .get_storage_if_aligned(); - let result = Self::call(memory); - result - } -} diff --git a/ops/optimizer_tests/wasm_op.rs b/ops/optimizer_tests/wasm_op.rs deleted file mode 100644 index b18f32fd1..000000000 --- a/ops/optimizer_tests/wasm_op.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn op_wasm(memory: Option<&mut [u8]>) { - // @test-attr:wasm -} |