diff --git a/core/benches/ops/sync.rs b/core/benches/ops/sync.rs index c465b79be..1d2c3fe19 100644 --- a/core/benches/ops/sync.rs +++ b/core/benches/ops/sync.rs @@ -37,7 +37,6 @@ deno_core::extension!( op_buffer, op_buffer_jsbuffer, op_buffer_nofast, - op_arraybuffer, ], state = |state| { state.put(1234u32); @@ -156,9 +155,6 @@ pub fn op_buffer_jsbuffer(#[buffer] _buffer: JsBuffer) {} #[op2(nofast)] pub fn op_buffer_nofast(#[buffer] _buffer: &[u8]) {} -#[op2(fast)] -pub fn op_arraybuffer(#[arraybuffer] _buffer: &[u8]) {} - fn bench_op( b: &mut Bencher, count: usize, @@ -545,16 +541,6 @@ fn bench_op_buffer_nofast(b: &mut Bencher) { ); } -fn bench_op_arraybuffer(b: &mut Bencher) { - bench_op( - b, - BENCH_COUNT, - "op_arraybuffer", - 1, - "op_arraybuffer(ARRAYBUFFER)", - ); -} - benchmark_group!( benches, baseline, @@ -592,7 +578,6 @@ benchmark_group!( bench_op_buffer, bench_op_buffer_jsbuffer, bench_op_buffer_nofast, - bench_op_arraybuffer, ); benchmark_main!(benches); diff --git a/core/runtime/ops.rs b/core/runtime/ops.rs index fdad70905..e8b807cdc 100644 --- a/core/runtime/ops.rs +++ b/core/runtime/ops.rs @@ -619,7 +619,6 @@ mod tests { op_buffer_bytesmut, op_buffer_any, op_buffer_any_length, - op_arraybuffer_slice, op_test_get_cppgc_resource, op_test_get_cppgc_resource_option, op_test_make_cppgc_resource, @@ -1779,41 +1778,6 @@ mod tests { Ok(()) } - #[op2(fast)] - pub fn op_arraybuffer_slice( - #[arraybuffer] input: &[u8], - #[number] inlen: usize, - #[arraybuffer] output: &mut [u8], - #[number] outlen: usize, - ) { - assert_eq!(inlen, input.len()); - assert_eq!(outlen, output.len()); - if inlen > 0 && outlen > 0 { - output[0] = input[0]; - } - } - - #[tokio::test] - pub async fn test_op_arraybuffer_slice() - -> Result<(), Box> { - // Zero-length buffers - run_test2( - JIT_ITERATIONS, - "op_arraybuffer_slice", - "op_arraybuffer_slice(new ArrayBuffer(0), 0, new ArrayBuffer(0), 0);", - )?; - run_test2( - JIT_ITERATIONS, - "op_arraybuffer_slice", - r"let inbuf = new ArrayBuffer(10); - (new Uint8Array(inbuf))[0] = 1; - let outbuf = new ArrayBuffer(10); - op_arraybuffer_slice(inbuf, 10, outbuf, 10); - assert((new Uint8Array(outbuf))[0] == 1);", - )?; - Ok(()) - } - // TODO(mmastrac): This is a dangerous op that we'll use to test resizable buffers in a later pass. #[op2(fast)] pub fn op_buffer_slice_unsafe_callback<'s, 'i>( diff --git a/ops/op2/README.md b/ops/op2/README.md index 4d508fa79..69ea7904e 100644 --- a/ops/op2/README.md +++ b/ops/op2/README.md @@ -588,104 +588,6 @@ any -```text -#[arraybuffer] &mut [u8] -``` - - -✅ - -ArrayBuffer (resizable=true,false) - -⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. - - - - -```text -#[arraybuffer] &[u8] -``` - - -✅ - -ArrayBuffer (resizable=true,false) - -⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. - - - - -```text -#[arraybuffer] *mut u8 -``` - - -✅ - -ArrayBuffer (resizable=true,false) - -⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. - - - - -```text -#[arraybuffer] *const u8 -``` - - -✅ - -ArrayBuffer (resizable=true,false) - -⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. - - - - -```text -#[arraybuffer(copy)] Vec -``` - - -✅ - -ArrayBuffer (resizable=true,false) - -Safe, but forces a copy. - - - - -```text -#[arraybuffer(copy)] Box<[u8]> -``` - - -✅ - -ArrayBuffer (resizable=true,false) - -Safe, but forces a copy. - - - - -```text -#[arraybuffer(copy)] bytes::Bytes -``` - - -✅ - -ArrayBuffer (resizable=true,false) - -Safe, but forces a copy. - - - - ```text #[buffer(copy)] Vec ``` diff --git a/ops/op2/signature.rs b/ops/op2/signature.rs index d994a321d..2753fe3a5 100644 --- a/ops/op2/signature.rs +++ b/ops/op2/signature.rs @@ -1293,10 +1293,6 @@ fn parse_attribute( (#[anybuffer(unsafe)]) => Some(AttributeModifier::Buffer(BufferMode::Unsafe, BufferSource::Any)), (#[anybuffer(copy)]) => Some(AttributeModifier::Buffer(BufferMode::Copy, BufferSource::Any)), (#[anybuffer(detach)]) => Some(AttributeModifier::Buffer(BufferMode::Detach, BufferSource::Any)), - (#[arraybuffer]) => Some(AttributeModifier::Buffer(BufferMode::Default, BufferSource::ArrayBuffer)), - (#[arraybuffer(unsafe)]) => Some(AttributeModifier::Buffer(BufferMode::Unsafe, BufferSource::ArrayBuffer)), - (#[arraybuffer(copy)]) => Some(AttributeModifier::Buffer(BufferMode::Copy, BufferSource::ArrayBuffer)), - (#[arraybuffer(detach)]) => Some(AttributeModifier::Buffer(BufferMode::Detach, BufferSource::ArrayBuffer)), (#[global]) => Some(AttributeModifier::Global), (#[this]) => Some(AttributeModifier::This), (#[cppgc]) => Some(AttributeModifier::CppGcResource), @@ -1972,10 +1968,6 @@ mod tests { fn op_pointers(#[buffer] r#in: *const u8, #[buffer] out: *mut u8); (Buffer(Ptr(Ref, u8), Default, TypedArray), Buffer(Ptr(Mut, u8), Default, TypedArray)) -> Infallible(Void, false) ); - test!( - fn op_arraybuffer(#[arraybuffer] r#in: &[u8]); - (Buffer(Slice(Ref, u8), Default, ArrayBuffer)) -> Infallible(Void, false) - ); test!( #[serde] fn op_serde(#[serde] input: package::SerdeInputType) -> Result; (SerdeV8(package::SerdeInputType)) -> Result(SerdeV8(package::SerdeReturnType), false) diff --git a/ops/op2/test_cases/sync/buffers_out.out b/ops/op2/test_cases/sync/buffers_out.out index 528f46752..41c9a6c66 100644 --- a/ops/op2/test_cases/sync/buffers_out.out +++ b/ops/op2/test_cases/sync/buffers_out.out @@ -224,115 +224,3 @@ const fn op_buffers_option() -> ::deno_core::_ops::OpDecl { } ::DECL } - -#[allow(non_camel_case_types)] -const fn op_arraybuffers() -> ::deno_core::_ops::OpDecl { - #[allow(non_camel_case_types)] - struct op_arraybuffers { - _unconstructable: ::std::marker::PhantomData<()>, - } - impl ::deno_core::_ops::Op for op_arraybuffers { - const NAME: &'static str = stringify!(op_arraybuffers); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( - ::deno_core::__op_name_fast!(op_arraybuffers), - false, - false, - false, - 1usize as u8, - false, - Self::v8_fn_ptr as _, - Self::v8_fn_ptr_metrics as _, - ::deno_core::AccessorType::None, - None, - None, - ::deno_core::OpMetadata { - ..::deno_core::OpMetadata::default() - }, - ); - } - impl op_arraybuffers { - pub const fn name() -> &'static str { - ::NAME - } - fn slow_function_impl<'s>( - info: &'s deno_core::v8::FunctionCallbackInfo, - ) -> usize { - #[cfg(debug_assertions)] - let _reentrancy_check_guard = deno_core::_ops::reentrancy_check( - &::DECL, - ); - let scope = ::std::pin::pin!( - unsafe { deno_core::v8::CallbackScope::new(info) } - ); - let mut scope = scope.init(); - let mut rv = deno_core::v8::ReturnValue::from_function_callback_info(info); - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let result = { - let arg0 = args.get(0usize as i32); - let mut arg0_temp; - arg0_temp = match unsafe { deno_core::_ops::to_v8_slice_buffer(arg0) } { - Ok(arg0) => arg0, - Err(arg0_err) => { - deno_core::_ops::throw_error_one_byte_info(&info, arg0_err); - return 1; - } - }; - let arg0 = deno_core::serde_v8::JsBuffer::from_parts(arg0_temp); - Self::call(arg0) - }; - rv.set( - deno_core::_ops::RustToV8::to_v8( - deno_core::_ops::RustToV8Marker::< - deno_core::_ops::ArrayBufferMarker, - _, - >::from(result), - &mut scope, - ), - ); - return 0; - } - extern "C" fn v8_fn_ptr<'s>(info: *const deno_core::v8::FunctionCallbackInfo) { - let info: &'s _ = unsafe { &*info }; - Self::slow_function_impl(info); - } - extern "C" fn v8_fn_ptr_metrics<'s>( - info: *const deno_core::v8::FunctionCallbackInfo, - ) { - let info: &'s _ = unsafe { &*info }; - let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info( - info, - ); - let opctx: &'s _ = unsafe { - &*(deno_core::v8::Local::< - deno_core::v8::External, - >::cast_unchecked(args.data()) - .value() as *const deno_core::_ops::OpCtx) - }; - deno_core::_ops::dispatch_metrics_slow( - opctx, - deno_core::_ops::OpMetricsEvent::Dispatched, - ); - let res = Self::slow_function_impl(info); - if res == 0 { - deno_core::_ops::dispatch_metrics_slow( - opctx, - deno_core::_ops::OpMetricsEvent::Completed, - ); - } else { - deno_core::_ops::dispatch_metrics_slow( - opctx, - deno_core::_ops::OpMetricsEvent::Error, - ); - } - } - } - impl op_arraybuffers { - #[allow(clippy::too_many_arguments)] - fn call(buffer: JsBuffer) -> JsBuffer { - buffer - } - } - ::DECL -} diff --git a/ops/op2/test_cases/sync/buffers_out.rs b/ops/op2/test_cases/sync/buffers_out.rs index 8af8030a9..553eaa245 100644 --- a/ops/op2/test_cases/sync/buffers_out.rs +++ b/ops/op2/test_cases/sync/buffers_out.rs @@ -16,17 +16,3 @@ fn op_buffers(#[buffer] buffer: JsBuffer) -> JsBuffer { fn op_buffers_option(#[buffer] buffer: Option) -> Option { buffer } - -#[op2] -#[arraybuffer] -fn op_arraybuffers(#[arraybuffer] buffer: JsBuffer) -> JsBuffer { - buffer -} - -// TODO(mmastrac): Option + Marker doesn't work yet - -// #[op2] -// #[arraybuffer] -// fn op_arraybuffers_option(#[arraybuffer] buffer: Option) -> Option { -// buffer -// } diff --git a/ops/op2/valid_args.md b/ops/op2/valid_args.md index c5114b8da..9e686db1e 100644 --- a/ops/op2/valid_args.md +++ b/ops/op2/valid_args.md @@ -1,63 +1,56 @@ -| Supported | Rust | Fastcall | V8 | Notes | -| --------- | --------------------------------- | -------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| X | bool | X | Bool | | -| X | i8 | X | Uint32, Int32, Number, BigInt | | -| X | u8 | X | Uint32, Int32, Number, BigInt | | -| X | i16 | X | Uint32, Int32, Number, BigInt | | -| X | u16 | X | Uint32, Int32, Number, BigInt | | -| X | i32 | X | Uint32, Int32, Number, BigInt | | -| X | u32 | X | Uint32, Int32, Number, BigInt | | -| X | #[smi] ResourceId | X | Uint32, Int32, Number, BigInt | SMI is internally represented as a signed integer, but unsigned `#[smi]` types will be bit-converted to unsigned values for the Rust call. JavaScript code will continue to see signed integers. | -| X | #[bigint] i64 | X | Uint32, Int32, Number, BigInt | | -| X | #[bigint] u64 | X | Uint32, Int32, Number, BigInt | | -| X | #[bigint] isize | X | Uint32, Int32, Number, BigInt | | -| X | #[bigint] usize | X | Uint32, Int32, Number, BigInt | | -| X | f32 | X | Uint32, Int32, Number, BigInt | | -| X | f64 | X | Uint32, Int32, Number, BigInt | | -| X | #[string] String | X | String | Fastcall available only if string is Latin-1. Will always create an allocated, UTF-8 copy of the String data. | -| X | #[string] &str | X | String | Fastcall available only if string is Latin-1. Will create an owned `String` copy of the String data if it doesn't fit on the stack. Will never allocate in a fastcall, but will copy Latin-1 -> UTF-8. | -| X | #[string] Cow | X | String | Fastcall available only if string is Latin-1. Will create a `Cow::Owned` copy of the String data if it doesn't fit on the stack. Will always be `Cow::Borrowed` in a fastcall, but will copy Latin-1 -> UTF-8. | -| X | #[string(onebyte)] Cow<[u8]> | X | String | Fastest `String`-type method. If the string is not Latin-1, will throw a TypeError. | -| X | &v8::Value | X | any | | -| X | &v8::**V8** | X | **V8** | | -| X | v8::Local | X | any | | -| X | v8::Local | X | **V8** | | -| X | #[global] v8::Global | | any | ⚠️ Slower than `v8::Local`. | -| X | #[global] v8::Global | | **V8** | ⚠️ Slower than `v8::Local`. | -| X | #[serde] SerdeType | | any | ⚠️ May be slow. | -| X | #[serde] (Tuple, Tuple) | | any | ⚠️ May be slow. | -| | #[anybuffer] &mut [u8] | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| | #[anybuffer] &[u8] | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| | #[anybuffer] *mut u8 | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | -| | #[anybuffer] *const u8 | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | -| X | #[arraybuffer] &mut [u8] | X | ArrayBuffer (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| X | #[arraybuffer] &[u8] | X | ArrayBuffer (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| X | #[arraybuffer] *mut u8 | X | ArrayBuffer (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | -| X | #[arraybuffer] *const u8 | X | ArrayBuffer (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | -| X | #[arraybuffer(copy)] Vec | X | ArrayBuffer (resizable=true,false) | Safe, but forces a copy. | -| X | #[arraybuffer(copy)] Box<[u8]> | X | ArrayBuffer (resizable=true,false) | Safe, but forces a copy. | -| X | #[arraybuffer(copy)] bytes::Bytes | X | ArrayBuffer (resizable=true,false) | Safe, but forces a copy. | -| | #[buffer] &mut [u8] | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| | #[buffer] &[u8] | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| | #[buffer] *mut u8 | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | -| | #[buffer] *const u8 | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | -| X | #[buffer(copy)] Vec | X | UInt8Array (resizable=true,false) | Safe, but forces a copy. | -| X | #[buffer(copy)] Box<[u8]> | X | UInt8Array (resizable=true,false) | Safe, but forces a copy. | -| X | #[buffer(copy)] bytes::Bytes | X | UInt8Array (resizable=true,false) | Safe, but forces a copy. | -| X | #[buffer] &mut [u32] | X | UInt32Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| X | #[buffer] &[u32] | X | UInt32Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | -| X | #[buffer(copy)] Vec | X | UInt32Array (resizable=true,false) | Safe, but forces a copy. | -| X | #[buffer(copy)] Box<[u32]> | X | UInt32Array (resizable=true,false) | Safe, but forces a copy. | -| | #[buffer] V8Slice | X | ArrayBufferView (resizable=false) | ⚠️ JS may modify the contents of slices obtained from buffer. | -| | #[buffer(detach)] V8Slice | X | ArrayBufferView (resizable=true,false) | Safe. | -| | #[buffer] V8ResizableSlice | X | ArrayBufferView (resizable=true) | ⚠️ JS may modify the contents of slices obtained from buffer. | -| | #[buffer] JsBuffer | X | ArrayBufferView (resizable=false) | ⚠️ JS may modify the contents of slices obtained from buffer. | -| X | #[buffer(detach)] JsBuffer | | ArrayBufferView (resizable=true,false) | Safe. | -| | #[buffer(unsafe)] bytes::Bytes | X | ArrayBufferView (resizable=false) | ⚠️ JS may modify the contents of the buffer. | -| | #[buffer(detach)] bytes::Bytes | X | ArrayBufferView (resizable=true,false) | Safe. | -| X | *const std::ffi::c_void | X | External | | -| X | *mut std::ffi::c_void | X | External | | -| X | &OpState | X | | | -| X | &mut OpState | X | | | -| X | Rc> | X | | | -| X | &JsRuntimeState | X | | Only usable in `deno_core`. | +| Supported | Rust | Fastcall | V8 | Notes | +| --------- | -------------------------------- | -------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| X | bool | X | Bool | | +| X | i8 | X | Uint32, Int32, Number, BigInt | | +| X | u8 | X | Uint32, Int32, Number, BigInt | | +| X | i16 | X | Uint32, Int32, Number, BigInt | | +| X | u16 | X | Uint32, Int32, Number, BigInt | | +| X | i32 | X | Uint32, Int32, Number, BigInt | | +| X | u32 | X | Uint32, Int32, Number, BigInt | | +| X | #[smi] ResourceId | X | Uint32, Int32, Number, BigInt | SMI is internally represented as a signed integer, but unsigned `#[smi]` types will be bit-converted to unsigned values for the Rust call. JavaScript code will continue to see signed integers. | +| X | #[bigint] i64 | X | Uint32, Int32, Number, BigInt | | +| X | #[bigint] u64 | X | Uint32, Int32, Number, BigInt | | +| X | #[bigint] isize | X | Uint32, Int32, Number, BigInt | | +| X | #[bigint] usize | X | Uint32, Int32, Number, BigInt | | +| X | f32 | X | Uint32, Int32, Number, BigInt | | +| X | f64 | X | Uint32, Int32, Number, BigInt | | +| X | #[string] String | X | String | Fastcall available only if string is Latin-1. Will always create an allocated, UTF-8 copy of the String data. | +| X | #[string] &str | X | String | Fastcall available only if string is Latin-1. Will create an owned `String` copy of the String data if it doesn't fit on the stack. Will never allocate in a fastcall, but will copy Latin-1 -> UTF-8. | +| X | #[string] Cow | X | String | Fastcall available only if string is Latin-1. Will create a `Cow::Owned` copy of the String data if it doesn't fit on the stack. Will always be `Cow::Borrowed` in a fastcall, but will copy Latin-1 -> UTF-8. | +| X | #[string(onebyte)] Cow<[u8]> | X | String | Fastest `String`-type method. If the string is not Latin-1, will throw a TypeError. | +| X | &v8::Value | X | any | | +| X | &v8::**V8** | X | **V8** | | +| X | v8::Local | X | any | | +| X | v8::Local | X | **V8** | | +| X | #[global] v8::Global | | any | ⚠️ Slower than `v8::Local`. | +| X | #[global] v8::Global | | **V8** | ⚠️ Slower than `v8::Local`. | +| X | #[serde] SerdeType | | any | ⚠️ May be slow. | +| X | #[serde] (Tuple, Tuple) | | any | ⚠️ May be slow. | +| | #[anybuffer] &mut [u8] | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | +| | #[anybuffer] &[u8] | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | +| | #[anybuffer] *mut u8 | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | +| | #[anybuffer] *const u8 | X | ArrayBuffer, ArrayBufferView (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | +| | #[buffer] &mut [u8] | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | +| | #[buffer] &[u8] | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | +| | #[buffer] *mut u8 | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | +| | #[buffer] *const u8 | X | UInt8Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null. | +| X | #[buffer(copy)] Vec | X | UInt8Array (resizable=true,false) | Safe, but forces a copy. | +| X | #[buffer(copy)] Box<[u8]> | X | UInt8Array (resizable=true,false) | Safe, but forces a copy. | +| X | #[buffer(copy)] bytes::Bytes | X | UInt8Array (resizable=true,false) | Safe, but forces a copy. | +| X | #[buffer] &mut [u32] | X | UInt32Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | +| X | #[buffer] &[u32] | X | UInt32Array (resizable=true,false) | ⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. | +| X | #[buffer(copy)] Vec | X | UInt32Array (resizable=true,false) | Safe, but forces a copy. | +| X | #[buffer(copy)] Box<[u32]> | X | UInt32Array (resizable=true,false) | Safe, but forces a copy. | +| | #[buffer] V8Slice | X | ArrayBufferView (resizable=false) | ⚠️ JS may modify the contents of slices obtained from buffer. | +| | #[buffer(detach)] V8Slice | X | ArrayBufferView (resizable=true,false) | Safe. | +| | #[buffer] V8ResizableSlice | X | ArrayBufferView (resizable=true) | ⚠️ JS may modify the contents of slices obtained from buffer. | +| | #[buffer] JsBuffer | X | ArrayBufferView (resizable=false) | ⚠️ JS may modify the contents of slices obtained from buffer. | +| X | #[buffer(detach)] JsBuffer | | ArrayBufferView (resizable=true,false) | Safe. | +| | #[buffer(unsafe)] bytes::Bytes | X | ArrayBufferView (resizable=false) | ⚠️ JS may modify the contents of the buffer. | +| | #[buffer(detach)] bytes::Bytes | X | ArrayBufferView (resizable=true,false) | Safe. | +| X | *const std::ffi::c_void | X | External | | +| X | *mut std::ffi::c_void | X | External | | +| X | &OpState | X | | | +| X | &mut OpState | X | | | +| X | Rc> | X | | | +| X | &JsRuntimeState | X | | Only usable in `deno_core`. | diff --git a/ops/op2/valid_retvals.md b/ops/op2/valid_retvals.md index c9a8cce8d..af240cdb0 100644 --- a/ops/op2/valid_retvals.md +++ b/ops/op2/valid_retvals.md @@ -22,10 +22,6 @@ | X | #[string] &str | | String | | | X | #[string] Cow | | String | | | X | #[string(onebyte)] Cow<[u8]> | | String | | -| X | #[arraybuffer] V8Slice | | ArrayBuffer | | -| X | #[arraybuffer] Vec | | ArrayBuffer | | -| X | #[arraybuffer] Box<[u8]> | | ArrayBuffer | | -| X | #[arraybuffer] bytes::BytesMut | | ArrayBuffer | | | X | #[buffer] V8Slice | | Uint8Array | | | X | #[buffer] Vec | | Uint8Array | | | X | #[buffer] Box<[u8]> | | Uint8Array | |