From 01b1260abbc0f6302869d7a7440ae219c594b11f Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 5 Jul 2024 08:17:25 +0530 Subject: [PATCH 1/3] Rename op2 to op It has stayed op2 for a long time now with older op macro removed --- core/benches/ops/async.rs | 30 +-- core/benches/ops/sync.rs | 52 ++--- core/benches/snapshot/snapshot.rs | 2 +- core/convert.rs | 20 +- core/examples/hello_world.rs | 2 +- core/examples/op2.js | 2 +- core/examples/op2.rs | 12 +- core/examples/wasm.rs | 8 +- core/extensions.rs | 2 +- core/lib.rs | 4 +- core/modules/tests.rs | 4 +- core/ops.rs | 2 +- core/ops_builtin.rs | 56 +++--- core/ops_builtin_types.rs | 58 +++--- core/ops_builtin_v8.rs | 84 ++++---- core/runtime/ops.rs | 180 +++++++++--------- core/runtime/ops_rust_to_v8.rs | 6 +- core/runtime/tests/error.rs | 4 +- core/runtime/tests/jsrealm.rs | 4 +- core/runtime/tests/misc.rs | 22 +-- core/runtime/tests/mod.rs | 4 +- core/runtime/tests/ops.rs | 48 ++--- core/runtime/tests/snapshot.rs | 6 +- core/source_map.rs | 2 +- ops/README.md | 4 +- ops/compile_test_runner/src/lib.rs | 12 +- ops/lib.rs | 14 +- ops/{op2 => op}/README.md | 8 +- ops/{op2 => op}/config.rs | 12 +- ops/{op2 => op}/dispatch_async.rs | 0 ops/{op2 => op}/dispatch_fast.rs | 2 +- ops/{op2 => op}/dispatch_shared.rs | 0 ops/{op2 => op}/dispatch_slow.rs | 0 ops/{op2 => op}/generator_state.rs | 0 ops/{op2 => op}/mod.rs | 30 +-- ops/{op2 => op}/signature.rs | 0 ops/{op2 => op}/signature_retval.rs | 2 +- .../test_cases/async/async_arg_return.out | 2 +- .../test_cases/async/async_arg_return.rs | 2 +- .../async/async_arg_return_result.out | 2 +- .../async/async_arg_return_result.rs | 2 +- .../test_cases/async/async_cppgc.out | 6 +- .../test_cases/async/async_cppgc.rs | 6 +- .../test_cases/async/async_deferred.out | 2 +- .../test_cases/async/async_deferred.rs | 2 +- .../test_cases/async/async_jsbuffer.out | 2 +- .../test_cases/async/async_jsbuffer.rs | 2 +- .../test_cases/async/async_lazy.out | 2 +- .../test_cases/async/async_lazy.rs | 2 +- .../test_cases/async/async_op_metadata.out | 4 +- .../test_cases/async/async_op_metadata.rs | 4 +- .../test_cases/async/async_opstate.out | 2 +- .../test_cases/async/async_opstate.rs | 2 +- .../test_cases/async/async_result.out | 2 +- .../test_cases/async/async_result.rs | 2 +- .../test_cases/async/async_result_impl.out | 2 +- .../test_cases/async/async_result_impl.rs | 2 +- .../test_cases/async/async_result_smi.out | 2 +- .../test_cases/async/async_result_smi.rs | 2 +- .../test_cases/async/async_v8_global.out | 2 +- .../test_cases/async/async_v8_global.rs | 2 +- .../test_cases/async/async_void.out | 2 +- .../test_cases/async/async_void.rs | 2 +- .../test_cases/compiler_pass/async.rs | 18 +- .../test_cases/compiler_pass/sync.rs | 16 +- ops/{op2 => op}/test_cases/sync/add.out | 2 +- ops/{op2 => op}/test_cases/sync/add.rs | 2 +- .../test_cases/sync/add_options.out | 2 +- .../test_cases/sync/add_options.rs | 2 +- ops/{op2 => op}/test_cases/sync/bigint.out | 2 +- ops/{op2 => op}/test_cases/sync/bigint.rs | 2 +- ops/{op2 => op}/test_cases/sync/bool.out | 2 +- ops/{op2 => op}/test_cases/sync/bool.rs | 2 +- .../test_cases/sync/bool_result.out | 2 +- .../test_cases/sync/bool_result.rs | 2 +- ops/{op2 => op}/test_cases/sync/buffers.out | 6 +- ops/{op2 => op}/test_cases/sync/buffers.rs | 6 +- .../test_cases/sync/buffers_copy.out | 4 +- .../test_cases/sync/buffers_copy.rs | 4 +- .../test_cases/sync/buffers_out.out | 6 +- .../test_cases/sync/buffers_out.rs | 8 +- ops/{op2 => op}/test_cases/sync/cfg.out | 4 +- ops/{op2 => op}/test_cases/sync/cfg.rs | 4 +- .../test_cases/sync/clippy_allow.out | 4 +- .../test_cases/sync/clippy_allow.rs | 4 +- .../test_cases/sync/cppgc_resource.out | 12 +- .../test_cases/sync/cppgc_resource.rs | 12 +- .../test_cases/sync/doc_comment.out | 2 +- .../test_cases/sync/doc_comment.rs | 2 +- .../test_cases/sync/fast_alternative.out | 8 +- .../test_cases/sync/fast_alternative.rs | 8 +- ops/{op2 => op}/test_cases/sync/from_v8.out | 2 +- ops/{op2 => op}/test_cases/sync/from_v8.rs | 2 +- ops/{op2 => op}/test_cases/sync/generics.out | 6 +- ops/{op2 => op}/test_cases/sync/generics.rs | 6 +- ops/{op2 => op}/test_cases/sync/nofast.out | 2 +- ops/{op2 => op}/test_cases/sync/nofast.rs | 2 +- .../test_cases/sync/op_state_attr.out | 2 +- .../test_cases/sync/op_state_attr.rs | 2 +- .../test_cases/sync/op_state_rc.out | 2 +- .../test_cases/sync/op_state_rc.rs | 2 +- .../test_cases/sync/op_state_ref.out | 8 +- .../test_cases/sync/op_state_ref.rs | 8 +- .../test_cases/sync/result_external.out | 2 +- .../test_cases/sync/result_external.rs | 2 +- .../test_cases/sync/result_primitive.out | 2 +- .../test_cases/sync/result_primitive.rs | 2 +- .../test_cases/sync/result_scope.out | 2 +- .../test_cases/sync/result_scope.rs | 2 +- .../test_cases/sync/result_void.out | 2 +- .../test_cases/sync/result_void.rs | 2 +- ops/{op2 => op}/test_cases/sync/serde_v8.out | 2 +- ops/{op2 => op}/test_cases/sync/serde_v8.rs | 2 +- ops/{op2 => op}/test_cases/sync/smi.out | 6 +- ops/{op2 => op}/test_cases/sync/smi.rs | 6 +- .../test_cases/sync/string_cow.out | 2 +- ops/{op2 => op}/test_cases/sync/string_cow.rs | 2 +- .../test_cases/sync/string_onebyte.out | 2 +- .../test_cases/sync/string_onebyte.rs | 2 +- .../test_cases/sync/string_option_return.out | 2 +- .../test_cases/sync/string_option_return.rs | 2 +- .../test_cases/sync/string_owned.out | 2 +- .../test_cases/sync/string_owned.rs | 2 +- .../test_cases/sync/string_ref.out | 2 +- ops/{op2 => op}/test_cases/sync/string_ref.rs | 2 +- .../test_cases/sync/string_return.out | 6 +- .../test_cases/sync/string_return.rs | 6 +- ops/{op2 => op}/test_cases/sync/to_v8.out | 2 +- ops/{op2 => op}/test_cases/sync/to_v8.rs | 2 +- ops/{op2 => op}/test_cases/sync/v8_global.out | 2 +- ops/{op2 => op}/test_cases/sync/v8_global.rs | 2 +- .../test_cases/sync/v8_handlescope.out | 2 +- .../test_cases/sync/v8_handlescope.rs | 2 +- .../test_cases/sync/v8_lifetime.out | 2 +- .../test_cases/sync/v8_lifetime.rs | 2 +- .../test_cases/sync/v8_ref_option.out | 2 +- .../test_cases/sync/v8_ref_option.rs | 2 +- ops/{op2 => op}/test_cases/sync/v8_string.out | 2 +- ops/{op2 => op}/test_cases/sync/v8_string.rs | 2 +- ops/{op2 => op}/test_cases_fail/lifetimes.rs | 4 +- .../test_cases_fail/lifetimes.stderr | 18 +- ops/{op2 => op}/valid_args.md | 0 ops/{op2 => op}/valid_retvals.md | 0 testing/checkin/runner/ops.rs | 22 +-- testing/checkin/runner/ops_async.rs | 18 +- testing/checkin/runner/ops_buffer.rs | 6 +- testing/checkin/runner/ops_error.rs | 14 +- testing/checkin/runner/ops_io.rs | 6 +- testing/checkin/runner/ops_worker.rs | 14 +- testing/checkin/runner/testing.rs | 4 +- 150 files changed, 573 insertions(+), 575 deletions(-) rename ops/{op2 => op}/README.md (98%) rename ops/{op2 => op}/config.rs (96%) rename ops/{op2 => op}/dispatch_async.rs (100%) rename ops/{op2 => op}/dispatch_fast.rs (99%) rename ops/{op2 => op}/dispatch_shared.rs (100%) rename ops/{op2 => op}/dispatch_slow.rs (100%) rename ops/{op2 => op}/generator_state.rs (100%) rename ops/{op2 => op}/mod.rs (96%) rename ops/{op2 => op}/signature.rs (100%) rename ops/{op2 => op}/signature_retval.rs (99%) rename ops/{op2 => op}/test_cases/async/async_arg_return.out (99%) rename ops/{op2 => op}/test_cases/async/async_arg_return.rs (92%) rename ops/{op2 => op}/test_cases/async/async_arg_return_result.out (99%) rename ops/{op2 => op}/test_cases/async/async_arg_return_result.rs (93%) rename ops/{op2 => op}/test_cases/async/async_cppgc.out (99%) rename ops/{op2 => op}/test_cases/async/async_cppgc.rs (90%) rename ops/{op2 => op}/test_cases/async/async_deferred.out (99%) rename ops/{op2 => op}/test_cases/async/async_deferred.rs (87%) rename ops/{op2 => op}/test_cases/async/async_jsbuffer.out (99%) rename ops/{op2 => op}/test_cases/async/async_jsbuffer.rs (94%) rename ops/{op2 => op}/test_cases/async/async_lazy.out (99%) rename ops/{op2 => op}/test_cases/async/async_lazy.rs (88%) rename ops/{op2 => op}/test_cases/async/async_op_metadata.out (99%) rename ops/{op2 => op}/test_cases/async/async_op_metadata.rs (94%) rename ops/{op2 => op}/test_cases/async/async_opstate.out (99%) rename ops/{op2 => op}/test_cases/async/async_opstate.rs (95%) rename ops/{op2 => op}/test_cases/async/async_result.out (99%) rename ops/{op2 => op}/test_cases/async/async_result.rs (93%) rename ops/{op2 => op}/test_cases/async/async_result_impl.out (99%) rename ops/{op2 => op}/test_cases/async/async_result_impl.rs (95%) rename ops/{op2 => op}/test_cases/async/async_result_smi.out (99%) rename ops/{op2 => op}/test_cases/async/async_result_smi.rs (95%) rename ops/{op2 => op}/test_cases/async/async_v8_global.out (99%) rename ops/{op2 => op}/test_cases/async/async_v8_global.rs (94%) rename ops/{op2 => op}/test_cases/async/async_void.out (99%) rename ops/{op2 => op}/test_cases/async/async_void.rs (92%) rename ops/{op2 => op}/test_cases/compiler_pass/async.rs (89%) rename ops/{op2 => op}/test_cases/compiler_pass/sync.rs (91%) rename ops/{op2 => op}/test_cases/sync/add.out (99%) rename ops/{op2 => op}/test_cases/sync/add.rs (93%) rename ops/{op2 => op}/test_cases/sync/add_options.out (99%) rename ops/{op2 => op}/test_cases/sync/add_options.rs (96%) rename ops/{op2 => op}/test_cases/sync/bigint.out (99%) rename ops/{op2 => op}/test_cases/sync/bigint.rs (93%) rename ops/{op2 => op}/test_cases/sync/bool.out (99%) rename ops/{op2 => op}/test_cases/sync/bool.rs (93%) rename ops/{op2 => op}/test_cases/sync/bool_result.out (99%) rename ops/{op2 => op}/test_cases/sync/bool_result.rs (94%) rename ops/{op2 => op}/test_cases/sync/buffers.out (99%) rename ops/{op2 => op}/test_cases/sync/buffers.rs (93%) rename ops/{op2 => op}/test_cases/sync/buffers_copy.out (99%) rename ops/{op2 => op}/test_cases/sync/buffers_copy.rs (92%) rename ops/{op2 => op}/test_cases/sync/buffers_out.out (99%) rename ops/{op2 => op}/test_cases/sync/buffers_out.rs (95%) rename ops/{op2 => op}/test_cases/sync/cfg.out (99%) rename ops/{op2 => op}/test_cases/sync/cfg.rs (92%) rename ops/{op2 => op}/test_cases/sync/clippy_allow.out (99%) rename ops/{op2 => op}/test_cases/sync/clippy_allow.rs (92%) rename ops/{op2 => op}/test_cases/sync/cppgc_resource.out (99%) rename ops/{op2 => op}/test_cases/sync/cppgc_resource.rs (89%) rename ops/{op2 => op}/test_cases/sync/doc_comment.out (99%) rename ops/{op2 => op}/test_cases/sync/doc_comment.rs (93%) rename ops/{op2 => op}/test_cases/sync/fast_alternative.out (99%) rename ops/{op2 => op}/test_cases/sync/fast_alternative.rs (87%) rename ops/{op2 => op}/test_cases/sync/from_v8.out (99%) rename ops/{op2 => op}/test_cases/sync/from_v8.rs (98%) rename ops/{op2 => op}/test_cases/sync/generics.out (99%) rename ops/{op2 => op}/test_cases/sync/generics.rs (88%) rename ops/{op2 => op}/test_cases/sync/nofast.out (99%) rename ops/{op2 => op}/test_cases/sync/nofast.rs (92%) rename ops/{op2 => op}/test_cases/sync/op_state_attr.out (99%) rename ops/{op2 => op}/test_cases/sync/op_state_attr.rs (96%) rename ops/{op2 => op}/test_cases/sync/op_state_rc.out (99%) rename ops/{op2 => op}/test_cases/sync/op_state_rc.rs (95%) rename ops/{op2 => op}/test_cases/sync/op_state_ref.out (99%) rename ops/{op2 => op}/test_cases/sync/op_state_ref.rs (92%) rename ops/{op2 => op}/test_cases/sync/result_external.out (99%) rename ops/{op2 => op}/test_cases/sync/result_external.rs (95%) rename ops/{op2 => op}/test_cases/sync/result_primitive.out (99%) rename ops/{op2 => op}/test_cases/sync/result_primitive.rs (94%) rename ops/{op2 => op}/test_cases/sync/result_scope.out (99%) rename ops/{op2 => op}/test_cases/sync/result_scope.rs (97%) rename ops/{op2 => op}/test_cases/sync/result_void.out (99%) rename ops/{op2 => op}/test_cases/sync/result_void.rs (93%) rename ops/{op2 => op}/test_cases/sync/serde_v8.out (99%) rename ops/{op2 => op}/test_cases/sync/serde_v8.rs (98%) rename ops/{op2 => op}/test_cases/sync/smi.out (99%) rename ops/{op2 => op}/test_cases/sync/smi.rs (95%) rename ops/{op2 => op}/test_cases/sync/string_cow.out (99%) rename ops/{op2 => op}/test_cases/sync/string_cow.rs (94%) rename ops/{op2 => op}/test_cases/sync/string_onebyte.out (99%) rename ops/{op2 => op}/test_cases/sync/string_onebyte.rs (94%) rename ops/{op2 => op}/test_cases/sync/string_option_return.out (99%) rename ops/{op2 => op}/test_cases/sync/string_option_return.rs (96%) rename ops/{op2 => op}/test_cases/sync/string_owned.out (99%) rename ops/{op2 => op}/test_cases/sync/string_owned.rs (93%) rename ops/{op2 => op}/test_cases/sync/string_ref.out (99%) rename ops/{op2 => op}/test_cases/sync/string_ref.rs (93%) rename ops/{op2 => op}/test_cases/sync/string_return.out (99%) rename ops/{op2 => op}/test_cases/sync/string_return.rs (94%) rename ops/{op2 => op}/test_cases/sync/to_v8.out (99%) rename ops/{op2 => op}/test_cases/sync/to_v8.rs (98%) rename ops/{op2 => op}/test_cases/sync/v8_global.out (99%) rename ops/{op2 => op}/test_cases/sync/v8_global.rs (97%) rename ops/{op2 => op}/test_cases/sync/v8_handlescope.out (99%) rename ops/{op2 => op}/test_cases/sync/v8_handlescope.rs (97%) rename ops/{op2 => op}/test_cases/sync/v8_lifetime.out (99%) rename ops/{op2 => op}/test_cases/sync/v8_lifetime.rs (97%) rename ops/{op2 => op}/test_cases/sync/v8_ref_option.out (99%) rename ops/{op2 => op}/test_cases/sync/v8_ref_option.rs (94%) rename ops/{op2 => op}/test_cases/sync/v8_string.out (99%) rename ops/{op2 => op}/test_cases/sync/v8_string.rs (97%) rename ops/{op2 => op}/test_cases_fail/lifetimes.rs (93%) rename ops/{op2 => op}/test_cases_fail/lifetimes.stderr (64%) rename ops/{op2 => op}/valid_args.md (100%) rename ops/{op2 => op}/valid_retvals.md (100%) diff --git a/core/benches/ops/async.rs b/core/benches/ops/async.rs index 84656ff72..56ad69dba 100644 --- a/core/benches/ops/async.rs +++ b/core/benches/ops/async.rs @@ -26,13 +26,13 @@ deno_core::extension!( ], ); -#[op2] +#[op] pub fn op_call_promise_resolver(scope: &mut v8::HandleScope, f: &v8::Function) { let recv = v8::undefined(scope).into(); f.call(scope, recv, &[]); } -#[op2] +#[op] pub fn op_resolve_promise<'s>( scope: &'s mut v8::HandleScope, ) -> v8::Local<'s, v8::Promise> { @@ -42,57 +42,57 @@ pub fn op_resolve_promise<'s>( resolver.get_promise(scope) } -#[op2(fast)] +#[op(fast)] pub fn op_void() {} -#[op2(fast)] +#[op(fast)] pub fn op_make_external() -> *const c_void { std::ptr::null() } -#[op2(async)] +#[op(async)] pub async fn op_async_void() {} -#[op2(async)] +#[op(async)] pub async fn op_async_yield() { tokio::task::yield_now().await } -#[op2(async(lazy), fast)] +#[op(async(lazy), fast)] pub async fn op_async_yield_lazy() { tokio::task::yield_now().await } -#[op2(async(lazy), nofast)] +#[op(async(lazy), nofast)] pub async fn op_async_yield_lazy_nofast() { tokio::task::yield_now().await } -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_async_yield_deferred() { tokio::task::yield_now().await } -#[op2(async(deferred), nofast)] +#[op(async(deferred), nofast)] pub async fn op_async_yield_deferred_nofast() { tokio::task::yield_now().await } -#[op2(async(lazy), fast)] +#[op(async(lazy), fast)] pub async fn op_async_void_lazy() {} -#[op2(async(lazy), nofast)] +#[op(async(lazy), nofast)] pub async fn op_async_void_lazy_nofast() {} -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_async_void_deferred_return() -> u32 { 1 } -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_async_void_deferred() {} -#[op2(async(deferred), nofast)] +#[op(async(deferred), nofast)] pub async fn op_async_void_deferred_nofast() {} fn bench_op( diff --git a/core/benches/ops/sync.rs b/core/benches/ops/sync.rs index 9f483ea41..eaaf90d81 100644 --- a/core/benches/ops/sync.rs +++ b/core/benches/ops/sync.rs @@ -42,104 +42,104 @@ deno_core::extension!( } ); -#[op2(fast)] +#[op(fast)] pub fn op_void() {} -#[op2(nofast)] +#[op(nofast)] pub fn op_void_nofast() {} -#[op2(fast)] +#[op(fast)] pub fn op_void_metrics() {} -#[op2(nofast)] +#[op(nofast)] pub fn op_void_nofast_metrics() {} -#[op2(fast)] +#[op(fast)] pub fn op_u32() -> u32 { 1 } -#[op2] +#[op] pub fn op_option_u32() -> Option { Some(1) } -#[op2(fast)] +#[op(fast)] pub fn op_string(#[string] s: &str) -> u32 { s.len() as _ } -#[op2(fast)] +#[op(fast)] pub fn op_string_onebyte(#[string(onebyte)] s: Cow<[u8]>) -> u32 { s.len() as _ } -#[op2] +#[op] pub fn op_string_bytestring(#[serde] s: ByteString) -> u32 { s.len() as _ } -#[op2] +#[op] pub fn op_string_option_u32(#[string] s: &str) -> Option { Some(s.len() as _) } -#[op2(fast)] +#[op(fast)] pub fn op_local(_s: v8::Local) {} -#[op2] +#[op] pub fn op_local_scope(_scope: &mut v8::HandleScope, _s: v8::Local) { } -#[op2(nofast)] +#[op(nofast)] pub fn op_local_nofast(_s: v8::Local) {} -#[op2] +#[op] pub fn op_global(#[global] _s: v8::Global) {} -#[op2] +#[op] pub fn op_global_scope( _scope: &mut v8::HandleScope, #[global] _s: v8::Global, ) { } -#[op2] +#[op] pub fn op_scope(_scope: &mut v8::HandleScope) {} -#[op2(nofast)] +#[op(nofast)] pub fn op_isolate_nofast(_isolate: *mut v8::Isolate) {} -#[op2(fast)] +#[op(fast)] pub fn op_make_external() -> *const c_void { std::ptr::null() } -#[op2(fast)] +#[op(fast)] pub fn op_bigint(#[bigint] _input: u64) {} -#[op2(fast)] +#[op(fast)] #[bigint] pub fn op_bigint_return() -> u64 { 0 } -#[op2(fast)] +#[op(fast)] pub fn op_external(_input: *const c_void) {} -#[op2(nofast)] +#[op(nofast)] pub fn op_external_nofast(_input: *const c_void) {} -#[op2(fast)] +#[op(fast)] pub fn op_buffer(#[buffer] _buffer: &[u8]) {} -#[op2] +#[op] pub fn op_buffer_jsbuffer(#[buffer] _buffer: JsBuffer) {} -#[op2(nofast)] +#[op(nofast)] pub fn op_buffer_nofast(#[buffer] _buffer: &[u8]) {} -#[op2(fast)] +#[op(fast)] pub fn op_arraybuffer(#[arraybuffer] _buffer: &[u8]) {} fn bench_op( diff --git a/core/benches/snapshot/snapshot.rs b/core/benches/snapshot/snapshot.rs index 64ee014eb..e5530e088 100644 --- a/core/benches/snapshot/snapshot.rs +++ b/core/benches/snapshot/snapshot.rs @@ -30,7 +30,7 @@ macro_rules! fake_extensions { ); mod ops { - #[deno_core::op2(fast)] + #[deno_core::op(fast)] pub fn $name() { } } diff --git a/core/convert.rs b/core/convert.rs index 5c04803e6..c4665d315 100644 --- a/core/convert.rs +++ b/core/convert.rs @@ -9,11 +9,11 @@ use std::convert::Infallible; /// When passing data from Rust into JS, either /// via an op or by calling a JS function directly, /// you need to serialize the data into a native -/// V8 value. When using the [`op2`][deno_core::op2] macro, the return +/// V8 value. When using the [`op`][deno_core::op] macro, the return /// value is converted to a `v8::Local` automatically, /// and the strategy for conversion is controlled by attributes /// like `#[smi]`, `#[number]`, `#[string]`. For types with support -/// built-in to the op2 macro, like primitives, strings, and buffers, +/// built-in to the op macro, like primitives, strings, and buffers, /// these attributes are sufficient and you don't need to worry about this trait. /// /// If, however, you want to return a custom type from an op, or @@ -21,14 +21,14 @@ use std::convert::Infallible; /// you can implement the `ToV8` trait. This allows you the /// choose the best serialization strategy for your specific use case. /// You can then use the `#[to_v8]` attribute to indicate -/// that the `#[op2]` macro should call your implementation for the conversion. +/// that the `#[op]` macro should call your implementation for the conversion. /// /// # Example /// /// ```ignore /// use deno_core::ToV8; /// use deno_core::convert::Smi; -/// use deno_core::op2; +/// use deno_core::op; /// /// struct Foo(i32); /// @@ -44,8 +44,8 @@ use std::convert::Infallible; /// } /// } /// -/// // using the `#[to_v8]` attribute tells the `op2` macro to call this implementation. -/// #[op2] +/// // using the `#[to_v8]` attribute tells the `op` macro to call this implementation. +/// #[op] /// #[to_v8] /// fn op_foo() -> Foo { /// Foo(42) @@ -80,7 +80,7 @@ pub trait ToV8<'a> { /// To convert these values into custom Rust types, you can implement the [`FromV8`] trait. /// /// Once you've implemented this trait, you can use the `#[from_v8]` attribute -/// to tell the [`op2`][deno_core::op2] macro to use your implementation to convert the argument +/// to tell the [`op`][deno_core::op] macro to use your implementation to convert the argument /// to the desired type. /// /// # Example @@ -88,7 +88,7 @@ pub trait ToV8<'a> { /// ```ignore /// use deno_core::FromV8; /// use deno_core::convert::Smi; -/// use deno_core::op2; +/// use deno_core::op; /// /// struct Foo(i32); /// @@ -103,8 +103,8 @@ pub trait ToV8<'a> { /// } /// } /// -/// // using the `#[from_v8]` attribute tells the `op2` macro to call this implementation. -/// #[op2] +/// // using the `#[from_v8]` attribute tells the `op` macro to call this implementation. +/// #[op] /// fn op_foo(#[from_v8] foo: Foo) { /// let Foo(_) = foo; /// } diff --git a/core/examples/hello_world.rs b/core/examples/hello_world.rs index 6e99349a7..44c8b70d5 100644 --- a/core/examples/hello_world.rs +++ b/core/examples/hello_world.rs @@ -6,7 +6,7 @@ use deno_core::*; /// An op for summing an array of numbers. The op-layer automatically /// deserializes inputs and serializes the returned Result & value. -#[op2] +#[op] fn op_sum(#[serde] nums: Vec) -> Result { // Sum inputs let sum = nums.iter().fold(0.0, |a, v| a + v); diff --git a/core/examples/op2.js b/core/examples/op2.js index b59734a76..74a7ef0a3 100644 --- a/core/examples/op2.js +++ b/core/examples/op2.js @@ -1,4 +1,4 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -globalThis.op2_sample = { +globalThis.op_sample = { "use_state": (f) => Deno.core.ops.op_use_state(f), }; diff --git a/core/examples/op2.rs b/core/examples/op2.rs index d91d0a259..ca5018852 100644 --- a/core/examples/op2.rs +++ b/core/examples/op2.rs @@ -4,7 +4,7 @@ use deno_core::anyhow::Error; use deno_core::*; use std::rc::Rc; -#[op2] +#[op] fn op_use_state( state: &mut OpState, #[global] callback: v8::Global, @@ -14,17 +14,17 @@ fn op_use_state( } extension!( - op2_sample, + op_sample, ops = [op_use_state], - esm_entry_point = "ext:op2_sample/op2.js", + esm_entry_point = "ext:op_sample/op2.js", esm = [ dir "examples", "op2.js" ], - docs = "A small example demonstrating op2 usage.", "Contains one op." + docs = "A small example demonstrating op usage.", "Contains one op." ); fn main() -> Result<(), Error> { let module_name = "test.js"; let module_code = " - op2_sample.use_state(() => { + op_sample.use_state(() => { console.log('Hello World'); }); " @@ -32,7 +32,7 @@ fn main() -> Result<(), Error> { let mut js_runtime = JsRuntime::new(deno_core::RuntimeOptions { module_loader: Some(Rc::new(FsModuleLoader)), - extensions: vec![op2_sample::init_ops_and_esm()], + extensions: vec![op_sample::init_ops_and_esm()], ..Default::default() }); diff --git a/core/examples/wasm.rs b/core/examples/wasm.rs index 8ebf2af9c..78df642e2 100644 --- a/core/examples/wasm.rs +++ b/core/examples/wasm.rs @@ -22,19 +22,19 @@ fn wasm_memory_unchecked(state: &mut OpState) -> &mut [u8] { unsafe { std::slice::from_raw_parts_mut(ptr, len) } } -#[op2] +#[op] #[buffer] fn op_get_wasm_module() -> Vec { include_bytes!("wasm.wasm").as_slice().to_vec() } -#[op2(fast)] +#[op(fast)] fn op_wasm(state: &mut OpState, #[memory(caller)] memory: Option<&mut [u8]>) { let memory = memory.unwrap_or_else(|| wasm_memory_unchecked(state)); memory[0] = 69; } -#[op2(fast)] +#[op(fast)] fn op_wasm_mem(memory: &v8::WasmMemoryObject) { // let memory = memory.unwrap_or_else(|| wasm_memory_unchecked(state)); // memory[0] = 69; @@ -50,7 +50,7 @@ fn op_wasm_mem(memory: &v8::WasmMemoryObject) { slice[0] = 68; } -#[op2] +#[op] fn op_set_wasm_mem( state: &mut OpState, #[global] memory: v8::Global, diff --git a/core/extensions.rs b/core/extensions.rs index 40270b4ce..f6e8e9891 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -191,7 +191,7 @@ impl OpDecl { /// For use by internal op implementation only. #[doc(hidden)] #[allow(clippy::too_many_arguments)] - pub const fn new_internal_op2( + pub const fn new_internal_op( name: (&'static str, FastStaticString), is_async: bool, is_reentrant: bool, diff --git a/core/lib.rs b/core/lib.rs index 31d6c896c..324fe5bbc 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -52,7 +52,7 @@ pub use sourcemap; pub use url; pub use v8; -pub use deno_ops::op2; +pub use deno_ops::op; pub use crate::async_cancel::CancelFuture; pub use crate::async_cancel::CancelHandle; @@ -165,7 +165,7 @@ pub use crate::source_map::SourceMapGetter; pub use crate::tasks::V8CrossThreadTaskSpawner; pub use crate::tasks::V8TaskSpawner; -// Ensure we can use op2 in deno_core without any hackery. +// Ensure we can use op in deno_core without any hackery. extern crate self as deno_core; pub fn v8_version() -> &'static str { diff --git a/core/modules/tests.rs b/core/modules/tests.rs index 9adf65fc6..cd936a815 100644 --- a/core/modules/tests.rs +++ b/core/modules/tests.rs @@ -30,7 +30,7 @@ use crate::ResolutionKind; use crate::RuntimeOptions; use anyhow::bail; use anyhow::Error; -use deno_ops::op2; +use deno_ops::op; use futures::future::poll_fn; use futures::future::FutureExt; use parking_lot::Mutex; @@ -388,7 +388,7 @@ fn test_mods() { let loader = Rc::new(TestingModuleLoader::new(NoopModuleLoader)); static DISPATCH_COUNT: AtomicUsize = AtomicUsize::new(0); - #[op2(fast)] + #[op(fast)] fn op_test(control: u8) -> u8 { DISPATCH_COUNT.fetch_add(1, Ordering::Relaxed); assert_eq!(control, 42); diff --git a/core/ops.rs b/core/ops.rs index f071e012d..f7a68cc74 100644 --- a/core/ops.rs +++ b/core/ops.rs @@ -51,7 +51,7 @@ pub fn reentrancy_check(decl: &'static OpDecl) -> Option { let current = CURRENT_OP.with(|f| f.get()); if let Some(current) = current { - panic!("op {} was not marked as #[op2(reentrant)], but re-entrantly invoked op {}", current.name, decl.name); + panic!("op {} was not marked as #[op(reentrant)], but re-entrantly invoked op {}", current.name, decl.name); } CURRENT_OP.with(|f| f.set(Some(decl))); Some(ReentrancyGuard {}) diff --git a/core/ops_builtin.rs b/core/ops_builtin.rs index e41079626..87cef9cd9 100644 --- a/core/ops_builtin.rs +++ b/core/ops_builtin.rs @@ -5,7 +5,7 @@ use crate::io::AdaptiveBufferStrategy; use crate::io::BufMutView; use crate::io::BufView; use crate::io::ResourceId; -use crate::op2; +use crate::op; use crate::ops_builtin_types; use crate::ops_builtin_v8; use crate::CancelHandle; @@ -129,7 +129,7 @@ builtin_ops! { ops_builtin_v8::op_leak_tracing_get } -#[op2(fast)] +#[op(fast)] pub fn op_panic(#[string] message: String) { #[allow(clippy::print_stderr)] { @@ -140,7 +140,7 @@ pub fn op_panic(#[string] message: String) { /// Return map of resources with id as key /// and string representation as value. -#[op2] +#[op] #[serde] pub fn op_resources(state: &mut OpState) -> Vec<(ResourceId, String)> { state @@ -150,42 +150,42 @@ pub fn op_resources(state: &mut OpState) -> Vec<(ResourceId, String)> { .collect() } -#[op2(fast)] +#[op(fast)] fn op_add(a: i32, b: i32) -> i32 { a + b } #[allow(clippy::unused_async)] -#[op2(async)] +#[op(async)] pub async fn op_add_async(a: i32, b: i32) -> i32 { a + b } -#[op2(fast)] +#[op(fast)] pub fn op_void_sync() {} #[allow(clippy::unused_async)] -#[op2(async)] +#[op(async)] pub async fn op_void_async() {} #[allow(clippy::unused_async)] -#[op2(async)] +#[op(async)] pub async fn op_error_async() -> Result<(), Error> { Err(Error::msg("error")) } #[allow(clippy::unused_async)] -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_error_async_deferred() -> Result<(), Error> { Err(Error::msg("error")) } #[allow(clippy::unused_async)] -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_void_async_deferred() {} /// Remove a resource from the resource table. -#[op2(fast)] +#[op(fast)] pub fn op_close( state: Rc>, #[smi] rid: ResourceId, @@ -197,7 +197,7 @@ pub fn op_close( /// Try to remove a resource from the resource table. If there is no resource /// with the specified `rid`, this is a no-op. -#[op2(fast)] +#[op(fast)] pub fn op_try_close(state: Rc>, #[smi] rid: ResourceId) { if let Ok(resource) = state.borrow_mut().resource_table.take_any(rid) { resource.close(); @@ -205,7 +205,7 @@ pub fn op_try_close(state: Rc>, #[smi] rid: ResourceId) { } /// Builtin utility to print to stdout/stderr -#[op2(fast)] +#[op(fast)] pub fn op_print(#[string] msg: &str, is_err: bool) -> Result<(), Error> { if is_err { stderr().write_all(msg.as_bytes())?; @@ -233,7 +233,7 @@ impl Resource for WasmStreamingResource { } /// Feed bytes to WasmStreamingResource. -#[op2(fast)] +#[op(fast)] pub fn op_wasm_streaming_feed( state: Rc>, #[smi] rid: ResourceId, @@ -249,7 +249,7 @@ pub fn op_wasm_streaming_feed( Ok(()) } -#[op2(fast)] +#[op(fast)] pub fn op_wasm_streaming_set_url( state: &mut OpState, #[smi] rid: ResourceId, @@ -263,7 +263,7 @@ pub fn op_wasm_streaming_set_url( Ok(()) } -#[op2(async)] +#[op(async)] async fn op_read( state: Rc>, #[smi] rid: ResourceId, @@ -274,7 +274,7 @@ async fn op_read( resource.read_byob(view).await.map(|(n, _)| n as u32) } -#[op2(async)] +#[op(async)] #[buffer] async fn op_read_all( state: Rc>, @@ -309,7 +309,7 @@ async fn op_read_all( Ok(buf.maybe_unwrap_bytes().unwrap()) } -#[op2(async)] +#[op(async)] async fn op_write( state: Rc>, #[smi] rid: ResourceId, @@ -321,7 +321,7 @@ async fn op_write( Ok(resp.nwritten() as u32) } -#[op2(fast)] +#[op(fast)] fn op_read_sync( state: Rc>, #[smi] rid: ResourceId, @@ -331,7 +331,7 @@ fn op_read_sync( resource.read_byob_sync(data).map(|n| n as u32) } -#[op2(fast)] +#[op(fast)] fn op_write_sync( state: Rc>, #[smi] rid: ResourceId, @@ -342,7 +342,7 @@ fn op_write_sync( Ok(nwritten as u32) } -#[op2(async)] +#[op(async)] async fn op_write_all( state: Rc>, #[smi] rid: ResourceId, @@ -354,7 +354,7 @@ async fn op_write_all( Ok(()) } -#[op2(async)] +#[op(async)] async fn op_write_type_error( state: Rc>, #[smi] rid: ResourceId, @@ -365,7 +365,7 @@ async fn op_write_type_error( Ok(()) } -#[op2(async)] +#[op(async)] async fn op_shutdown( state: Rc>, #[smi] rid: ResourceId, @@ -374,13 +374,13 @@ async fn op_shutdown( resource.shutdown().await } -#[op2] +#[op] #[string] fn op_format_file_name(#[string] file_name: &str) -> String { format_file_name(file_name) } -#[op2] +#[op] fn op_str_byte_length( scope: &mut v8::HandleScope, value: v8::Local, @@ -393,19 +393,19 @@ fn op_str_byte_length( } /// Creates a [`CancelHandle`] resource that can be used to cancel invocations of certain ops. -#[op2(fast)] +#[op(fast)] #[smi] pub fn op_cancel_handle(state: &mut OpState) -> u32 { state.resource_table.add(CancelHandle::new()) } -#[op2] +#[op] #[serde] fn op_encode_binary_string(#[buffer] s: &[u8]) -> ByteString { ByteString::from(s) } -#[op2(fast)] +#[op(fast)] fn op_is_terminal( state: &mut OpState, #[smi] rid: ResourceId, diff --git a/core/ops_builtin_types.rs b/core/ops_builtin_types.rs index 1abdb43d9..db7afb22e 100644 --- a/core/ops_builtin_types.rs +++ b/core/ops_builtin_types.rs @@ -1,42 +1,42 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::op2; +use crate::op; -#[op2(fast)] +#[op(fast)] pub fn op_is_any_array_buffer(value: &v8::Value) -> bool { value.is_array_buffer() || value.is_shared_array_buffer() } -#[op2(fast)] +#[op(fast)] pub fn op_is_arguments_object(value: &v8::Value) -> bool { value.is_arguments_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_array_buffer(value: &v8::Value) -> bool { value.is_array_buffer() } -#[op2(fast)] +#[op(fast)] pub fn op_is_array_buffer_view(value: &v8::Value) -> bool { value.is_array_buffer_view() } -#[op2(fast)] +#[op(fast)] pub fn op_is_async_function(value: &v8::Value) -> bool { value.is_async_function() } -#[op2(fast)] +#[op(fast)] pub fn op_is_big_int_object(value: &v8::Value) -> bool { value.is_big_int_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_boolean_object(value: &v8::Value) -> bool { value.is_boolean_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_boxed_primitive(value: &v8::Value) -> bool { value.is_boolean_object() || value.is_string_object() @@ -45,102 +45,102 @@ pub fn op_is_boxed_primitive(value: &v8::Value) -> bool { || value.is_big_int_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_data_view(value: &v8::Value) -> bool { value.is_data_view() } -#[op2(fast)] +#[op(fast)] pub fn op_is_date(value: &v8::Value) -> bool { value.is_date() } -#[op2(fast)] +#[op(fast)] pub fn op_is_generator_function(value: &v8::Value) -> bool { value.is_generator_function() } -#[op2(fast)] +#[op(fast)] pub fn op_is_generator_object(value: &v8::Value) -> bool { value.is_generator_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_map(value: &v8::Value) -> bool { value.is_map() } -#[op2(fast)] +#[op(fast)] pub fn op_is_map_iterator(value: &v8::Value) -> bool { value.is_map_iterator() } -#[op2(fast)] +#[op(fast)] pub fn op_is_module_namespace_object(value: &v8::Value) -> bool { value.is_module_namespace_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_native_error(value: &v8::Value) -> bool { value.is_native_error() } -#[op2(fast)] +#[op(fast)] pub fn op_is_number_object(value: &v8::Value) -> bool { value.is_number_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_promise(value: &v8::Value) -> bool { value.is_promise() } -#[op2(fast)] +#[op(fast)] pub fn op_is_proxy(value: &v8::Value) -> bool { value.is_proxy() } -#[op2(fast)] +#[op(fast)] pub fn op_is_reg_exp(value: &v8::Value) -> bool { value.is_reg_exp() } -#[op2(fast)] +#[op(fast)] pub fn op_is_set(value: &v8::Value) -> bool { value.is_set() } -#[op2(fast)] +#[op(fast)] pub fn op_is_set_iterator(value: &v8::Value) -> bool { value.is_set_iterator() } -#[op2(fast)] +#[op(fast)] pub fn op_is_shared_array_buffer(value: &v8::Value) -> bool { value.is_shared_array_buffer() } -#[op2(fast)] +#[op(fast)] pub fn op_is_string_object(value: &v8::Value) -> bool { value.is_string_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_symbol_object(value: &v8::Value) -> bool { value.is_symbol_object() } -#[op2(fast)] +#[op(fast)] pub fn op_is_typed_array(value: &v8::Value) -> bool { value.is_typed_array() } -#[op2(fast)] +#[op(fast)] pub fn op_is_weak_map(value: &v8::Value) -> bool { value.is_weak_map() } -#[op2(fast)] +#[op(fast)] pub fn op_is_weak_set(value: &v8::Value) -> bool { value.is_weak_set() } diff --git a/core/ops_builtin_v8.rs b/core/ops_builtin_v8.rs index e02fe131e..42a218780 100644 --- a/core/ops_builtin_v8.rs +++ b/core/ops_builtin_v8.rs @@ -5,7 +5,7 @@ use crate::error::is_instance_of_error; use crate::error::range_error; use crate::error::type_error; use crate::error::JsError; -use crate::op2; +use crate::op; use crate::ops_builtin::WasmStreamingResource; use crate::resolve_url; use crate::runtime::script_origin; @@ -24,7 +24,7 @@ use std::rc::Rc; use v8::ValueDeserializerHelper; use v8::ValueSerializerHelper; -#[op2] +#[op] pub fn op_add_main_module_handler( scope: &mut v8::HandleScope, #[global] f: v8::Global, @@ -36,7 +36,7 @@ pub fn op_add_main_module_handler( .push(f); } -#[op2] +#[op] pub fn op_set_handled_promise_rejection_handler( scope: &mut v8::HandleScope, #[global] f: Option>, @@ -45,25 +45,25 @@ pub fn op_set_handled_promise_rejection_handler( *exception_state.js_handled_promise_rejection_cb.borrow_mut() = f; } -#[op2] +#[op] pub fn op_ref_op(scope: &mut v8::HandleScope, promise_id: i32) { let context_state = JsRealm::state_from_scope(scope); context_state.unrefed_ops.borrow_mut().remove(&promise_id); } -#[op2] +#[op] pub fn op_unref_op(scope: &mut v8::HandleScope, promise_id: i32) { let context_state = JsRealm::state_from_scope(scope); context_state.unrefed_ops.borrow_mut().insert(promise_id); } -#[op2] +#[op] pub fn op_leak_tracing_enable(scope: &mut v8::HandleScope, enabled: bool) { let context_state = JsRealm::state_from_scope(scope); context_state.activity_traces.set_enabled(enabled); } -#[op2] +#[op] pub fn op_leak_tracing_submit( scope: &mut v8::HandleScope, #[smi] kind: u8, @@ -78,7 +78,7 @@ pub fn op_leak_tracing_submit( ); } -#[op2] +#[op] pub fn op_leak_tracing_get_all<'s>( scope: &mut v8::HandleScope<'s>, ) -> v8::Local<'s, v8::Value> { @@ -97,7 +97,7 @@ pub fn op_leak_tracing_get_all<'s>( out.into() } -#[op2] +#[op] pub fn op_leak_tracing_get<'s>( scope: &mut v8::HandleScope<'s>, #[smi] kind: u8, @@ -121,7 +121,7 @@ pub fn op_leak_tracing_get<'s>( /// Queue a timer. We return a "large integer" timer ID in an f64 which allows for up /// to `MAX_SAFE_INTEGER` (2^53) timers to exist, versus 2^32 timers if we used /// `u32`. -#[op2] +#[op] pub fn op_timer_queue( scope: &mut v8::HandleScope, depth: u32, @@ -144,7 +144,7 @@ pub fn op_timer_queue( /// Queue a timer. We return a "large integer" timer ID in an f64 which allows for up /// to `MAX_SAFE_INTEGER` (2^53) timers to exist, versus 2^32 timers if we used /// `u32`. -#[op2] +#[op] pub fn op_timer_queue_system( scope: &mut v8::HandleScope, repeat: bool, @@ -160,7 +160,7 @@ pub fn op_timer_queue_system( /// Queue a timer. We return a "large integer" timer ID in an f64 which allows for up /// to `MAX_SAFE_INTEGER` (2^53) timers to exist, versus 2^32 timers if we used /// `u32`. -#[op2] +#[op] pub fn op_timer_queue_immediate( scope: &mut v8::HandleScope, #[global] task: v8::Global, @@ -169,7 +169,7 @@ pub fn op_timer_queue_immediate( context_state.timers.queue_timer(0, (task, 0)) as _ } -#[op2] +#[op] pub fn op_timer_cancel(scope: &mut v8::HandleScope, id: f64) { let context_state = JsRealm::state_from_scope(scope); context_state.timers.cancel_timer(id as _); @@ -178,19 +178,19 @@ pub fn op_timer_cancel(scope: &mut v8::HandleScope, id: f64) { .complete(RuntimeActivityType::Timer, id as _); } -#[op2] +#[op] pub fn op_timer_ref(scope: &mut v8::HandleScope, id: f64) { let context_state = JsRealm::state_from_scope(scope); context_state.timers.ref_timer(id as _); } -#[op2] +#[op] pub fn op_timer_unref(scope: &mut v8::HandleScope, id: f64) { let context_state = JsRealm::state_from_scope(scope); context_state.timers.unref_timer(id as _); } -#[op2(reentrant)] +#[op(reentrant)] #[global] pub fn op_lazy_load_esm( scope: &mut v8::HandleScope, @@ -202,7 +202,7 @@ pub fn op_lazy_load_esm( // We run in a `nofast` op here so we don't get put into a `DisallowJavascriptExecutionScope` and we're // allowed to touch JS heap. -#[op2(nofast)] +#[op(nofast)] pub fn op_queue_microtask( isolate: *mut v8::Isolate, cb: v8::Local, @@ -215,7 +215,7 @@ pub fn op_queue_microtask( // We run in a `nofast` op here so we don't get put into a `DisallowJavascriptExecutionScope` and we're // allowed to touch JS heap. -#[op2(nofast, reentrant)] +#[op(nofast, reentrant)] pub fn op_run_microtasks(isolate: *mut v8::Isolate) { // SAFETY: we know v8 provides us with a valid, non-null isolate unsafe { @@ -226,14 +226,14 @@ pub fn op_run_microtasks(isolate: *mut v8::Isolate) { }; } -#[op2] +#[op] pub fn op_has_tick_scheduled(scope: &mut v8::HandleScope) -> bool { JsRealm::state_from_scope(scope) .has_next_tick_scheduled .get() } -#[op2] +#[op] pub fn op_set_has_tick_scheduled(scope: &mut v8::HandleScope, v: bool) { JsRealm::state_from_scope(scope) .has_next_tick_scheduled @@ -258,7 +258,7 @@ impl<'s> EvalContextError<'s> { } } -#[op2(reentrant)] +#[op(reentrant)] pub fn op_eval_context<'a>( scope: &mut v8::HandleScope<'a>, source: v8::Local<'a, v8::Value>, @@ -359,7 +359,7 @@ pub fn op_eval_context<'a>( } } -#[op2] +#[op] pub fn op_encode<'a>( scope: &mut v8::HandleScope<'a>, text: v8::Local<'a, v8::Value>, @@ -376,7 +376,7 @@ pub fn op_encode<'a>( Ok(u8array) } -#[op2] +#[op] pub fn op_decode<'a>( scope: &mut v8::HandleScope<'a>, #[buffer] zero_copy: &[u8], @@ -572,7 +572,7 @@ impl<'a> v8::ValueDeserializerImpl for SerializeDeserialize<'a> { } // May be reentrant in the case of errors. -#[op2(reentrant)] +#[op(reentrant)] #[buffer] pub fn op_serialize( scope: &mut v8::HandleScope, @@ -665,7 +665,7 @@ pub fn op_serialize( } } -#[op2] +#[op] pub fn op_deserialize<'a>( scope: &mut v8::HandleScope<'a>, #[buffer] zero_copy: JsBuffer, @@ -738,7 +738,7 @@ pub fn op_deserialize<'a>( } } -#[op2] +#[op] pub fn op_get_promise_details<'a>( scope: &mut v8::HandleScope<'a>, promise: v8::Local<'a, v8::Promise>, @@ -763,7 +763,7 @@ pub fn op_get_promise_details<'a>( out.into() } -#[op2] +#[op] pub fn op_set_promise_hooks( scope: &mut v8::HandleScope, init_hook: v8::Local, @@ -814,7 +814,7 @@ pub fn op_set_promise_hooks( // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#[op2] +#[op] pub fn op_get_proxy_details<'a>( scope: &mut v8::HandleScope<'a>, proxy: v8::Local<'a, v8::Value>, @@ -830,7 +830,7 @@ pub fn op_get_proxy_details<'a>( out_array.into() } -#[op2] +#[op] pub fn op_get_non_index_property_names<'a>( scope: &mut v8::HandleScope<'a>, obj: v8::Local<'a, v8::Value>, @@ -871,7 +871,7 @@ pub fn op_get_non_index_property_names<'a>( maybe_names.map(|names| names.into()) } -#[op2] +#[op] #[string] pub fn op_get_constructor_name( scope: &mut v8::HandleScope, @@ -899,7 +899,7 @@ pub struct MemoryUsage { // array_buffers: usize, } -#[op2] +#[op] #[serde] pub fn op_memory_usage(scope: &mut v8::HandleScope) -> MemoryUsage { let mut s = v8::HeapStatistics::default(); @@ -912,7 +912,7 @@ pub fn op_memory_usage(scope: &mut v8::HandleScope) -> MemoryUsage { } } -#[op2] +#[op] pub fn op_set_wasm_streaming_callback( scope: &mut v8::HandleScope, #[global] cb: v8::Global, @@ -956,7 +956,7 @@ pub fn op_set_wasm_streaming_callback( // This op is re-entrant as it makes a v8 call. It also cannot be fast because // we require a JS execution scope. #[allow(clippy::let_and_return)] -#[op2(nofast, reentrant)] +#[op(nofast, reentrant)] pub fn op_abort_wasm_streaming( state: Rc>, rid: u32, @@ -980,7 +980,7 @@ pub fn op_abort_wasm_streaming( } // This op calls `op_apply_source_map` re-entrantly. -#[op2(reentrant)] +#[op(reentrant)] #[serde] pub fn op_destructure_error( scope: &mut v8::HandleScope, @@ -992,7 +992,7 @@ pub fn op_destructure_error( /// Effectively throw an uncatchable error. This will terminate runtime /// execution before any more JS code can run, except in the REPL where it /// should just output the error to the console. -#[op2(reentrant)] +#[op(reentrant)] pub fn op_dispatch_exception( scope: &mut v8::HandleScope, exception: v8::Local, @@ -1012,7 +1012,7 @@ pub fn op_dispatch_exception( scope.terminate_execution(); } -#[op2] +#[op] #[serde] pub fn op_op_names(scope: &mut v8::HandleScope) -> Vec { let state = JsRealm::state_from_scope(scope); @@ -1047,7 +1047,7 @@ fn write_line_and_col_to_ret_buf( // 2: mapped line, column, and file name. new line, column, and file name are in // ret_buf. retrieve file name by calling `op_apply_source_map_filename` // immediately after this op returns. -#[op2(fast)] +#[op(fast)] #[smi] pub fn op_apply_source_map( state: &JsRuntimeState, @@ -1085,7 +1085,7 @@ pub fn op_apply_source_map( // Call to retrieve the stashed file name from a previous call to // `op_apply_source_map` that returned `2`. -#[op2] +#[op] #[string] pub fn op_apply_source_map_filename( state: &JsRuntimeState, @@ -1098,7 +1098,7 @@ pub fn op_apply_source_map_filename( .ok_or_else(|| type_error("No stashed file name")) } -#[op2] +#[op] pub fn op_set_call_site_evals( scope: &mut v8::HandleScope, exception: v8::Local, @@ -1108,7 +1108,7 @@ pub fn op_set_call_site_evals( assert!(exception.set_private(scope, key, value).unwrap()) } -#[op2] +#[op] #[string] pub fn op_current_user_call_site( scope: &mut v8::HandleScope, @@ -1169,7 +1169,7 @@ pub fn op_current_user_call_site( /// `JsError::exception_message`. The callback is passed the error value and /// should return a string or `null`. If no callback is set or the callback /// returns `null`, the built-in default formatting will be used. -#[op2] +#[op] pub fn op_set_format_exception_callback<'a>( scope: &mut v8::HandleScope<'a>, #[global] cb: v8::Global, @@ -1184,7 +1184,7 @@ pub fn op_set_format_exception_callback<'a>( old.map(|func| func.into()) } -#[op2] +#[op] pub fn op_event_loop_has_more_work(scope: &mut v8::HandleScope) -> bool { JsRuntime::has_more_work(scope) } diff --git a/core/runtime/ops.rs b/core/runtime/ops.rs index fc5d1daa5..91ddd16bc 100644 --- a/core/runtime/ops.rs +++ b/core/runtime/ops.rs @@ -522,7 +522,7 @@ mod tests { use crate::error::JsError; use crate::external; use crate::external::ExternalPointer; - use crate::op2; + use crate::op; use crate::runtime::JsRuntimeState; use crate::FromV8; use crate::GarbageCollected; @@ -654,12 +654,12 @@ mod tests { static FAIL: Cell = const { Cell::new(false) } } - #[op2(fast)] + #[op(fast)] pub fn op_test_fail() { FAIL.with(|b| b.set(true)) } - #[op2(fast)] + #[op(fast)] pub fn op_test_print_debug(#[string] s: &str) { println!("{s}") } @@ -771,7 +771,7 @@ mod tests { assert!(run_test2(1, "", "assert(false)").is_err()); } - #[op2(fast)] + #[op(fast)] pub fn op_test_add(a: u32, b: i32) -> u32 { (a as i32 + b) as u32 } @@ -814,7 +814,7 @@ mod tests { // Note: #[smi] parameters are signed in JS regardless of the sign in Rust. Overflow and underflow // of valid ranges result in automatic wrapping. - #[op2(fast)] + #[op(fast)] #[smi] pub fn op_test_add_smi_unsigned(#[smi] a: u32, #[smi] b: u16) -> u32 { a + b as u32 @@ -836,7 +836,7 @@ mod tests { Ok(()) } - #[op2] + #[op] pub fn op_test_add_option(a: u32, b: Option) -> u32 { a + b.unwrap_or(100) } @@ -861,7 +861,7 @@ mod tests { static RETURN_COUNT: Cell = const { Cell::new(0) }; } - #[op2(fast)] + #[op(fast)] pub fn op_test_result_void_switch() -> Result<(), AnyError> { let count = RETURN_COUNT.with(|count| { let new = count.get() + 1; @@ -875,12 +875,12 @@ mod tests { } } - #[op2(fast)] + #[op(fast)] pub fn op_test_result_void_err() -> Result<(), AnyError> { Err(generic_error("failed!!!")) } - #[op2(fast)] + #[op(fast)] pub fn op_test_result_void_ok() -> Result<(), AnyError> { Ok(()) } @@ -917,12 +917,12 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_test_result_primitive_err() -> Result { Err(generic_error("failed!!!")) } - #[op2(fast)] + #[op(fast)] pub fn op_test_result_primitive_ok() -> Result { Ok(123) } @@ -943,12 +943,12 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_test_bool(b: bool) -> bool { b } - #[op2(fast)] + #[op(fast)] pub fn op_test_bool_result(b: bool) -> Result { if b { Ok(true) @@ -977,12 +977,12 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_test_float(a: f32, b: f64) -> f32 { a + b as f32 } - #[op2(fast)] + #[op(fast)] pub fn op_test_float_result(a: f32, b: f64) -> Result { let a = a as f64; if a + b >= 0. { @@ -1012,19 +1012,19 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] #[bigint] pub fn op_test_bigint_u64(#[bigint] input: u64) -> u64 { input } - #[op2(fast)] + #[op(fast)] #[bigint] pub fn op_test_bigint_i64(#[bigint] input: i64) -> i64 { input } - #[op2(fast)] + #[op(fast)] #[number] pub fn op_test_bigint_i64_as_number(#[number] input: i64) -> i64 { input @@ -1060,27 +1060,27 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_test_string_owned(#[string] s: String) -> u32 { s.len() as _ } - #[op2(fast)] + #[op(fast)] pub fn op_test_string_ref(#[string] s: &str) -> u32 { s.len() as _ } - #[op2(fast)] + #[op(fast)] pub fn op_test_string_cow(#[string] s: Cow) -> u32 { s.len() as _ } - #[op2(fast)] + #[op(fast)] pub fn op_test_string_roundtrip_char(#[string] s: Cow) -> u32 { s.chars().next().unwrap() as u32 } - #[op2(fast)] + #[op(fast)] pub fn op_test_string_roundtrip_char_onebyte( #[string(onebyte)] s: Cow<[u8]>, ) -> u32 { @@ -1158,7 +1158,7 @@ mod tests { Ok(()) } - #[op2] + #[op] #[string] pub fn op_test_string_return( #[string] a: Cow, @@ -1167,7 +1167,7 @@ mod tests { (a + b).to_string() } - #[op2] + #[op] #[string] pub fn op_test_string_option_return( #[string] a: Cow, @@ -1179,13 +1179,13 @@ mod tests { Some((a + b).to_string()) } - #[op2] + #[op] #[string] pub fn op_test_string_roundtrip(#[string] s: String) -> String { s } - #[op2] + #[op] #[string(onebyte)] pub fn op_test_string_roundtrip_onebyte( #[string(onebyte)] s: Cow<[u8]>, @@ -1225,12 +1225,12 @@ mod tests { } // We don't actually test this one -- we just want it to compile - #[op2(fast)] + #[op(fast)] pub fn op_test_generics() {} /// Tests v8 types without a handle scope #[allow(clippy::needless_lifetimes)] - #[op2(fast)] + #[op(fast)] pub fn op_test_v8_types<'s>( s: &v8::String, s2: v8::Local, @@ -1245,7 +1245,7 @@ mod tests { } } - #[op2(fast)] + #[op(fast)] pub fn op_test_v8_option_string(s: Option<&v8::String>) -> i32 { if let Some(s) = s { s.length() as i32 @@ -1255,7 +1255,7 @@ mod tests { } /// Tests v8 types without a handle scope - #[op2] + #[op] #[allow(clippy::needless_lifetimes)] pub fn op_test_v8_type_return<'s>( s: v8::Local<'s, v8::String>, @@ -1264,7 +1264,7 @@ mod tests { } /// Tests v8 types without a handle scope - #[op2] + #[op] #[allow(clippy::needless_lifetimes)] pub fn op_test_v8_type_return_option<'s>( s: Option>, @@ -1272,7 +1272,7 @@ mod tests { s } - #[op2] + #[op] pub fn op_test_v8_type_handle_scope<'s>( scope: &mut v8::HandleScope<'s>, s: &v8::String, @@ -1282,7 +1282,7 @@ mod tests { } /// Extract whatever lives in "key" from the object. - #[op2] + #[op] pub fn op_test_v8_type_handle_scope_obj<'s>( scope: &mut v8::HandleScope<'s>, o: &v8::Object, @@ -1292,7 +1292,7 @@ mod tests { } /// Extract whatever lives in "key" from the object. - #[op2] + #[op] pub fn op_test_v8_type_handle_scope_result<'s>( scope: &mut v8::HandleScope<'s>, o: &v8::Object, @@ -1350,7 +1350,7 @@ mod tests { Ok(()) } - #[op2] + #[op] pub fn op_test_v8_global( scope: &mut v8::HandleScope, #[global] s: v8::Global, @@ -1374,7 +1374,7 @@ mod tests { pub s: String, } - #[op2] + #[op] #[serde] pub fn op_test_serde_v8(#[serde] mut serde: Serde) -> Serde { serde.s += "!"; @@ -1396,7 +1396,7 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_jsruntimestate(_state: &JsRuntimeState) {} #[tokio::test] @@ -1405,32 +1405,32 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_state_rc(state: Rc>, value: u32) -> u32 { let old_value: u32 = state.borrow_mut().take(); state.borrow_mut().put(value); old_value } - #[op2(fast)] + #[op(fast)] pub fn op_state_ref(state: &OpState) -> u32 { let old_value: &u32 = state.borrow(); *old_value } - #[op2(fast)] + #[op(fast)] pub fn op_state_mut(state: &mut OpState, value: u32) { *state.borrow_mut() = value; } - #[op2(fast)] + #[op(fast)] pub fn op_state_mut_attr(#[state] value: &mut u32, new_value: u32) -> u32 { let old_value = *value; *value = new_value; old_value } - #[op2(fast)] + #[op(fast)] pub fn op_state_multi_attr( #[state] value32: &u32, #[state] value16: &u16, @@ -1466,7 +1466,7 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_buffer_slice( #[buffer] input: &[u8], #[number] inlen: usize, @@ -1480,7 +1480,7 @@ mod tests { } } - #[op2(fast)] + #[op(fast)] pub fn op_buffer_ptr( #[buffer] input: *const u8, #[number] inlen: usize, @@ -1493,7 +1493,7 @@ mod tests { } } - #[op2(fast)] + #[op(fast)] pub fn op_buffer_slice_32( #[buffer] input: &[u32], #[number] inlen: usize, @@ -1507,7 +1507,7 @@ mod tests { } } - #[op2(fast)] + #[op(fast)] pub fn op_buffer_ptr_32( #[buffer] input: *const u32, #[number] inlen: usize, @@ -1520,7 +1520,7 @@ mod tests { } } - #[op2(fast)] + #[op(fast)] pub fn op_buffer_slice_f64( #[buffer] input: &[f64], #[number] inlen: usize, @@ -1534,7 +1534,7 @@ mod tests { } } - #[op2(fast)] + #[op(fast)] pub fn op_buffer_ptr_f64( #[buffer] input: *const f64, #[number] inlen: usize, @@ -1640,7 +1640,7 @@ mod tests { Ok(()) } - #[op2] + #[op] pub fn op_buffer_jsbuffer( #[buffer] input: JsBuffer, #[number] inlen: usize, @@ -1671,7 +1671,7 @@ mod tests { Ok(()) } - #[op2] + #[op] pub fn op_buffer_any(#[anybuffer] buffer: &[u8]) -> u32 { let mut sum: u32 = 0; for i in buffer { @@ -1725,7 +1725,7 @@ mod tests { Ok(()) } - #[op2] + #[op] pub fn op_buffer_any_length(#[anybuffer] buffer: &[u8]) -> u32 { buffer.len() as _ } @@ -1776,7 +1776,7 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] pub fn op_arraybuffer_slice( #[arraybuffer] input: &[u8], #[number] inlen: usize, @@ -1812,7 +1812,7 @@ mod tests { } // TODO(mmastrac): This is a dangerous op that we'll use to test resizable buffers in a later pass. - #[op2] + #[op] pub fn op_buffer_slice_unsafe_callback( scope: &mut v8::HandleScope, buffer: v8::Local, @@ -1842,7 +1842,7 @@ mod tests { /// Ensures that three copies are independent. Note that we cannot mutate the /// `bytes::Bytes`. - #[op2(fast)] + #[op(fast)] #[allow(clippy::boxed_local)] // Clippy bug? It warns about input2 pub fn op_buffer_copy( #[buffer(copy)] mut input1: Vec, @@ -1873,7 +1873,7 @@ mod tests { Ok(()) } - #[op2] + #[op] #[buffer] pub fn op_buffer_bytesmut() -> BytesMut { let mut buffer = BytesMut::new(); @@ -1900,13 +1900,13 @@ mod tests { impl GarbageCollected for TestResource {} - #[op2] + #[op] #[cppgc] pub fn op_test_make_cppgc_resource() -> TestResource { TestResource { value: 42 } } - #[op2] + #[op] #[cppgc] pub fn op_test_make_cppgc_resource_option( create: bool, @@ -1918,7 +1918,7 @@ mod tests { } } - #[op2(async)] + #[op(async)] #[smi] pub async fn op_test_get_cppgc_resource( #[cppgc] resource: &TestResource, @@ -1927,7 +1927,7 @@ mod tests { resource.value } - #[op2(fast)] + #[op(fast)] #[smi] pub fn op_test_get_cppgc_resource_option( #[cppgc] resource: Option<&TestResource>, @@ -1960,12 +1960,12 @@ mod tests { static STRING: &str = "hello world"; - #[op2(fast)] + #[op(fast)] fn op_external_make() -> *const std::ffi::c_void { STRING.as_ptr() as _ } - #[op2(fast)] + #[op(fast)] fn op_external_process( input: *const std::ffi::c_void, ) -> *const std::ffi::c_void { @@ -1983,12 +1983,12 @@ mod tests { Ok(()) } - #[op2(fast)] + #[op(fast)] fn op_external_make_ptr(#[bigint] value: u64) -> *const std::ffi::c_void { value as _ } - #[op2(fast)] + #[op(fast)] fn op_external_process_ptr( input: *const std::ffi::c_void, #[number] offset: isize, @@ -2016,19 +2016,19 @@ mod tests { external!(ExternalObject, "test external object"); - #[op2(fast)] + #[op(fast)] fn op_typed_external() -> *const std::ffi::c_void { // This operation is safe because we know ExternalPointer::new(ExternalObject(RefCell::new(42))).into_raw() } - #[op2(fast)] + #[op(fast)] fn op_typed_external_process(ptr: *const std::ffi::c_void) { let ptr = ExternalPointer::::from_raw(ptr); *(unsafe { ptr.unsafely_deref() }.0.borrow_mut()) += 1; } - #[op2(fast)] + #[op(fast)] fn op_typed_external_take(ptr: *const std::ffi::c_void) -> u32 { let ptr = ExternalPointer::::from_raw(ptr); *unsafe { ptr.unsafely_take() }.0.borrow() @@ -2044,13 +2044,13 @@ mod tests { Ok(()) } - #[op2(nofast)] + #[op(nofast)] fn op_isolate_run_microtasks(isolate: *mut v8::Isolate) { // SAFETY: testing unsafe { isolate.as_mut().unwrap().perform_microtask_checkpoint() }; } - #[op2(nofast)] + #[op(nofast)] fn op_isolate_queue_microtask( isolate: *mut v8::Isolate, cb: v8::Local, @@ -2069,7 +2069,7 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] async fn op_async_void() {} #[tokio::test] @@ -2079,19 +2079,19 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] async fn op_async_number(x: u32) -> u32 { x } - #[op2(async)] + #[op(async)] async fn op_async_add(x: u32, y: u32) -> u32 { x.wrapping_add(y) } // Note: #[smi] parameters are signed in JS regardless of the sign in Rust. Overflow and underflow // of valid ranges result in automatic wrapping. - #[op2(async)] + #[op(async)] #[smi] async fn op_async_add_smi(#[smi] x: u32, #[smi] y: u32) -> u32 { tokio::time::sleep(Duration::from_millis(10)).await; @@ -2128,12 +2128,12 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] async fn op_async_sleep() { tokio::time::sleep(Duration::from_millis(500)).await } - #[op2(async)] + #[op(async)] fn op_async_sleep_impl() -> impl Future { tokio::time::sleep(Duration::from_millis(500)) } @@ -2146,7 +2146,7 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] pub async fn op_async_sleep_error() -> Result<(), Error> { tokio::time::sleep(Duration::from_millis(500)).await; bail!("whoops") @@ -2164,12 +2164,12 @@ mod tests { Ok(()) } - #[op2(async(deferred), fast)] + #[op(async(deferred), fast)] pub async fn op_async_deferred_success() -> Result { Ok(42) } - #[op2(async(deferred), fast)] + #[op(async(deferred), fast)] pub async fn op_async_deferred_error() -> Result<(), Error> { bail!("whoops") } @@ -2192,12 +2192,12 @@ mod tests { Ok(()) } - #[op2(async(lazy), fast)] + #[op(async(lazy), fast)] pub async fn op_async_lazy_success() -> Result { Ok(42) } - #[op2(async(lazy), fast)] + #[op(async(lazy), fast)] pub async fn op_async_lazy_error() -> Result<(), Error> { bail!("whoops") } @@ -2221,7 +2221,7 @@ mod tests { /// Test exits from the three possible routes -- before future, future immediate, /// future polled failed, future polled success. - #[op2(async)] + #[op(async)] pub fn op_async_result_impl( mode: u8, ) -> Result>, Error> { @@ -2260,7 +2260,7 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] pub async fn op_async_state_rc( state: Rc>, value: u32, @@ -2280,13 +2280,13 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] #[buffer] async fn op_async_buffer(#[buffer] input: JsBuffer) -> JsBuffer { input } - #[op2(async)] + #[op(async)] #[buffer] async fn op_async_buffer_vec(#[buffer] input: JsBuffer) -> Vec { let mut output = input.to_vec(); @@ -2294,7 +2294,7 @@ mod tests { output } - #[op2(async)] + #[op(async)] fn op_async_buffer_impl(#[buffer] input: &[u8]) -> impl Future { let l = input.len(); async move { l as _ } @@ -2324,7 +2324,7 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] async fn op_async_external( input: *const std::ffi::c_void, ) -> *const std::ffi::c_void { @@ -2344,7 +2344,7 @@ mod tests { Ok(()) } - #[op2(async)] + #[op(async)] #[serde] pub async fn op_async_serde_option_v8( #[serde] mut serde: Serde, @@ -2365,7 +2365,7 @@ mod tests { Ok(()) } - #[op2] + #[op] #[to_v8] pub fn op_smi_to_from_v8(#[from_v8] value: Smi) -> Smi { value @@ -2385,7 +2385,7 @@ mod tests { Ok(()) } - #[op2] + #[op] #[to_v8] pub fn op_number_to_from_v8(#[from_v8] value: Number) -> Number { value @@ -2444,7 +2444,7 @@ mod tests { } } - #[op2] + #[op] #[to_v8] fn op_bool_to_from_v8(#[from_v8] value: Bool) -> Bool { value diff --git a/core/runtime/ops_rust_to_v8.rs b/core/runtime/ops_rust_to_v8.rs index 4489bb141..d90aab9cb 100644 --- a/core/runtime/ops_rust_to_v8.rs +++ b/core/runtime/ops_rust_to_v8.rs @@ -17,10 +17,10 @@ //! the `set(v8::Local)` function) is not possible. Moreover, converting a Rust string to a `v8::String` //! might fail, particularly if its size surpasses v8's limitations. //! -//! The `#[op2]` proc macro maps the distinct calling patterns to the appropriate trait interfaces. +//! The `#[op]` proc macro maps the distinct calling patterns to the appropriate trait interfaces. //! This mapping accounts for conversion nature and potential error occurrences. When a conversion is inherently -//! expected to succeed, `#[op2]` negates the necessity for explicit error checks, potentially boosting execution -//! efficiency. Furthermore, `#[op2]` strives to leverage `v8::ReturnValue` setters when possible, eliminating +//! expected to succeed, `#[op]` negates the necessity for explicit error checks, potentially boosting execution +//! efficiency. Furthermore, `#[op]` strives to leverage `v8::ReturnValue` setters when possible, eliminating //! the need for explicit object handle allocation. This optimization can favorably impact performance and //! memory management. diff --git a/core/runtime/tests/error.rs b/core/runtime/tests/error.rs index 82ae74f6b..54ba566dc 100644 --- a/core/runtime/tests/error.rs +++ b/core/runtime/tests/error.rs @@ -1,7 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use crate::error::custom_error; use crate::error::JsError; -use crate::op2; +use crate::op; use crate::JsRuntime; use crate::RuntimeOptions; use anyhow::Error; @@ -10,7 +10,7 @@ use std::task::Poll; #[tokio::test] async fn test_error_builder() { - #[op2(fast)] + #[op(fast)] fn op_err() -> Result<(), Error> { Err(custom_error("DOMExceptionOperationError", "abc")) } diff --git a/core/runtime/tests/jsrealm.rs b/core/runtime/tests/jsrealm.rs index f77aa1290..56102fea6 100644 --- a/core/runtime/tests/jsrealm.rs +++ b/core/runtime/tests/jsrealm.rs @@ -1,7 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use crate::error; use crate::modules::StaticModuleLoader; -use crate::op2; +use crate::op; use crate::JsRuntime; use crate::JsRuntimeForSnapshot; use crate::RuntimeOptions; @@ -75,7 +75,7 @@ fn test_set_format_exception_callback_realms() { #[tokio::test] async fn js_realm_ref_unref_ops() { // Never resolves. - #[op2(async)] + #[op(async)] async fn op_pending() { futures::future::pending().await } diff --git a/core/runtime/tests/misc.rs b/core/runtime/tests/misc.rs index 6fd9e5231..64282b494 100644 --- a/core/runtime/tests/misc.rs +++ b/core/runtime/tests/misc.rs @@ -85,7 +85,7 @@ impl WakeRef for LoggingWaker { async fn test_wakers_for_async_ops() { static STATE: AtomicI8 = AtomicI8::new(0); - #[op2(async)] + #[op(async)] async fn op_async_sleep() -> Result<(), Error> { STATE.store(1, Ordering::SeqCst); tokio::time::sleep(std::time::Duration::from_millis(1)).await; @@ -315,7 +315,7 @@ fn terminate_execution_webassembly() { }); let err = runtime .execute_script( - "infinite_wasm_loop2.js", + "infinite_wasm_loop.js", "globalThis.wasmInstance.exports.infinite_loop();", ) .unwrap_err(); @@ -595,7 +595,7 @@ assertEquals(1, notify_return_value); // noop script, will resolve promise from first script runtime - .execute_script("pump_message_loop2.js", r#"assertEquals(1, 1);"#) + .execute_script("pump_message_loop.js", r#"assertEquals(1, 1);"#) .unwrap(); // check that promise from `Atomics.waitAsync` has been resolved @@ -643,7 +643,7 @@ fn test_is_proxy() { #[tokio::test] async fn test_set_macrotask_callback_set_next_tick_callback() { - #[op2(async)] + #[op(async)] async fn op_async_sleep() -> Result<(), Error> { // Future must be Poll::Pending on first call tokio::time::sleep(std::time::Duration::from_millis(1)).await; @@ -693,13 +693,13 @@ fn test_has_tick_scheduled() { static MACROTASK: AtomicUsize = AtomicUsize::new(0); static NEXT_TICK: AtomicUsize = AtomicUsize::new(0); - #[op2(fast)] + #[op(fast)] fn op_macrotask() -> Result<(), AnyError> { MACROTASK.fetch_add(1, Ordering::Relaxed); Ok(()) } - #[op2(fast)] + #[op(fast)] fn op_next_tick() -> Result<(), AnyError> { NEXT_TICK.fetch_add(1, Ordering::Relaxed); Ok(()) @@ -804,7 +804,7 @@ async fn test_promise_rejection_handler_generic( case: &'static str, error: Option<&'static str>, ) { - #[op2(fast)] + #[op(fast)] fn op_breakpoint() {} deno_core::extension!(test_ext, ops = [op_breakpoint]); @@ -961,7 +961,7 @@ async fn test_stalled_tla() { // Regression test for https://github.com/denoland/deno/issues/20034. #[tokio::test] async fn test_dynamic_import_module_error_stack() { - #[op2(async)] + #[op(async)] async fn op_async_error() -> Result<(), Error> { tokio::time::sleep(std::time::Duration::from_millis(1)).await; Err(crate::error::type_error("foo")) @@ -1011,7 +1011,7 @@ Caused by: at mod:tla:3:11"# )] async fn tla_in_esm_extensions_panics() { - #[op2(async)] + #[op(async)] async fn op_wait(#[number] ms: usize) { tokio::time::sleep(Duration::from_millis(ms as u64)).await } @@ -1049,7 +1049,7 @@ async fn tla_in_esm_extensions_panics() { at mod:error:3:9"# )] async fn esm_extensions_throws() { - #[op2(async)] + #[op(async)] async fn op_wait(#[number] ms: usize) { tokio::time::sleep(Duration::from_millis(ms as u64)).await } @@ -1187,7 +1187,7 @@ async fn task_spawner_cross_thread_blocking() { #[tokio::test] async fn terminate_execution_run_event_loop_js() { - #[op2(async)] + #[op(async)] async fn op_async_sleep() -> Result<(), Error> { tokio::time::sleep(std::time::Duration::from_millis(100)).await; Ok(()) diff --git a/core/runtime/tests/mod.rs b/core/runtime/tests/mod.rs index 1d3103689..ffac98c58 100644 --- a/core/runtime/tests/mod.rs +++ b/core/runtime/tests/mod.rs @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use crate::error::AnyError; -use crate::op2; +use crate::op; use crate::CrossIsolateStore; use crate::JsRuntime; use crate::OpState; @@ -31,7 +31,7 @@ struct TestState { } #[allow(clippy::await_holding_refcell_ref)] // False positive. -#[op2(async)] +#[op(async)] async fn op_test( rc_op_state: Rc>, control: u8, diff --git a/core/runtime/tests/ops.rs b/core/runtime/tests/ops.rs index f0c9be77e..e13532fc9 100644 --- a/core/runtime/tests/ops.rs +++ b/core/runtime/tests/ops.rs @@ -22,7 +22,7 @@ use url::Url; async fn test_async_opstate_borrow() { struct InnerState(u64); - #[op2(async)] + #[op(async)] async fn op_async_borrow( op_state: Rc>, ) -> Result<(), Error> { @@ -60,7 +60,7 @@ async fn test_async_opstate_borrow() { #[tokio::test] async fn test_sync_op_serialize_object_with_numbers_as_keys() { - #[op2] + #[op] fn op_sync_serialize_object_with_numbers_as_keys( #[serde] value: serde_json::Value, ) -> Result<(), Error> { @@ -102,7 +102,7 @@ lines: { #[tokio::test] async fn test_async_op_serialize_object_with_numbers_as_keys() { - #[op2(async)] + #[op(async)] async fn op_async_serialize_object_with_numbers_as_keys( #[serde] value: serde_json::Value, ) -> Result<(), Error> { @@ -145,7 +145,7 @@ async fn test_async_op_serialize_object_with_numbers_as_keys() { #[test] fn test_op_return_serde_v8_error() { - #[op2] + #[op] #[serde] fn op_err() -> Result, anyhow::Error> { Ok([(1, 2), (3, 4)].into_iter().collect()) // Maps can't have non-string keys in serde_v8 @@ -166,7 +166,7 @@ fn test_op_return_serde_v8_error() { #[test] fn test_op_high_arity() { - #[op2(fast)] + #[op(fast)] #[number] fn op_add_4( #[number] x1: i64, @@ -191,7 +191,7 @@ fn test_op_high_arity() { #[test] fn test_op_disabled() { - #[op2(fast)] + #[op(fast)] #[number] fn op_foo() -> Result { Ok(42) @@ -215,12 +215,12 @@ fn test_op_disabled() { #[test] fn test_op_detached_buffer() { - #[op2] + #[op] fn op_sum_take(#[buffer(detach)] b: JsBuffer) -> Result { Ok(b.as_ref().iter().clone().map(|x| *x as u32).sum()) } - #[op2] + #[op] #[buffer] fn op_boomerang( #[buffer(detach)] b: JsBuffer, @@ -296,14 +296,14 @@ fn duplicate_op_names() { mod a { use super::*; - #[op2] + #[op] #[string] pub fn op_test() -> Result { Ok(String::from("Test")) } } - #[op2] + #[op] #[string] pub fn op_test() -> Result { Ok(String::from("Test")) @@ -318,13 +318,13 @@ fn duplicate_op_names() { #[test] fn ops_in_js_have_proper_names() { - #[op2] + #[op] #[string] fn op_test_sync() -> Result { Ok(String::from("Test")) } - #[op2(async)] + #[op(async)] #[string] async fn op_test_async() -> Result { Ok(String::from("Test")) @@ -473,7 +473,7 @@ fn test_call_site() { // https://github.com/denoland/deno/issues/19455 #[tokio::test] pub async fn test_top_level_await() { - #[op2(async)] + #[op(async)] async fn op_sleep_forever() { tokio::time::sleep(Duration::MAX).await } @@ -528,12 +528,12 @@ await op_void_async_deferred(); .expect("Failed to get module result"); } -#[op2(async)] +#[op(async)] pub async fn op_async() { println!("op_async!"); } -#[op2(async)] +#[op(async)] #[allow(unreachable_code)] pub fn op_async_impl_future_error() -> Result, AnyError> { @@ -541,51 +541,51 @@ pub fn op_async_impl_future_error() -> Result, AnyError Ok(async {}) } -#[op2(async)] +#[op(async)] pub async fn op_async_yield() { tokio::task::yield_now().await; println!("op_async_yield!"); } -#[op2(async)] +#[op(async)] pub async fn op_async_yield_error() -> Result<(), AnyError> { tokio::task::yield_now().await; println!("op_async_yield_error!"); bail!("dead"); } -#[op2(async)] +#[op(async)] pub async fn op_async_error() -> Result<(), AnyError> { println!("op_async_error!"); bail!("dead"); } -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_async_deferred() { println!("op_async_deferred!"); } -#[op2(async(lazy), fast)] +#[op(async(lazy), fast)] pub async fn op_async_lazy() { println!("op_async_lazy!"); } -#[op2(fast)] +#[op(fast)] pub fn op_sync() { println!("op_sync!"); } -#[op2(fast)] +#[op(fast)] pub fn op_sync_error() -> Result<(), AnyError> { bail!("Always fails"); } -#[op2(fast)] +#[op(fast)] pub fn op_sync_arg_error(_: u32) { panic!("Should never be called") } -#[op2(async)] +#[op(async)] pub async fn op_async_arg_error(_: u32) { panic!("Should never be called") } diff --git a/core/runtime/tests/snapshot.rs b/core/runtime/tests/snapshot.rs index a7f0ce487..b60943416 100644 --- a/core/runtime/tests/snapshot.rs +++ b/core/runtime/tests/snapshot.rs @@ -231,7 +231,7 @@ fn es_snapshot() { } } - #[op2] + #[op] #[string] fn op_test() -> Result { Ok(String::from("test")) @@ -395,13 +395,13 @@ pub(crate) fn es_snapshot_without_runtime_module_loader() { #[test] pub fn snapshot_with_additional_extensions() { - #[op2] + #[op] #[string] fn op_before() -> String { "before".to_owned() } - #[op2] + #[op] #[string] fn op_after() -> String { "after".to_owned() diff --git a/core/source_map.rs b/core/source_map.rs index 396e21370..d0a3e5280 100644 --- a/core/source_map.rs +++ b/core/source_map.rs @@ -60,7 +60,7 @@ pub struct SourceMapper { getter: Option, pub(crate) ext_source_maps: HashMap, // This is not the right place for this, but it's the easiest way to make - // op_apply_source_map a fast op. This stashing should happen in #[op2]. + // op_apply_source_map a fast op. This stashing should happen in #[op]. pub(crate) stashed_file_name: Option, } diff --git a/ops/README.md b/ops/README.md index 7f71fb9b1..14bd5b331 100644 --- a/ops/README.md +++ b/ops/README.md @@ -3,10 +3,10 @@ `proc_macro` for generating highly optimized V8 functions from Rust functions. ```rust,ignore -use deno_core::{op2, extension}; +use deno_core::{op, extension}; // Declare an op. -#[op2(fast)] +#[op(fast)] pub fn op_add(a: i32, b: i32) -> i32 { a + b } diff --git a/ops/compile_test_runner/src/lib.rs b/ops/compile_test_runner/src/lib.rs index ed6e3619a..6cf04e233 100644 --- a/ops/compile_test_runner/src/lib.rs +++ b/ops/compile_test_runner/src/lib.rs @@ -2,7 +2,7 @@ #[macro_export] macro_rules! prelude { () => { - use deno_ops::op2; + use deno_ops::op; pub fn main() {} }; @@ -13,7 +13,7 @@ mod tests { use std::path::PathBuf; // TODO(mmastrac): It's faster to do things with testing_macros::fixture? - #[testing_macros::fixture("../op2/test_cases/compiler_pass/*.rs")] + #[testing_macros::fixture("../op/test_cases/compiler_pass/*.rs")] fn compile_test(input: PathBuf) { let t = trybuild::TestCases::new(); t.pass(input); @@ -25,8 +25,8 @@ mod tests { // Run all the tests on a nightly build (which should take advantage of cargo's --keep-going to // run in parallel: https://github.com/dtolnay/trybuild/pull/168) let t = trybuild::TestCases::new(); - t.pass("../op2/test_cases/**/*.rs"); - t.compile_fail("../op2/test_cases_fail/**/*.rs"); + t.pass("../op/test_cases/**/*.rs"); + t.compile_fail("../op/test_cases_fail/**/*.rs"); } #[rustversion::not(nightly)] @@ -35,8 +35,8 @@ mod tests { // Run all the tests if we're in the CI if let Ok(true) = std::env::var("CI").map(|s| s == "true") { let t = trybuild::TestCases::new(); - t.compile_fail("../op2/test_cases_fail/**/*.rs"); - t.pass("../op2/test_cases/**/*.rs"); + t.compile_fail("../op/test_cases_fail/**/*.rs"); + t.pass("../op/test_cases/**/*.rs"); } } } diff --git a/ops/lib.rs b/ops/lib.rs index 2b7d4c9cb..8838643f5 100644 --- a/ops/lib.rs +++ b/ops/lib.rs @@ -4,21 +4,21 @@ use proc_macro::TokenStream; use std::error::Error; -mod op2; +mod op; /// A macro designed to provide an extremely fast V8->Rust interface layer. -#[doc = include_str!("op2/README.md")] +#[doc = include_str!("op/README.md")] #[proc_macro_attribute] -pub fn op2(attr: TokenStream, item: TokenStream) -> TokenStream { - op2_macro(attr, item) +pub fn op(attr: TokenStream, item: TokenStream) -> TokenStream { + op_macro(attr, item) } -fn op2_macro(attr: TokenStream, item: TokenStream) -> TokenStream { - match crate::op2::op2(attr.into(), item.into()) { +fn op_macro(attr: TokenStream, item: TokenStream) -> TokenStream { + match crate::op::op(attr.into(), item.into()) { Ok(output) => output.into(), Err(err) => { let mut err: &dyn Error = &err; - let mut output = "Failed to parse #[op2]:\n".to_owned(); + let mut output = "Failed to parse #[op]:\n".to_owned(); loop { output += &format!(" - {err}\n"); if let Some(source) = err.source() { diff --git a/ops/op2/README.md b/ops/op/README.md similarity index 98% rename from ops/op2/README.md rename to ops/op/README.md index a1e95734b..48d31bb07 100644 --- a/ops/op2/README.md +++ b/ops/op/README.md @@ -1,6 +1,4 @@ -# op2 - -`#[op2]` is the in-progress replacement for `#[op]`. +# op ## Strings @@ -79,13 +77,13 @@ still happen on a slow path. ## fastcalls -`op2` requires fastcall-compatible ops to be annotated with `fast`. If you wish +`op` requires fastcall-compatible ops to be annotated with `fast`. If you wish to avoid fastcalls for some reason (this is unlikely), you can specify `nofast` instead. You may also choose an alternate op function to use as the fastcall equivalent to a slow function. In this case, you can specify `fast(op_XYZ)`. The other op -must be decorated with `#[op2(fast)]`, and does not need to be registered. When +must be decorated with `#[op(fast)]`, and does not need to be registered. When v8 optimized the slow function to a fastcall, it will switch the implementation over if the parameters are compatible. This is useful for a function that takes any buffer type in the slow path and wishes to use the very fast typed `u8` diff --git a/ops/op2/config.rs b/ops/op/config.rs similarity index 96% rename from ops/op2/config.rs rename to ops/op/config.rs index 87b7b7dc9..1b992025f 100644 --- a/ops/op2/config.rs +++ b/ops/op/config.rs @@ -4,7 +4,7 @@ use proc_macro2::TokenTree; use proc_macro_rules::rules; use quote::ToTokens; -use crate::op2::Op2Error; +use crate::op::Op2Error; #[derive(Debug, Default, Eq, PartialEq)] pub(crate) struct MacroConfig { @@ -127,7 +127,7 @@ impl MacroConfig { Ok(config) } - /// Parses the attribute parameters that `proc_macro` passes to the macro. For `#[op2(arg1, arg2)]`, the + /// Parses the attribute parameters that `proc_macro` passes to the macro. For `#[op(arg1, arg2)]`, the /// tokens will be `arg1, arg2`. pub fn from_tokens(tokens: TokenStream) -> Result { let attr_string = tokens.to_string(); @@ -161,16 +161,16 @@ impl MacroConfig { Ok(config) } - /// If the attribute matches #[op2(...)] or #[op2], returns `Some(MacroConfig)`, otherwise returns `None`. + /// If the attribute matches #[op(...)] or #[op], returns `Some(MacroConfig)`, otherwise returns `None`. #[cfg(test)] pub fn from_maybe_attribute_tokens( tokens: TokenStream, ) -> Result, Op2Error> { rules!(tokens => { - (#[op2]) => { + (#[op]) => { Ok(Some(MacroConfig::default())) } - (#[op2 $flags:tt ]) => { + (#[op $flags:tt ]) => { Ok(Some(MacroConfig::from_token_tree(flags)?)) } (#[$_attr:meta]) => { @@ -187,7 +187,7 @@ mod tests { use syn::Meta; fn test_parse(s: &str, expected: MacroConfig) { - let item_fn = syn::parse_str::(&format!("#[op2{s}] fn x() {{ }}")) + let item_fn = syn::parse_str::(&format!("#[op{s}] fn x() {{ }}")) .expect("Failed to parse function"); let attr = item_fn.attrs.first().unwrap(); let config = diff --git a/ops/op2/dispatch_async.rs b/ops/op/dispatch_async.rs similarity index 100% rename from ops/op2/dispatch_async.rs rename to ops/op/dispatch_async.rs diff --git a/ops/op2/dispatch_fast.rs b/ops/op/dispatch_fast.rs similarity index 99% rename from ops/op2/dispatch_fast.rs rename to ops/op/dispatch_fast.rs index e7f77b886..19cb48a0f 100644 --- a/ops/op2/dispatch_fast.rs +++ b/ops/op/dispatch_fast.rs @@ -20,7 +20,7 @@ use super::signature::Strings; use super::signature::WasmMemorySource; use super::V8MappingError; use super::V8SignatureMappingError; -use crate::op2::dispatch_async::map_async_return_type; +use crate::op::dispatch_async::map_async_return_type; use proc_macro2::Ident; use proc_macro2::TokenStream; use quote::format_ident; diff --git a/ops/op2/dispatch_shared.rs b/ops/op/dispatch_shared.rs similarity index 100% rename from ops/op2/dispatch_shared.rs rename to ops/op/dispatch_shared.rs diff --git a/ops/op2/dispatch_slow.rs b/ops/op/dispatch_slow.rs similarity index 100% rename from ops/op2/dispatch_slow.rs rename to ops/op/dispatch_slow.rs diff --git a/ops/op2/generator_state.rs b/ops/op/generator_state.rs similarity index 100% rename from ops/op2/generator_state.rs rename to ops/op/generator_state.rs diff --git a/ops/op2/mod.rs b/ops/op/mod.rs similarity index 96% rename from ops/op2/mod.rs rename to ops/op/mod.rs index 5638c2d15..75e707034 100644 --- a/ops/op2/mod.rs +++ b/ops/op/mod.rs @@ -76,17 +76,17 @@ pub enum V8SignatureMappingError { pub type V8MappingError = &'static str; -/// Generate the op2 macro expansion. -pub(crate) fn op2( +/// Generate the op macro expansion. +pub(crate) fn op( attr: TokenStream, item: TokenStream, ) -> Result { let func = parse2::(item)?; let config = MacroConfig::from_tokens(attr)?; - generate_op2(config, func) + generate_op(config, func) } -fn generate_op2( +fn generate_op( config: MacroConfig, func: ItemFn, ) -> Result { @@ -290,7 +290,7 @@ fn generate_op2( impl <#(#generic : #bound),*> ::deno_core::_ops::Op for #name <#(#generic),*> { const NAME: &'static str = stringify!(#name); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( /*name*/ ::deno_core::__op_name_fast!(#name), /*is_async*/ #is_async, /*is_reentrant*/ #is_reentrant, @@ -331,12 +331,12 @@ mod tests { use syn::File; use syn::Item; - #[testing_macros::fixture("op2/test_cases/sync/*.rs")] + #[testing_macros::fixture("op/test_cases/sync/*.rs")] fn test_proc_macro_sync(input: PathBuf) { test_proc_macro_output(input) } - #[testing_macros::fixture("op2/test_cases/async/*.rs")] + #[testing_macros::fixture("op/test_cases/async/*.rs")] fn test_proc_macro_async(input: PathBuf) { test_proc_macro_output(input) } @@ -376,7 +376,7 @@ deno_ops_compile_test_runner::prelude!();"; } }); let tokens = - generate_op2(config.unwrap(), func).expect("Failed to generate op"); + generate_op(config.unwrap(), func).expect("Failed to generate op"); println!("======== Raw tokens ========:\n{}", tokens.clone()); let tree = syn::parse2(tokens).unwrap(); let actual = prettyplease::unparse(&tree); @@ -445,7 +445,7 @@ deno_ops_compile_test_runner::prelude!();"; let md = include_str!("valid_args.md"); let separator = "\n\n"; let end_separator = "\n\n"; - let readme = std::fs::read_to_string("op2/README.md").unwrap(); + let readme = std::fs::read_to_string("op/README.md").unwrap(); let (header, remainder) = split_readme(&readme, separator, end_separator); let mut actual = format!("{header}{separator}\n"); @@ -470,7 +470,7 @@ deno_ops_compile_test_runner::prelude!();"; let sig = parse_signature(vec![], function.sig.clone()) .expect("Failed to parse signature"); println!("Parsed signature: {sig:?}"); - generate_op2( + generate_op( MacroConfig { fast, ..Default::default() @@ -486,7 +486,7 @@ deno_ops_compile_test_runner::prelude!();"; actual += remainder; if update_expected { - std::fs::write("op2/README.md", actual) + std::fs::write("op/README.md", actual) .expect("Failed to write expectation file"); } else { assert_eq!( @@ -503,7 +503,7 @@ deno_ops_compile_test_runner::prelude!();"; let md = include_str!("valid_retvals.md"); let separator = "\n\n"; let end_separator = "\n\n"; - let readme = std::fs::read_to_string("op2/README.md").unwrap(); + let readme = std::fs::read_to_string("op/README.md").unwrap(); let (header, remainder) = split_readme(&readme, separator, end_separator); let mut actual = format!("{header}{separator}
RustFastcallv8
\n"); @@ -528,7 +528,7 @@ deno_ops_compile_test_runner::prelude!();"; let sig = parse_signature(function.attrs.clone(), function.sig.clone()) .expect("Failed to parse signature"); println!("Parsed signature: {sig:?}"); - generate_op2( + generate_op( MacroConfig { fast, ..Default::default() @@ -545,7 +545,7 @@ deno_ops_compile_test_runner::prelude!();"; parse_signature(function.attrs.clone(), function.sig.clone()) .expect("Failed to parse signature"); println!("Parsed signature: {sig:?}"); - generate_op2( + generate_op( MacroConfig { r#async: true, ..Default::default() @@ -563,7 +563,7 @@ deno_ops_compile_test_runner::prelude!();"; actual += remainder; if update_expected { - std::fs::write("op2/README.md", actual) + std::fs::write("op/README.md", actual) .expect("Failed to write expectation file"); } else { assert_eq!( diff --git a/ops/op2/signature.rs b/ops/op/signature.rs similarity index 100% rename from ops/op2/signature.rs rename to ops/op/signature.rs diff --git a/ops/op2/signature_retval.rs b/ops/op/signature_retval.rs similarity index 99% rename from ops/op2/signature_retval.rs rename to ops/op/signature_retval.rs index da856383f..e6b7c34eb 100644 --- a/ops/op2/signature_retval.rs +++ b/ops/op/signature_retval.rs @@ -1,5 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::op2::signature::*; +use crate::op::signature::*; use proc_macro_rules::rules; use quote::ToTokens; diff --git a/ops/op2/test_cases/async/async_arg_return.out b/ops/op/test_cases/async/async_arg_return.out similarity index 99% rename from ops/op2/test_cases/async/async_arg_return.out rename to ops/op/test_cases/async/async_arg_return.out index 71b776122..0f6d71c22 100644 --- a/ops/op2/test_cases/async/async_arg_return.out +++ b/ops/op/test_cases/async/async_arg_return.out @@ -6,7 +6,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async { const NAME: &'static str = stringify!(op_async); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async), true, false, diff --git a/ops/op2/test_cases/async/async_arg_return.rs b/ops/op/test_cases/async/async_arg_return.rs similarity index 92% rename from ops/op2/test_cases/async/async_arg_return.rs rename to ops/op/test_cases/async/async_arg_return.rs index 61c756481..7aa8c675b 100644 --- a/ops/op2/test_cases/async/async_arg_return.rs +++ b/ops/op/test_cases/async/async_arg_return.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(async)] +#[op(async)] pub async fn op_async(x: i32) -> i32 { x } diff --git a/ops/op2/test_cases/async/async_arg_return_result.out b/ops/op/test_cases/async/async_arg_return_result.out similarity index 99% rename from ops/op2/test_cases/async/async_arg_return_result.out rename to ops/op/test_cases/async/async_arg_return_result.out index 599e2ade2..5d1dcedab 100644 --- a/ops/op2/test_cases/async/async_arg_return_result.out +++ b/ops/op/test_cases/async/async_arg_return_result.out @@ -6,7 +6,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async { const NAME: &'static str = stringify!(op_async); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async), true, false, diff --git a/ops/op2/test_cases/async/async_arg_return_result.rs b/ops/op/test_cases/async/async_arg_return_result.rs similarity index 93% rename from ops/op2/test_cases/async/async_arg_return_result.rs rename to ops/op/test_cases/async/async_arg_return_result.rs index 09ffc648f..21037638e 100644 --- a/ops/op2/test_cases/async/async_arg_return_result.rs +++ b/ops/op/test_cases/async/async_arg_return_result.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(async)] +#[op(async)] pub async fn op_async(x: i32) -> std::io::Result { Ok(x) } diff --git a/ops/op2/test_cases/async/async_cppgc.out b/ops/op/test_cases/async/async_cppgc.out similarity index 99% rename from ops/op2/test_cases/async/async_cppgc.out rename to ops/op/test_cases/async/async_cppgc.out index 1a4804319..cdd75ba7b 100644 --- a/ops/op2/test_cases/async/async_cppgc.out +++ b/ops/op/test_cases/async/async_cppgc.out @@ -6,7 +6,7 @@ const fn op_make_cppgc_object() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_make_cppgc_object { const NAME: &'static str = stringify!(op_make_cppgc_object); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_make_cppgc_object), true, false, @@ -125,7 +125,7 @@ const fn op_use_cppgc_object() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_use_cppgc_object { const NAME: &'static str = stringify!(op_use_cppgc_object); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_use_cppgc_object), true, false, @@ -247,7 +247,7 @@ const fn op_use_optional_cppgc_object() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_use_optional_cppgc_object { const NAME: &'static str = stringify!(op_use_optional_cppgc_object); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_use_optional_cppgc_object), true, false, diff --git a/ops/op2/test_cases/async/async_cppgc.rs b/ops/op/test_cases/async/async_cppgc.rs similarity index 90% rename from ops/op2/test_cases/async/async_cppgc.rs rename to ops/op/test_cases/async/async_cppgc.rs index c7296690f..28d95560b 100644 --- a/ops/op2/test_cases/async/async_cppgc.rs +++ b/ops/op/test_cases/async/async_cppgc.rs @@ -7,14 +7,14 @@ struct Wrap; impl GarbageCollected for Wrap {} -#[op2(async)] +#[op(async)] #[cppgc] async fn op_make_cppgc_object() -> Wrap { Wrap } -#[op2(async)] +#[op(async)] async fn op_use_cppgc_object(#[cppgc] _wrap: &Wrap) {} -#[op2(async)] +#[op(async)] async fn op_use_optional_cppgc_object(#[cppgc] _wrap: Option<&Wrap>) {} diff --git a/ops/op2/test_cases/async/async_deferred.out b/ops/op/test_cases/async/async_deferred.out similarity index 99% rename from ops/op2/test_cases/async/async_deferred.out rename to ops/op/test_cases/async/async_deferred.out index c24579f33..57d12c716 100644 --- a/ops/op2/test_cases/async/async_deferred.out +++ b/ops/op/test_cases/async/async_deferred.out @@ -6,7 +6,7 @@ pub const fn op_async_deferred() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async_deferred { const NAME: &'static str = stringify!(op_async_deferred); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async_deferred), true, false, diff --git a/ops/op2/test_cases/async/async_deferred.rs b/ops/op/test_cases/async/async_deferred.rs similarity index 87% rename from ops/op2/test_cases/async/async_deferred.rs rename to ops/op/test_cases/async/async_deferred.rs index f920f56c4..ad9fe1407 100644 --- a/ops/op2/test_cases/async/async_deferred.rs +++ b/ops/op/test_cases/async/async_deferred.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_async_deferred() -> std::io::Result { Ok(0) } diff --git a/ops/op2/test_cases/async/async_jsbuffer.out b/ops/op/test_cases/async/async_jsbuffer.out similarity index 99% rename from ops/op2/test_cases/async/async_jsbuffer.out rename to ops/op/test_cases/async/async_jsbuffer.out index 36bdb0c2e..99345afc8 100644 --- a/ops/op2/test_cases/async/async_jsbuffer.out +++ b/ops/op/test_cases/async/async_jsbuffer.out @@ -6,7 +6,7 @@ pub const fn op_async_v8_buffer() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async_v8_buffer { const NAME: &'static str = stringify!(op_async_v8_buffer); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async_v8_buffer), true, false, diff --git a/ops/op2/test_cases/async/async_jsbuffer.rs b/ops/op/test_cases/async/async_jsbuffer.rs similarity index 94% rename from ops/op2/test_cases/async/async_jsbuffer.rs rename to ops/op/test_cases/async/async_jsbuffer.rs index 077478cd0..cd77851df 100644 --- a/ops/op2/test_cases/async/async_jsbuffer.rs +++ b/ops/op/test_cases/async/async_jsbuffer.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::JsBuffer; -#[op2(async)] +#[op(async)] #[buffer] pub async fn op_async_v8_buffer(#[buffer] buf: JsBuffer) -> JsBuffer { buf diff --git a/ops/op2/test_cases/async/async_lazy.out b/ops/op/test_cases/async/async_lazy.out similarity index 99% rename from ops/op2/test_cases/async/async_lazy.out rename to ops/op/test_cases/async/async_lazy.out index fb50896af..941fc7541 100644 --- a/ops/op2/test_cases/async/async_lazy.out +++ b/ops/op/test_cases/async/async_lazy.out @@ -6,7 +6,7 @@ pub const fn op_async_lazy() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async_lazy { const NAME: &'static str = stringify!(op_async_lazy); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async_lazy), true, false, diff --git a/ops/op2/test_cases/async/async_lazy.rs b/ops/op/test_cases/async/async_lazy.rs similarity index 88% rename from ops/op2/test_cases/async/async_lazy.rs rename to ops/op/test_cases/async/async_lazy.rs index 60b78adfc..c7477165b 100644 --- a/ops/op2/test_cases/async/async_lazy.rs +++ b/ops/op/test_cases/async/async_lazy.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(async(lazy), fast)] +#[op(async(lazy), fast)] pub async fn op_async_lazy() -> std::io::Result { Ok(0) } diff --git a/ops/op2/test_cases/async/async_op_metadata.out b/ops/op/test_cases/async/async_op_metadata.out similarity index 99% rename from ops/op2/test_cases/async/async_op_metadata.out rename to ops/op/test_cases/async/async_op_metadata.out index 1d32a07f6..2d48f17c1 100644 --- a/ops/op2/test_cases/async/async_op_metadata.out +++ b/ops/op/test_cases/async/async_op_metadata.out @@ -6,7 +6,7 @@ const fn op_blob_read_part() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_blob_read_part { const NAME: &'static str = stringify!(op_blob_read_part); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_blob_read_part), true, false, @@ -108,7 +108,7 @@ const fn op_broadcast_recv() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_broadcast_recv { const NAME: &'static str = stringify!(op_broadcast_recv); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_broadcast_recv), true, false, diff --git a/ops/op2/test_cases/async/async_op_metadata.rs b/ops/op/test_cases/async/async_op_metadata.rs similarity index 94% rename from ops/op2/test_cases/async/async_op_metadata.rs rename to ops/op/test_cases/async/async_op_metadata.rs index 3f41d5873..35ce1c35c 100644 --- a/ops/op2/test_cases/async/async_op_metadata.rs +++ b/ops/op/test_cases/async/async_op_metadata.rs @@ -2,14 +2,14 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(async)] +#[op(async)] #[meta(sanitizer_details = "read from a Blob or File")] #[meta(sanitizer_fix = "awaiting the result of a Blob or File read")] async fn op_blob_read_part() { return; } -#[op2(async)] +#[op(async)] #[meta( sanitizer_details = "receive a message from a BroadcastChannel", sanitizer_fix = "closing the BroadcastChannel" diff --git a/ops/op2/test_cases/async/async_opstate.out b/ops/op/test_cases/async/async_opstate.out similarity index 99% rename from ops/op2/test_cases/async/async_opstate.out rename to ops/op/test_cases/async/async_opstate.out index cb0c0262e..78449a66b 100644 --- a/ops/op2/test_cases/async/async_opstate.out +++ b/ops/op/test_cases/async/async_opstate.out @@ -6,7 +6,7 @@ pub const fn op_async_opstate() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async_opstate { const NAME: &'static str = stringify!(op_async_opstate); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async_opstate), true, false, diff --git a/ops/op2/test_cases/async/async_opstate.rs b/ops/op/test_cases/async/async_opstate.rs similarity index 95% rename from ops/op2/test_cases/async/async_opstate.rs rename to ops/op/test_cases/async/async_opstate.rs index d94a79596..d60ac2101 100644 --- a/ops/op2/test_cases/async/async_opstate.rs +++ b/ops/op/test_cases/async/async_opstate.rs @@ -6,7 +6,7 @@ use deno_core::OpState; use std::cell::RefCell; use std::rc::Rc; -#[op2(async)] +#[op(async)] pub async fn op_async_opstate( state: Rc>, ) -> std::io::Result { diff --git a/ops/op2/test_cases/async/async_result.out b/ops/op/test_cases/async/async_result.out similarity index 99% rename from ops/op2/test_cases/async/async_result.out rename to ops/op/test_cases/async/async_result.out index b30f78b29..5f265749a 100644 --- a/ops/op2/test_cases/async/async_result.out +++ b/ops/op/test_cases/async/async_result.out @@ -6,7 +6,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async { const NAME: &'static str = stringify!(op_async); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async), true, false, diff --git a/ops/op2/test_cases/async/async_result.rs b/ops/op/test_cases/async/async_result.rs similarity index 93% rename from ops/op2/test_cases/async/async_result.rs rename to ops/op/test_cases/async/async_result.rs index d2981f956..6a9a3a63c 100644 --- a/ops/op2/test_cases/async/async_result.rs +++ b/ops/op/test_cases/async/async_result.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(async)] +#[op(async)] pub async fn op_async() -> std::io::Result { Ok(0) } diff --git a/ops/op2/test_cases/async/async_result_impl.out b/ops/op/test_cases/async/async_result_impl.out similarity index 99% rename from ops/op2/test_cases/async/async_result_impl.out rename to ops/op/test_cases/async/async_result_impl.out index d97d1dd27..aa6d2b93a 100644 --- a/ops/op2/test_cases/async/async_result_impl.out +++ b/ops/op/test_cases/async/async_result_impl.out @@ -6,7 +6,7 @@ pub const fn op_async_result_impl() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async_result_impl { const NAME: &'static str = stringify!(op_async_result_impl); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async_result_impl), true, false, diff --git a/ops/op2/test_cases/async/async_result_impl.rs b/ops/op/test_cases/async/async_result_impl.rs similarity index 95% rename from ops/op2/test_cases/async/async_result_impl.rs rename to ops/op/test_cases/async/async_result_impl.rs index f07f1be9b..50d9f6e65 100644 --- a/ops/op2/test_cases/async/async_result_impl.rs +++ b/ops/op/test_cases/async/async_result_impl.rs @@ -5,7 +5,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::error::AnyError; use std::future::Future; -#[op2(async)] +#[op(async)] pub fn op_async_result_impl( x: i32, ) -> Result>, AnyError> { diff --git a/ops/op2/test_cases/async/async_result_smi.out b/ops/op/test_cases/async/async_result_smi.out similarity index 99% rename from ops/op2/test_cases/async/async_result_smi.out rename to ops/op/test_cases/async/async_result_smi.out index fb136c151..dc3c4b7d4 100644 --- a/ops/op2/test_cases/async/async_result_smi.out +++ b/ops/op/test_cases/async/async_result_smi.out @@ -6,7 +6,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async { const NAME: &'static str = stringify!(op_async); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async), true, false, diff --git a/ops/op2/test_cases/async/async_result_smi.rs b/ops/op/test_cases/async/async_result_smi.rs similarity index 95% rename from ops/op2/test_cases/async/async_result_smi.rs rename to ops/op/test_cases/async/async_result_smi.rs index 5144b7c28..f76fff899 100644 --- a/ops/op2/test_cases/async/async_result_smi.rs +++ b/ops/op/test_cases/async/async_result_smi.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); pub type ResourceId = i16; -#[op2(async)] +#[op(async)] #[smi] pub async fn op_async(#[smi] rid: ResourceId) -> std::io::Result { Ok(rid as _) diff --git a/ops/op2/test_cases/async/async_v8_global.out b/ops/op/test_cases/async/async_v8_global.out similarity index 99% rename from ops/op2/test_cases/async/async_v8_global.out rename to ops/op/test_cases/async/async_v8_global.out index 4ebaa2216..8b6878699 100644 --- a/ops/op2/test_cases/async/async_v8_global.out +++ b/ops/op/test_cases/async/async_v8_global.out @@ -6,7 +6,7 @@ pub const fn op_async_v8_global() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async_v8_global { const NAME: &'static str = stringify!(op_async_v8_global); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async_v8_global), true, false, diff --git a/ops/op2/test_cases/async/async_v8_global.rs b/ops/op/test_cases/async/async_v8_global.rs similarity index 94% rename from ops/op2/test_cases/async/async_v8_global.rs rename to ops/op/test_cases/async/async_v8_global.rs index 865e34fa6..b218263fb 100644 --- a/ops/op2/test_cases/async/async_v8_global.rs +++ b/ops/op/test_cases/async/async_v8_global.rs @@ -4,5 +4,5 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::v8; -#[op2(async)] +#[op(async)] pub async fn op_async_v8_global(#[global] _s: v8::Global) {} diff --git a/ops/op2/test_cases/async/async_void.out b/ops/op/test_cases/async/async_void.out similarity index 99% rename from ops/op2/test_cases/async/async_void.out rename to ops/op/test_cases/async/async_void.out index c9cfbd052..82a523494 100644 --- a/ops/op2/test_cases/async/async_void.out +++ b/ops/op/test_cases/async/async_void.out @@ -6,7 +6,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_async { const NAME: &'static str = stringify!(op_async); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_async), true, false, diff --git a/ops/op2/test_cases/async/async_void.rs b/ops/op/test_cases/async/async_void.rs similarity index 92% rename from ops/op2/test_cases/async/async_void.rs rename to ops/op/test_cases/async/async_void.rs index 2c825e84a..33f783081 100644 --- a/ops/op2/test_cases/async/async_void.rs +++ b/ops/op/test_cases/async/async_void.rs @@ -2,5 +2,5 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(async)] +#[op(async)] pub async fn op_async() {} diff --git a/ops/op2/test_cases/compiler_pass/async.rs b/ops/op/test_cases/compiler_pass/async.rs similarity index 89% rename from ops/op2/test_cases/compiler_pass/async.rs rename to ops/op/test_cases/compiler_pass/async.rs index 9918fe257..0573ebf55 100644 --- a/ops/op2/test_cases/compiler_pass/async.rs +++ b/ops/op/test_cases/compiler_pass/async.rs @@ -11,50 +11,50 @@ use std::rc::Rc; // Collect a few examples that we'll smoke test when not running on the CI. -#[op2(async)] +#[op(async)] pub async fn op_async1() {} -#[op2(async)] +#[op(async)] pub async fn op_async2(x: i32) -> i32 { x } -#[op2(async)] +#[op(async)] pub async fn op_async3(x: i32) -> std::io::Result { Ok(x) } -#[op2(async)] +#[op(async)] pub fn op_async4(x: i32) -> Result, AnyError> { Ok(async move { x }) } -#[op2(async)] +#[op(async)] pub fn op_async5( x: i32, ) -> Result>, AnyError> { Ok(async move { Ok(x) }) } -#[op2(async)] +#[op(async)] pub async fn op_async6(x: f32) -> f32 { x } -#[op2(async)] +#[op(async)] pub async fn op_async_opstate( state: Rc>, ) -> std::io::Result { Ok(*state.borrow().borrow::()) } -#[op2(async)] +#[op(async)] #[buffer] pub async fn op_async_buffer(#[buffer] buf: JsBuffer) -> JsBuffer { buf } -#[op2(async)] +#[op(async)] #[string] pub async fn op_async_string(#[string] s: String) -> String { s diff --git a/ops/op2/test_cases/compiler_pass/sync.rs b/ops/op/test_cases/compiler_pass/sync.rs similarity index 91% rename from ops/op2/test_cases/compiler_pass/sync.rs rename to ops/op/test_cases/compiler_pass/sync.rs index 0bb50f9c7..e79b78e96 100644 --- a/ops/op2/test_cases/compiler_pass/sync.rs +++ b/ops/op/test_cases/compiler_pass/sync.rs @@ -6,30 +6,30 @@ use deno_core::v8; // Collect a few examples that we'll smoke test when not running on the CI. -#[op2(fast)] +#[op(fast)] pub fn op_fast(x: u32) -> u32 { x } -#[op2(fast)] +#[op(fast)] fn op_buffers(#[buffer] _a: &[u8], #[buffer(copy)] _b: Vec) {} struct Something {} -#[op2(fast)] +#[op(fast)] fn op_state_rc( #[state] _arg: &Something, #[state] _arg_opt: Option<&Something>, ) { } -#[op2(fast)] +#[op(fast)] fn op_v8_1(_s: v8::Local) {} -#[op2(fast)] +#[op(fast)] fn op_v8_2(_s: &v8::String) {} -#[op2] +#[op] fn op_v8_3(#[global] _s: v8::Global) {} pub type Int16 = i16; @@ -37,7 +37,7 @@ pub type Int32 = i32; pub type Uint16 = u16; pub type Uint32 = u32; -#[op2(fast)] +#[op(fast)] #[smi] fn op_smi_unsigned_return( #[smi] a: Int16, @@ -48,7 +48,7 @@ fn op_smi_unsigned_return( a as Uint32 + b as Uint32 + c as Uint32 + d as Uint32 } -#[op2(fast)] +#[op(fast)] #[smi] fn op_smi_signed_return( #[smi] a: Int16, diff --git a/ops/op2/test_cases/sync/add.out b/ops/op/test_cases/sync/add.out similarity index 99% rename from ops/op2/test_cases/sync/add.out rename to ops/op/test_cases/sync/add.out index b48ddb2f7..385927a89 100644 --- a/ops/op2/test_cases/sync/add.out +++ b/ops/op/test_cases/sync/add.out @@ -6,7 +6,7 @@ const fn op_add() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_add { const NAME: &'static str = stringify!(op_add); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_add), false, false, diff --git a/ops/op2/test_cases/sync/add.rs b/ops/op/test_cases/sync/add.rs similarity index 93% rename from ops/op2/test_cases/sync/add.rs rename to ops/op/test_cases/sync/add.rs index 4b03f81f1..44fb81fc3 100644 --- a/ops/op2/test_cases/sync/add.rs +++ b/ops/op/test_cases/sync/add.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(fast)] +#[op(fast)] fn op_add(a: u32, b: u32) -> u32 { a + b } diff --git a/ops/op2/test_cases/sync/add_options.out b/ops/op/test_cases/sync/add_options.out similarity index 99% rename from ops/op2/test_cases/sync/add_options.out rename to ops/op/test_cases/sync/add_options.out index d976a8f6a..99e000194 100644 --- a/ops/op2/test_cases/sync/add_options.out +++ b/ops/op/test_cases/sync/add_options.out @@ -6,7 +6,7 @@ pub const fn op_test_add_option() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_test_add_option { const NAME: &'static str = stringify!(op_test_add_option); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_test_add_option), false, false, diff --git a/ops/op2/test_cases/sync/add_options.rs b/ops/op/test_cases/sync/add_options.rs similarity index 96% rename from ops/op2/test_cases/sync/add_options.rs rename to ops/op/test_cases/sync/add_options.rs index b24bd03f2..f518579a6 100644 --- a/ops/op2/test_cases/sync/add_options.rs +++ b/ops/op/test_cases/sync/add_options.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2] +#[op] pub fn op_test_add_option(a: u32, b: Option) -> u32 { a + b.unwrap_or(100) } diff --git a/ops/op2/test_cases/sync/bigint.out b/ops/op/test_cases/sync/bigint.out similarity index 99% rename from ops/op2/test_cases/sync/bigint.out rename to ops/op/test_cases/sync/bigint.out index 2c2480456..307c2b093 100644 --- a/ops/op2/test_cases/sync/bigint.out +++ b/ops/op/test_cases/sync/bigint.out @@ -6,7 +6,7 @@ pub const fn op_bigint() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_bigint { const NAME: &'static str = stringify!(op_bigint); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_bigint), false, false, diff --git a/ops/op2/test_cases/sync/bigint.rs b/ops/op/test_cases/sync/bigint.rs similarity index 93% rename from ops/op2/test_cases/sync/bigint.rs rename to ops/op/test_cases/sync/bigint.rs index 3c057de47..c1340b09b 100644 --- a/ops/op2/test_cases/sync/bigint.rs +++ b/ops/op/test_cases/sync/bigint.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(fast)] +#[op(fast)] #[bigint] pub fn op_bigint() -> u64 { 0 diff --git a/ops/op2/test_cases/sync/bool.out b/ops/op/test_cases/sync/bool.out similarity index 99% rename from ops/op2/test_cases/sync/bool.out rename to ops/op/test_cases/sync/bool.out index e8ac8a678..2f01cface 100644 --- a/ops/op2/test_cases/sync/bool.out +++ b/ops/op/test_cases/sync/bool.out @@ -6,7 +6,7 @@ pub const fn op_bool() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_bool { const NAME: &'static str = stringify!(op_bool); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_bool), false, false, diff --git a/ops/op2/test_cases/sync/bool.rs b/ops/op/test_cases/sync/bool.rs similarity index 93% rename from ops/op2/test_cases/sync/bool.rs rename to ops/op/test_cases/sync/bool.rs index 0091c4ae1..6c2d8a0db 100644 --- a/ops/op2/test_cases/sync/bool.rs +++ b/ops/op/test_cases/sync/bool.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(fast)] +#[op(fast)] pub fn op_bool(arg: bool) -> bool { arg } diff --git a/ops/op2/test_cases/sync/bool_result.out b/ops/op/test_cases/sync/bool_result.out similarity index 99% rename from ops/op2/test_cases/sync/bool_result.out rename to ops/op/test_cases/sync/bool_result.out index e68b19cc4..0c52cc81e 100644 --- a/ops/op2/test_cases/sync/bool_result.out +++ b/ops/op/test_cases/sync/bool_result.out @@ -6,7 +6,7 @@ pub const fn op_bool() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_bool { const NAME: &'static str = stringify!(op_bool); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_bool), false, false, diff --git a/ops/op2/test_cases/sync/bool_result.rs b/ops/op/test_cases/sync/bool_result.rs similarity index 94% rename from ops/op2/test_cases/sync/bool_result.rs rename to ops/op/test_cases/sync/bool_result.rs index 97c76b61f..33c5b1565 100644 --- a/ops/op2/test_cases/sync/bool_result.rs +++ b/ops/op/test_cases/sync/bool_result.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::error::AnyError; -#[op2(fast)] +#[op(fast)] pub fn op_bool(arg: bool) -> Result { Ok(arg) } diff --git a/ops/op2/test_cases/sync/buffers.out b/ops/op/test_cases/sync/buffers.out similarity index 99% rename from ops/op2/test_cases/sync/buffers.out rename to ops/op/test_cases/sync/buffers.out index c45277658..77098b71a 100644 --- a/ops/op2/test_cases/sync/buffers.out +++ b/ops/op/test_cases/sync/buffers.out @@ -6,7 +6,7 @@ const fn op_buffers() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_buffers { const NAME: &'static str = stringify!(op_buffers); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_buffers), false, false, @@ -291,7 +291,7 @@ const fn op_buffers_32() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_buffers_32 { const NAME: &'static str = stringify!(op_buffers_32); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_buffers_32), false, false, @@ -576,7 +576,7 @@ const fn op_buffers_option() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_buffers_option { const NAME: &'static str = stringify!(op_buffers_option); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_buffers_option), false, false, diff --git a/ops/op2/test_cases/sync/buffers.rs b/ops/op/test_cases/sync/buffers.rs similarity index 93% rename from ops/op2/test_cases/sync/buffers.rs rename to ops/op/test_cases/sync/buffers.rs index b9c846bea..4d06531ac 100644 --- a/ops/op2/test_cases/sync/buffers.rs +++ b/ops/op/test_cases/sync/buffers.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::JsBuffer; -#[op2(fast)] +#[op(fast)] fn op_buffers( #[buffer] _a: &[u8], #[buffer] _b: &mut [u8], @@ -13,7 +13,7 @@ fn op_buffers( ) { } -#[op2(fast)] +#[op(fast)] fn op_buffers_32( #[buffer] _a: &[u32], #[buffer] _b: &mut [u32], @@ -22,7 +22,7 @@ fn op_buffers_32( ) { } -#[op2] +#[op] fn op_buffers_option( #[buffer] _a: Option<&[u8]>, #[buffer] _b: Option, diff --git a/ops/op2/test_cases/sync/buffers_copy.out b/ops/op/test_cases/sync/buffers_copy.out similarity index 99% rename from ops/op2/test_cases/sync/buffers_copy.out rename to ops/op/test_cases/sync/buffers_copy.out index 5cf6887f3..9dc31097b 100644 --- a/ops/op2/test_cases/sync/buffers_copy.out +++ b/ops/op/test_cases/sync/buffers_copy.out @@ -6,7 +6,7 @@ const fn op_buffers() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_buffers { const NAME: &'static str = stringify!(op_buffers); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_buffers), false, false, @@ -244,7 +244,7 @@ const fn op_buffers_32() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_buffers_32 { const NAME: &'static str = stringify!(op_buffers_32); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_buffers_32), false, false, diff --git a/ops/op2/test_cases/sync/buffers_copy.rs b/ops/op/test_cases/sync/buffers_copy.rs similarity index 92% rename from ops/op2/test_cases/sync/buffers_copy.rs rename to ops/op/test_cases/sync/buffers_copy.rs index 9cb5ce03c..0647b458f 100644 --- a/ops/op2/test_cases/sync/buffers_copy.rs +++ b/ops/op/test_cases/sync/buffers_copy.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(fast)] +#[op(fast)] fn op_buffers( #[buffer(copy)] _a: Vec, #[buffer(copy)] _b: Box<[u8]>, @@ -10,6 +10,6 @@ fn op_buffers( ) { } -#[op2(fast)] +#[op(fast)] fn op_buffers_32(#[buffer(copy)] _a: Vec, #[buffer(copy)] _b: Box<[u32]>) { } diff --git a/ops/op2/test_cases/sync/buffers_out.out b/ops/op/test_cases/sync/buffers_out.out similarity index 99% rename from ops/op2/test_cases/sync/buffers_out.out rename to ops/op/test_cases/sync/buffers_out.out index 2c27d9fdd..c8f0fa970 100644 --- a/ops/op2/test_cases/sync/buffers_out.out +++ b/ops/op/test_cases/sync/buffers_out.out @@ -6,7 +6,7 @@ const fn op_buffers() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_buffers { const NAME: &'static str = stringify!(op_buffers); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_buffers), false, false, @@ -125,7 +125,7 @@ const fn op_buffers_option() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_buffers_option { const NAME: &'static str = stringify!(op_buffers_option); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_buffers_option), false, false, @@ -254,7 +254,7 @@ const fn op_arraybuffers() -> ::deno_core::_ops::OpDecl { } 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( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_arraybuffers), false, false, diff --git a/ops/op2/test_cases/sync/buffers_out.rs b/ops/op/test_cases/sync/buffers_out.rs similarity index 95% rename from ops/op2/test_cases/sync/buffers_out.rs rename to ops/op/test_cases/sync/buffers_out.rs index 2a205a3f2..e4773c52f 100644 --- a/ops/op2/test_cases/sync/buffers_out.rs +++ b/ops/op/test_cases/sync/buffers_out.rs @@ -4,19 +4,19 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::JsBuffer; -#[op2] +#[op] #[buffer] fn op_buffers(#[buffer] buffer: JsBuffer) -> JsBuffer { buffer } -#[op2] +#[op] #[buffer] fn op_buffers_option(#[buffer] buffer: Option) -> Option { buffer } -#[op2] +#[op] #[arraybuffer] fn op_arraybuffers(#[arraybuffer] buffer: JsBuffer) -> JsBuffer { buffer @@ -24,7 +24,7 @@ fn op_arraybuffers(#[arraybuffer] buffer: JsBuffer) -> JsBuffer { // TODO(mmastrac): Option + Marker doesn't work yet -// #[op2] +// #[op] // #[arraybuffer] // fn op_arraybuffers_option(#[arraybuffer] buffer: Option) -> Option { // buffer diff --git a/ops/op2/test_cases/sync/cfg.out b/ops/op/test_cases/sync/cfg.out similarity index 99% rename from ops/op2/test_cases/sync/cfg.out rename to ops/op/test_cases/sync/cfg.out index 919b70698..0ac98772b 100644 --- a/ops/op2/test_cases/sync/cfg.out +++ b/ops/op/test_cases/sync/cfg.out @@ -8,7 +8,7 @@ pub const fn op_maybe_windows() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_maybe_windows { const NAME: &'static str = stringify!(op_maybe_windows); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_maybe_windows), false, false, @@ -145,7 +145,7 @@ pub const fn op_maybe_windows() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_maybe_windows { const NAME: &'static str = stringify!(op_maybe_windows); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_maybe_windows), false, false, diff --git a/ops/op2/test_cases/sync/cfg.rs b/ops/op/test_cases/sync/cfg.rs similarity index 92% rename from ops/op2/test_cases/sync/cfg.rs rename to ops/op/test_cases/sync/cfg.rs index 18764aa24..cf79c26c4 100644 --- a/ops/op2/test_cases/sync/cfg.rs +++ b/ops/op/test_cases/sync/cfg.rs @@ -3,11 +3,11 @@ deno_ops_compile_test_runner::prelude!(); /// This is a doc comment. -#[op2(fast)] +#[op(fast)] #[cfg(windows)] pub fn op_maybe_windows() -> () {} /// This is a doc comment. -#[op2(fast)] +#[op(fast)] #[cfg(not(windows))] pub fn op_maybe_windows() -> () {} diff --git a/ops/op2/test_cases/sync/clippy_allow.out b/ops/op/test_cases/sync/clippy_allow.out similarity index 99% rename from ops/op2/test_cases/sync/clippy_allow.out rename to ops/op/test_cases/sync/clippy_allow.out index 3fd443775..492766d66 100644 --- a/ops/op2/test_cases/sync/clippy_allow.out +++ b/ops/op/test_cases/sync/clippy_allow.out @@ -8,7 +8,7 @@ pub const fn op_extra_annotation() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_extra_annotation { const NAME: &'static str = stringify!(op_extra_annotation); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_extra_annotation), false, false, @@ -143,7 +143,7 @@ pub const fn op_clippy_internal() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_clippy_internal { const NAME: &'static str = stringify!(op_clippy_internal); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_clippy_internal), false, false, diff --git a/ops/op2/test_cases/sync/clippy_allow.rs b/ops/op/test_cases/sync/clippy_allow.rs similarity index 92% rename from ops/op2/test_cases/sync/clippy_allow.rs rename to ops/op/test_cases/sync/clippy_allow.rs index 3a10ba202..546497a0c 100644 --- a/ops/op2/test_cases/sync/clippy_allow.rs +++ b/ops/op/test_cases/sync/clippy_allow.rs @@ -3,11 +3,11 @@ deno_ops_compile_test_runner::prelude!(); /// This is a doc comment. -#[op2(fast)] +#[op(fast)] #[allow(clippy::some_annotation)] pub fn op_extra_annotation() -> () {} -#[op2(fast)] +#[op(fast)] pub fn op_clippy_internal() -> () { { #![allow(clippy::await_holding_refcell_ref)] diff --git a/ops/op2/test_cases/sync/cppgc_resource.out b/ops/op/test_cases/sync/cppgc_resource.out similarity index 99% rename from ops/op2/test_cases/sync/cppgc_resource.out rename to ops/op/test_cases/sync/cppgc_resource.out index 679411c1e..6925849fd 100644 --- a/ops/op2/test_cases/sync/cppgc_resource.out +++ b/ops/op/test_cases/sync/cppgc_resource.out @@ -6,7 +6,7 @@ const fn op_cppgc_object() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_cppgc_object { const NAME: &'static str = stringify!(op_cppgc_object); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_cppgc_object), false, false, @@ -184,7 +184,7 @@ const fn op_option_cppgc_object() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_option_cppgc_object { const NAME: &'static str = stringify!(op_option_cppgc_object); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_option_cppgc_object), false, false, @@ -387,7 +387,7 @@ const fn op_make_cppgc_object() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_make_cppgc_object { const NAME: &'static str = stringify!(op_make_cppgc_object); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_make_cppgc_object), false, false, @@ -477,7 +477,7 @@ const fn op_use_cppgc_object() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_use_cppgc_object { const NAME: &'static str = stringify!(op_use_cppgc_object); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_use_cppgc_object), false, false, @@ -655,7 +655,7 @@ const fn op_make_cppgc_object_option() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_make_cppgc_object_option { const NAME: &'static str = stringify!(op_make_cppgc_object_option); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_make_cppgc_object_option), false, false, @@ -748,7 +748,7 @@ const fn op_use_cppgc_object_option() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_use_cppgc_object_option { const NAME: &'static str = stringify!(op_use_cppgc_object_option); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_use_cppgc_object_option), false, false, diff --git a/ops/op2/test_cases/sync/cppgc_resource.rs b/ops/op/test_cases/sync/cppgc_resource.rs similarity index 89% rename from ops/op2/test_cases/sync/cppgc_resource.rs rename to ops/op/test_cases/sync/cppgc_resource.rs index 1fad2920d..b91e63167 100644 --- a/ops/op2/test_cases/sync/cppgc_resource.rs +++ b/ops/op/test_cases/sync/cppgc_resource.rs @@ -7,26 +7,26 @@ struct Wrap; impl GarbageCollected for Wrap {} -#[op2(fast)] +#[op(fast)] fn op_cppgc_object(#[cppgc] _resource: &Wrap) {} -#[op2(fast)] +#[op(fast)] fn op_option_cppgc_object(#[cppgc] _resource: Option<&Wrap>) {} -#[op2] +#[op] #[cppgc] fn op_make_cppgc_object() -> Wrap { Wrap } -#[op2(fast)] +#[op(fast)] fn op_use_cppgc_object(#[cppgc] _wrap: &Wrap) {} -#[op2] +#[op] #[cppgc] fn op_make_cppgc_object_option() -> Option { Some(Wrap) } -#[op2(fast)] +#[op(fast)] fn op_use_cppgc_object_option(#[cppgc] _wrap: &Wrap) {} diff --git a/ops/op2/test_cases/sync/doc_comment.out b/ops/op/test_cases/sync/doc_comment.out similarity index 99% rename from ops/op2/test_cases/sync/doc_comment.out rename to ops/op/test_cases/sync/doc_comment.out index 6bf740eec..5af414502 100644 --- a/ops/op2/test_cases/sync/doc_comment.out +++ b/ops/op/test_cases/sync/doc_comment.out @@ -7,7 +7,7 @@ pub const fn op_has_doc_comment() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_has_doc_comment { const NAME: &'static str = stringify!(op_has_doc_comment); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_has_doc_comment), false, false, diff --git a/ops/op2/test_cases/sync/doc_comment.rs b/ops/op/test_cases/sync/doc_comment.rs similarity index 93% rename from ops/op2/test_cases/sync/doc_comment.rs rename to ops/op/test_cases/sync/doc_comment.rs index 84e5bb421..5f8ef4c3c 100644 --- a/ops/op2/test_cases/sync/doc_comment.rs +++ b/ops/op/test_cases/sync/doc_comment.rs @@ -3,5 +3,5 @@ deno_ops_compile_test_runner::prelude!(); /// This is a doc comment. -#[op2(fast)] +#[op(fast)] pub fn op_has_doc_comment() -> () {} diff --git a/ops/op2/test_cases/sync/fast_alternative.out b/ops/op/test_cases/sync/fast_alternative.out similarity index 99% rename from ops/op2/test_cases/sync/fast_alternative.out rename to ops/op/test_cases/sync/fast_alternative.out index 0411e0c1e..55e55b8d1 100644 --- a/ops/op2/test_cases/sync/fast_alternative.out +++ b/ops/op/test_cases/sync/fast_alternative.out @@ -6,7 +6,7 @@ const fn op_slow() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_slow { const NAME: &'static str = stringify!(op_slow); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_slow), false, false, @@ -120,7 +120,7 @@ const fn op_fast() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_fast { const NAME: &'static str = stringify!(op_fast); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_fast), false, false, @@ -296,7 +296,7 @@ const fn op_slow_generic() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_slow_generic { const NAME: &'static str = stringify!(op_slow_generic); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_slow_generic), false, false, @@ -410,7 +410,7 @@ const fn op_fast_generic() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_fast_generic { const NAME: &'static str = stringify!(op_fast_generic); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_fast_generic), false, false, diff --git a/ops/op2/test_cases/sync/fast_alternative.rs b/ops/op/test_cases/sync/fast_alternative.rs similarity index 87% rename from ops/op2/test_cases/sync/fast_alternative.rs rename to ops/op/test_cases/sync/fast_alternative.rs index 663c96d64..942677e03 100644 --- a/ops/op2/test_cases/sync/fast_alternative.rs +++ b/ops/op/test_cases/sync/fast_alternative.rs @@ -5,12 +5,12 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::v8; // Unused scope would normally make this a slow-only op -#[op2(fast(op_fast))] +#[op(fast(op_fast))] fn op_slow(_scope: &v8::HandleScope, a: u32, b: u32) -> u32 { a + b } -#[op2(fast)] +#[op(fast)] fn op_fast(a: u32, b: u32) -> u32 { a + b } @@ -18,12 +18,12 @@ fn op_fast(a: u32, b: u32) -> u32 { pub trait Trait {} // Unused scope would normally make this a slow-only op -#[op2(fast(op_fast_generic::))] +#[op(fast(op_fast_generic::))] fn op_slow_generic(_scope: &v8::HandleScope, a: u32, b: u32) -> u32 { a + b } -#[op2(fast)] +#[op(fast)] fn op_fast_generic(a: u32, b: u32) -> u32 { a + b } diff --git a/ops/op2/test_cases/sync/from_v8.out b/ops/op/test_cases/sync/from_v8.out similarity index 99% rename from ops/op2/test_cases/sync/from_v8.out rename to ops/op/test_cases/sync/from_v8.out index 0e7b574e2..391417d17 100644 --- a/ops/op2/test_cases/sync/from_v8.out +++ b/ops/op/test_cases/sync/from_v8.out @@ -6,7 +6,7 @@ pub const fn op_from_v8_arg() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_from_v8_arg { const NAME: &'static str = stringify!(op_from_v8_arg); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_from_v8_arg), false, false, diff --git a/ops/op2/test_cases/sync/from_v8.rs b/ops/op/test_cases/sync/from_v8.rs similarity index 98% rename from ops/op2/test_cases/sync/from_v8.rs rename to ops/op/test_cases/sync/from_v8.rs index 2649c5127..aaa1ae0f3 100644 --- a/ops/op2/test_cases/sync/from_v8.rs +++ b/ops/op/test_cases/sync/from_v8.rs @@ -16,7 +16,7 @@ impl<'a> FromV8<'a> for Foo { } } -#[op2] +#[op] #[from_v8] pub fn op_from_v8_arg(#[from_v8] foo: Foo) { let _ = foo; diff --git a/ops/op2/test_cases/sync/generics.out b/ops/op/test_cases/sync/generics.out similarity index 99% rename from ops/op2/test_cases/sync/generics.out rename to ops/op/test_cases/sync/generics.out index 1e893d00b..dd9a51076 100644 --- a/ops/op2/test_cases/sync/generics.out +++ b/ops/op/test_cases/sync/generics.out @@ -6,7 +6,7 @@ pub const fn op_generics() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_generics { const NAME: &'static str = stringify!(op_generics); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_generics), false, false, @@ -139,7 +139,7 @@ pub const fn op_generics_static() -> ::deno_core::_ops::OpDe } impl ::deno_core::_ops::Op for op_generics_static { const NAME: &'static str = stringify!(op_generics_static); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_generics_static), false, false, @@ -272,7 +272,7 @@ pub const fn op_generics_static_where() -> ::deno_core::_ops } impl ::deno_core::_ops::Op for op_generics_static_where { const NAME: &'static str = stringify!(op_generics_static_where); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_generics_static_where), false, false, diff --git a/ops/op2/test_cases/sync/generics.rs b/ops/op/test_cases/sync/generics.rs similarity index 88% rename from ops/op2/test_cases/sync/generics.rs rename to ops/op/test_cases/sync/generics.rs index 7465aef8c..85f95de79 100644 --- a/ops/op2/test_cases/sync/generics.rs +++ b/ops/op/test_cases/sync/generics.rs @@ -4,13 +4,13 @@ deno_ops_compile_test_runner::prelude!(); pub trait Trait {} -#[op2(fast)] +#[op(fast)] pub fn op_generics() {} -#[op2(fast)] +#[op(fast)] pub fn op_generics_static() {} -#[op2(fast)] +#[op(fast)] pub fn op_generics_static_where() where T: Trait + 'static, diff --git a/ops/op2/test_cases/sync/nofast.out b/ops/op/test_cases/sync/nofast.out similarity index 99% rename from ops/op2/test_cases/sync/nofast.out rename to ops/op/test_cases/sync/nofast.out index 8ad81088a..6c4853b68 100644 --- a/ops/op2/test_cases/sync/nofast.out +++ b/ops/op/test_cases/sync/nofast.out @@ -6,7 +6,7 @@ const fn op_nofast() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_nofast { const NAME: &'static str = stringify!(op_nofast); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_nofast), false, false, diff --git a/ops/op2/test_cases/sync/nofast.rs b/ops/op/test_cases/sync/nofast.rs similarity index 92% rename from ops/op2/test_cases/sync/nofast.rs rename to ops/op/test_cases/sync/nofast.rs index 6046fb0ac..1c1fcc75e 100644 --- a/ops/op2/test_cases/sync/nofast.rs +++ b/ops/op/test_cases/sync/nofast.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(nofast)] +#[op(nofast)] fn op_nofast(a: u32, b: u32) -> u32 { a + b } diff --git a/ops/op2/test_cases/sync/op_state_attr.out b/ops/op/test_cases/sync/op_state_attr.out similarity index 99% rename from ops/op2/test_cases/sync/op_state_attr.out rename to ops/op/test_cases/sync/op_state_attr.out index 43aad7645..374ac2962 100644 --- a/ops/op2/test_cases/sync/op_state_attr.out +++ b/ops/op/test_cases/sync/op_state_attr.out @@ -6,7 +6,7 @@ const fn op_state_rc() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_state_rc { const NAME: &'static str = stringify!(op_state_rc); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_state_rc), false, false, diff --git a/ops/op2/test_cases/sync/op_state_attr.rs b/ops/op/test_cases/sync/op_state_attr.rs similarity index 96% rename from ops/op2/test_cases/sync/op_state_attr.rs rename to ops/op/test_cases/sync/op_state_attr.rs index c7e535201..05867e3a9 100644 --- a/ops/op2/test_cases/sync/op_state_attr.rs +++ b/ops/op/test_cases/sync/op_state_attr.rs @@ -10,7 +10,7 @@ use std::borrow::BorrowMut; struct Something {} -#[op2(fast)] +#[op(fast)] fn op_state_rc( #[state] _arg: &Something, #[state] _arg_opt: Option<&Something>, diff --git a/ops/op2/test_cases/sync/op_state_rc.out b/ops/op/test_cases/sync/op_state_rc.out similarity index 99% rename from ops/op2/test_cases/sync/op_state_rc.out rename to ops/op/test_cases/sync/op_state_rc.out index eb683ea0d..1bf6a7d50 100644 --- a/ops/op2/test_cases/sync/op_state_rc.out +++ b/ops/op/test_cases/sync/op_state_rc.out @@ -6,7 +6,7 @@ const fn op_state_rc() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_state_rc { const NAME: &'static str = stringify!(op_state_rc); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_state_rc), false, false, diff --git a/ops/op2/test_cases/sync/op_state_rc.rs b/ops/op/test_cases/sync/op_state_rc.rs similarity index 95% rename from ops/op2/test_cases/sync/op_state_rc.rs rename to ops/op/test_cases/sync/op_state_rc.rs index 56687fe85..620c842cb 100644 --- a/ops/op2/test_cases/sync/op_state_rc.rs +++ b/ops/op/test_cases/sync/op_state_rc.rs @@ -6,5 +6,5 @@ use deno_core::OpState; use std::cell::RefCell; use std::rc::Rc; -#[op2(fast)] +#[op(fast)] fn op_state_rc(_state: Rc>) {} diff --git a/ops/op2/test_cases/sync/op_state_ref.out b/ops/op/test_cases/sync/op_state_ref.out similarity index 99% rename from ops/op2/test_cases/sync/op_state_ref.out rename to ops/op/test_cases/sync/op_state_ref.out index a6bbe69fd..a1d0f96ea 100644 --- a/ops/op2/test_cases/sync/op_state_ref.out +++ b/ops/op/test_cases/sync/op_state_ref.out @@ -6,7 +6,7 @@ const fn op_state_ref() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_state_ref { const NAME: &'static str = stringify!(op_state_ref); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_state_ref), false, false, @@ -165,7 +165,7 @@ const fn op_state_mut() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_state_mut { const NAME: &'static str = stringify!(op_state_mut); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_state_mut), false, false, @@ -324,7 +324,7 @@ const fn op_state_and_v8() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_state_and_v8 { const NAME: &'static str = stringify!(op_state_and_v8); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_state_and_v8), false, false, @@ -431,7 +431,7 @@ const fn op_state_and_v8_local() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_state_and_v8_local { const NAME: &'static str = stringify!(op_state_and_v8_local); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_state_and_v8_local), false, false, diff --git a/ops/op2/test_cases/sync/op_state_ref.rs b/ops/op/test_cases/sync/op_state_ref.rs similarity index 92% rename from ops/op2/test_cases/sync/op_state_ref.rs rename to ops/op/test_cases/sync/op_state_ref.rs index 8f2d67d17..d1742c38f 100644 --- a/ops/op2/test_cases/sync/op_state_ref.rs +++ b/ops/op/test_cases/sync/op_state_ref.rs @@ -11,20 +11,20 @@ use std::borrow::Borrow; #[allow(unused)] use std::borrow::BorrowMut; -#[op2(fast)] +#[op(fast)] fn op_state_ref(_state: &OpState) {} -#[op2(fast)] +#[op(fast)] fn op_state_mut(_state: &mut OpState) {} -#[op2] +#[op] fn op_state_and_v8( _state: &mut OpState, #[global] _callback: v8::Global, ) { } -#[op2(fast)] +#[op(fast)] fn op_state_and_v8_local( _state: &mut OpState, _callback: v8::Local, diff --git a/ops/op2/test_cases/sync/result_external.out b/ops/op/test_cases/sync/result_external.out similarity index 99% rename from ops/op2/test_cases/sync/result_external.out rename to ops/op/test_cases/sync/result_external.out index 84bfab461..e7663ef0d 100644 --- a/ops/op2/test_cases/sync/result_external.out +++ b/ops/op/test_cases/sync/result_external.out @@ -6,7 +6,7 @@ pub const fn op_external_with_result() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_external_with_result { const NAME: &'static str = stringify!(op_external_with_result); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_external_with_result), false, false, diff --git a/ops/op2/test_cases/sync/result_external.rs b/ops/op/test_cases/sync/result_external.rs similarity index 95% rename from ops/op2/test_cases/sync/result_external.rs rename to ops/op/test_cases/sync/result_external.rs index 6566136c5..2e8e3f37b 100644 --- a/ops/op2/test_cases/sync/result_external.rs +++ b/ops/op/test_cases/sync/result_external.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::error::AnyError; -#[op2(fast)] +#[op(fast)] pub fn op_external_with_result() -> Result<*mut std::ffi::c_void, AnyError> { Ok(0 as _) } diff --git a/ops/op2/test_cases/sync/result_primitive.out b/ops/op/test_cases/sync/result_primitive.out similarity index 99% rename from ops/op2/test_cases/sync/result_primitive.out rename to ops/op/test_cases/sync/result_primitive.out index a4e22165e..b48c217be 100644 --- a/ops/op2/test_cases/sync/result_primitive.out +++ b/ops/op/test_cases/sync/result_primitive.out @@ -6,7 +6,7 @@ pub const fn op_u32_with_result() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_u32_with_result { const NAME: &'static str = stringify!(op_u32_with_result); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_u32_with_result), false, false, diff --git a/ops/op2/test_cases/sync/result_primitive.rs b/ops/op/test_cases/sync/result_primitive.rs similarity index 94% rename from ops/op2/test_cases/sync/result_primitive.rs rename to ops/op/test_cases/sync/result_primitive.rs index 5aaeb9757..40943f88b 100644 --- a/ops/op2/test_cases/sync/result_primitive.rs +++ b/ops/op/test_cases/sync/result_primitive.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::error::AnyError; -#[op2(fast)] +#[op(fast)] pub fn op_u32_with_result() -> Result { Ok(0) } diff --git a/ops/op2/test_cases/sync/result_scope.out b/ops/op/test_cases/sync/result_scope.out similarity index 99% rename from ops/op2/test_cases/sync/result_scope.out rename to ops/op/test_cases/sync/result_scope.out index f9f16583c..38a7fdc32 100644 --- a/ops/op2/test_cases/sync/result_scope.out +++ b/ops/op/test_cases/sync/result_scope.out @@ -6,7 +6,7 @@ pub const fn op_void_with_result() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_void_with_result { const NAME: &'static str = stringify!(op_void_with_result); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_void_with_result), false, false, diff --git a/ops/op2/test_cases/sync/result_scope.rs b/ops/op/test_cases/sync/result_scope.rs similarity index 97% rename from ops/op2/test_cases/sync/result_scope.rs rename to ops/op/test_cases/sync/result_scope.rs index b2b59b6b9..dbf6fdf35 100644 --- a/ops/op2/test_cases/sync/result_scope.rs +++ b/ops/op/test_cases/sync/result_scope.rs @@ -5,7 +5,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::error::AnyError; use deno_core::v8; -#[op2] +#[op] pub fn op_void_with_result( _scope: &mut v8::HandleScope, ) -> Result<(), AnyError> { diff --git a/ops/op2/test_cases/sync/result_void.out b/ops/op/test_cases/sync/result_void.out similarity index 99% rename from ops/op2/test_cases/sync/result_void.out rename to ops/op/test_cases/sync/result_void.out index c37b3c0c7..9f31544e0 100644 --- a/ops/op2/test_cases/sync/result_void.out +++ b/ops/op/test_cases/sync/result_void.out @@ -6,7 +6,7 @@ pub const fn op_void_with_result() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_void_with_result { const NAME: &'static str = stringify!(op_void_with_result); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_void_with_result), false, false, diff --git a/ops/op2/test_cases/sync/result_void.rs b/ops/op/test_cases/sync/result_void.rs similarity index 93% rename from ops/op2/test_cases/sync/result_void.rs rename to ops/op/test_cases/sync/result_void.rs index 0014c07ce..4eb7fd9b6 100644 --- a/ops/op2/test_cases/sync/result_void.rs +++ b/ops/op/test_cases/sync/result_void.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(fast)] +#[op(fast)] pub fn op_void_with_result() -> std::io::Result<()> { Ok(()) } diff --git a/ops/op2/test_cases/sync/serde_v8.out b/ops/op/test_cases/sync/serde_v8.out similarity index 99% rename from ops/op2/test_cases/sync/serde_v8.out rename to ops/op/test_cases/sync/serde_v8.out index 44aaeb9e9..1c81a2898 100644 --- a/ops/op2/test_cases/sync/serde_v8.out +++ b/ops/op/test_cases/sync/serde_v8.out @@ -6,7 +6,7 @@ pub const fn op_serde_v8() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_serde_v8 { const NAME: &'static str = stringify!(op_serde_v8); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_serde_v8), false, false, diff --git a/ops/op2/test_cases/sync/serde_v8.rs b/ops/op/test_cases/sync/serde_v8.rs similarity index 98% rename from ops/op2/test_cases/sync/serde_v8.rs rename to ops/op/test_cases/sync/serde_v8.rs index 8066750ac..5f8bf5bb9 100644 --- a/ops/op2/test_cases/sync/serde_v8.rs +++ b/ops/op/test_cases/sync/serde_v8.rs @@ -10,7 +10,7 @@ pub struct Input {} #[derive(Serialize, Deserialize)] pub struct Output {} -#[op2] +#[op] #[serde] pub fn op_serde_v8(#[serde] _input: Input) -> Output { Output {} diff --git a/ops/op2/test_cases/sync/smi.out b/ops/op/test_cases/sync/smi.out similarity index 99% rename from ops/op2/test_cases/sync/smi.out rename to ops/op/test_cases/sync/smi.out index 0c8e9d25b..dbde7890c 100644 --- a/ops/op2/test_cases/sync/smi.out +++ b/ops/op/test_cases/sync/smi.out @@ -6,7 +6,7 @@ const fn op_smi_unsigned_return() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_smi_unsigned_return { const NAME: &'static str = stringify!(op_smi_unsigned_return); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_smi_unsigned_return), false, false, @@ -229,7 +229,7 @@ const fn op_smi_signed_return() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_smi_signed_return { const NAME: &'static str = stringify!(op_smi_signed_return); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_smi_signed_return), false, false, @@ -452,7 +452,7 @@ const fn op_smi_option() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_smi_option { const NAME: &'static str = stringify!(op_smi_option); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_smi_option), false, false, diff --git a/ops/op2/test_cases/sync/smi.rs b/ops/op/test_cases/sync/smi.rs similarity index 95% rename from ops/op2/test_cases/sync/smi.rs rename to ops/op/test_cases/sync/smi.rs index 4f3b43438..bd3e094b6 100644 --- a/ops/op2/test_cases/sync/smi.rs +++ b/ops/op/test_cases/sync/smi.rs @@ -7,7 +7,7 @@ pub type Int32 = i32; pub type Uint16 = u16; pub type Uint32 = u32; -#[op2(fast)] +#[op(fast)] #[smi] fn op_smi_unsigned_return( #[smi] a: Int16, @@ -18,7 +18,7 @@ fn op_smi_unsigned_return( a as Uint32 + b as Uint32 + c as Uint32 + d as Uint32 } -#[op2(fast)] +#[op(fast)] #[smi] fn op_smi_signed_return( #[smi] a: Int16, @@ -29,7 +29,7 @@ fn op_smi_signed_return( a as Int32 + b as Int32 + c as Int32 + d as Int32 } -#[op2] +#[op] #[smi] fn op_smi_option(#[smi] a: Option) -> Option { a diff --git a/ops/op2/test_cases/sync/string_cow.out b/ops/op/test_cases/sync/string_cow.out similarity index 99% rename from ops/op2/test_cases/sync/string_cow.out rename to ops/op/test_cases/sync/string_cow.out index 30701d3de..6ccf80b08 100644 --- a/ops/op2/test_cases/sync/string_cow.out +++ b/ops/op/test_cases/sync/string_cow.out @@ -6,7 +6,7 @@ const fn op_string_cow() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_cow { const NAME: &'static str = stringify!(op_string_cow); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_cow), false, false, diff --git a/ops/op2/test_cases/sync/string_cow.rs b/ops/op/test_cases/sync/string_cow.rs similarity index 94% rename from ops/op2/test_cases/sync/string_cow.rs rename to ops/op/test_cases/sync/string_cow.rs index 365cf58d3..500b19d16 100644 --- a/ops/op2/test_cases/sync/string_cow.rs +++ b/ops/op/test_cases/sync/string_cow.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use std::borrow::Cow; -#[op2(fast)] +#[op(fast)] fn op_string_cow(#[string] s: Cow) -> u32 { s.len() as _ } diff --git a/ops/op2/test_cases/sync/string_onebyte.out b/ops/op/test_cases/sync/string_onebyte.out similarity index 99% rename from ops/op2/test_cases/sync/string_onebyte.out rename to ops/op/test_cases/sync/string_onebyte.out index a4640ec3c..9890eb48f 100644 --- a/ops/op2/test_cases/sync/string_onebyte.out +++ b/ops/op/test_cases/sync/string_onebyte.out @@ -6,7 +6,7 @@ const fn op_string_onebyte() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_onebyte { const NAME: &'static str = stringify!(op_string_onebyte); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_onebyte), false, false, diff --git a/ops/op2/test_cases/sync/string_onebyte.rs b/ops/op/test_cases/sync/string_onebyte.rs similarity index 94% rename from ops/op2/test_cases/sync/string_onebyte.rs rename to ops/op/test_cases/sync/string_onebyte.rs index 460730cae..5606cd07d 100644 --- a/ops/op2/test_cases/sync/string_onebyte.rs +++ b/ops/op/test_cases/sync/string_onebyte.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use std::borrow::Cow; -#[op2(fast)] +#[op(fast)] fn op_string_onebyte(#[string(onebyte)] s: Cow<[u8]>) -> u32 { s.len() as _ } diff --git a/ops/op2/test_cases/sync/string_option_return.out b/ops/op/test_cases/sync/string_option_return.out similarity index 99% rename from ops/op2/test_cases/sync/string_option_return.out rename to ops/op/test_cases/sync/string_option_return.out index 1fc02fc29..70371a6b5 100644 --- a/ops/op2/test_cases/sync/string_option_return.out +++ b/ops/op/test_cases/sync/string_option_return.out @@ -6,7 +6,7 @@ pub const fn op_string_return() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_return { const NAME: &'static str = stringify!(op_string_return); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_return), false, false, diff --git a/ops/op2/test_cases/sync/string_option_return.rs b/ops/op/test_cases/sync/string_option_return.rs similarity index 96% rename from ops/op2/test_cases/sync/string_option_return.rs rename to ops/op/test_cases/sync/string_option_return.rs index 9618b1e22..9181c98d7 100644 --- a/ops/op2/test_cases/sync/string_option_return.rs +++ b/ops/op/test_cases/sync/string_option_return.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2] +#[op] #[string] pub fn op_string_return(#[string] s: Option) -> Option { s diff --git a/ops/op2/test_cases/sync/string_owned.out b/ops/op/test_cases/sync/string_owned.out similarity index 99% rename from ops/op2/test_cases/sync/string_owned.out rename to ops/op/test_cases/sync/string_owned.out index d5fa0724e..ffdf5d30b 100644 --- a/ops/op2/test_cases/sync/string_owned.out +++ b/ops/op/test_cases/sync/string_owned.out @@ -6,7 +6,7 @@ const fn op_string_owned() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_owned { const NAME: &'static str = stringify!(op_string_owned); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_owned), false, false, diff --git a/ops/op2/test_cases/sync/string_owned.rs b/ops/op/test_cases/sync/string_owned.rs similarity index 93% rename from ops/op2/test_cases/sync/string_owned.rs rename to ops/op/test_cases/sync/string_owned.rs index ab4ac4032..84725b46a 100644 --- a/ops/op2/test_cases/sync/string_owned.rs +++ b/ops/op/test_cases/sync/string_owned.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(fast)] +#[op(fast)] fn op_string_owned(#[string] s: String) -> u32 { s.len() as _ } diff --git a/ops/op2/test_cases/sync/string_ref.out b/ops/op/test_cases/sync/string_ref.out similarity index 99% rename from ops/op2/test_cases/sync/string_ref.out rename to ops/op/test_cases/sync/string_ref.out index 75019c506..4837b794d 100644 --- a/ops/op2/test_cases/sync/string_ref.out +++ b/ops/op/test_cases/sync/string_ref.out @@ -6,7 +6,7 @@ const fn op_string_owned() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_owned { const NAME: &'static str = stringify!(op_string_owned); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_owned), false, false, diff --git a/ops/op2/test_cases/sync/string_ref.rs b/ops/op/test_cases/sync/string_ref.rs similarity index 93% rename from ops/op2/test_cases/sync/string_ref.rs rename to ops/op/test_cases/sync/string_ref.rs index 87d03dacf..bc05d0947 100644 --- a/ops/op2/test_cases/sync/string_ref.rs +++ b/ops/op/test_cases/sync/string_ref.rs @@ -2,7 +2,7 @@ #![deny(warnings)] deno_ops_compile_test_runner::prelude!(); -#[op2(fast)] +#[op(fast)] fn op_string_owned(#[string] s: &str) -> u32 { s.len() as _ } diff --git a/ops/op2/test_cases/sync/string_return.out b/ops/op/test_cases/sync/string_return.out similarity index 99% rename from ops/op2/test_cases/sync/string_return.out rename to ops/op/test_cases/sync/string_return.out index 148c3f180..968923e8d 100644 --- a/ops/op2/test_cases/sync/string_return.out +++ b/ops/op/test_cases/sync/string_return.out @@ -6,7 +6,7 @@ pub const fn op_string_return() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_return { const NAME: &'static str = stringify!(op_string_return); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_return), false, false, @@ -100,7 +100,7 @@ pub const fn op_string_return_ref() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_return_ref { const NAME: &'static str = stringify!(op_string_return_ref); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_return_ref), false, false, @@ -194,7 +194,7 @@ pub const fn op_string_return_cow() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_string_return_cow { const NAME: &'static str = stringify!(op_string_return_cow); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_string_return_cow), false, false, diff --git a/ops/op2/test_cases/sync/string_return.rs b/ops/op/test_cases/sync/string_return.rs similarity index 94% rename from ops/op2/test_cases/sync/string_return.rs rename to ops/op/test_cases/sync/string_return.rs index 00c60f85a..5b66390d6 100644 --- a/ops/op2/test_cases/sync/string_return.rs +++ b/ops/op/test_cases/sync/string_return.rs @@ -3,19 +3,19 @@ deno_ops_compile_test_runner::prelude!(); use std::borrow::Cow; -#[op2] +#[op] #[string] pub fn op_string_return() -> String { "".into() } -#[op2] +#[op] #[string] pub fn op_string_return_ref() -> &'static str { "" } -#[op2] +#[op] #[string] pub fn op_string_return_cow<'a>() -> Cow<'a, str> { "".into() diff --git a/ops/op2/test_cases/sync/to_v8.out b/ops/op/test_cases/sync/to_v8.out similarity index 99% rename from ops/op2/test_cases/sync/to_v8.out rename to ops/op/test_cases/sync/to_v8.out index 6404902cf..0d517fe38 100644 --- a/ops/op2/test_cases/sync/to_v8.out +++ b/ops/op/test_cases/sync/to_v8.out @@ -6,7 +6,7 @@ pub const fn op_to_v8_return() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_to_v8_return { const NAME: &'static str = stringify!(op_to_v8_return); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_to_v8_return), false, false, diff --git a/ops/op2/test_cases/sync/to_v8.rs b/ops/op/test_cases/sync/to_v8.rs similarity index 98% rename from ops/op2/test_cases/sync/to_v8.rs rename to ops/op/test_cases/sync/to_v8.rs index 3a26df9c5..6e0d5aaee 100644 --- a/ops/op2/test_cases/sync/to_v8.rs +++ b/ops/op/test_cases/sync/to_v8.rs @@ -16,7 +16,7 @@ impl<'a> ToV8<'a> for Foo { } } -#[op2] +#[op] #[to_v8] pub fn op_to_v8_return() -> Foo { Foo diff --git a/ops/op2/test_cases/sync/v8_global.out b/ops/op/test_cases/sync/v8_global.out similarity index 99% rename from ops/op2/test_cases/sync/v8_global.out rename to ops/op/test_cases/sync/v8_global.out index a78321367..b8fce326d 100644 --- a/ops/op2/test_cases/sync/v8_global.out +++ b/ops/op/test_cases/sync/v8_global.out @@ -6,7 +6,7 @@ pub const fn op_global() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_global { const NAME: &'static str = stringify!(op_global); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_global), false, false, diff --git a/ops/op2/test_cases/sync/v8_global.rs b/ops/op/test_cases/sync/v8_global.rs similarity index 97% rename from ops/op2/test_cases/sync/v8_global.rs rename to ops/op/test_cases/sync/v8_global.rs index 9c9b91d30..16ee72db5 100644 --- a/ops/op2/test_cases/sync/v8_global.rs +++ b/ops/op/test_cases/sync/v8_global.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::v8; -#[op2] +#[op] #[global] pub fn op_global( #[global] g: v8::Global, diff --git a/ops/op2/test_cases/sync/v8_handlescope.out b/ops/op/test_cases/sync/v8_handlescope.out similarity index 99% rename from ops/op2/test_cases/sync/v8_handlescope.out rename to ops/op/test_cases/sync/v8_handlescope.out index d4f5da101..8790d6c9d 100644 --- a/ops/op2/test_cases/sync/v8_handlescope.out +++ b/ops/op/test_cases/sync/v8_handlescope.out @@ -6,7 +6,7 @@ const fn op_handlescope() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_handlescope { const NAME: &'static str = stringify!(op_handlescope); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_handlescope), false, false, diff --git a/ops/op2/test_cases/sync/v8_handlescope.rs b/ops/op/test_cases/sync/v8_handlescope.rs similarity index 97% rename from ops/op2/test_cases/sync/v8_handlescope.rs rename to ops/op/test_cases/sync/v8_handlescope.rs index 549a4c30f..bb192fa5c 100644 --- a/ops/op2/test_cases/sync/v8_handlescope.rs +++ b/ops/op/test_cases/sync/v8_handlescope.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::v8; -#[op2] +#[op] fn op_handlescope<'a>( _scope: &v8::HandleScope<'a>, _str2: v8::Local, diff --git a/ops/op2/test_cases/sync/v8_lifetime.out b/ops/op/test_cases/sync/v8_lifetime.out similarity index 99% rename from ops/op2/test_cases/sync/v8_lifetime.out rename to ops/op/test_cases/sync/v8_lifetime.out index 1d0ee896c..b78363b31 100644 --- a/ops/op2/test_cases/sync/v8_lifetime.out +++ b/ops/op/test_cases/sync/v8_lifetime.out @@ -6,7 +6,7 @@ pub const fn op_v8_lifetime() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_v8_lifetime { const NAME: &'static str = stringify!(op_v8_lifetime); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_v8_lifetime), false, false, diff --git a/ops/op2/test_cases/sync/v8_lifetime.rs b/ops/op/test_cases/sync/v8_lifetime.rs similarity index 97% rename from ops/op2/test_cases/sync/v8_lifetime.rs rename to ops/op/test_cases/sync/v8_lifetime.rs index e66ad3289..0b68b1df5 100644 --- a/ops/op2/test_cases/sync/v8_lifetime.rs +++ b/ops/op/test_cases/sync/v8_lifetime.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::v8; -#[op2] +#[op] pub fn op_v8_lifetime<'s>( _s: v8::Local<'s, v8::String>, ) -> v8::Local<'s, v8::String> { diff --git a/ops/op2/test_cases/sync/v8_ref_option.out b/ops/op/test_cases/sync/v8_ref_option.out similarity index 99% rename from ops/op2/test_cases/sync/v8_ref_option.out rename to ops/op/test_cases/sync/v8_ref_option.out index 2b6310935..1398f5387 100644 --- a/ops/op2/test_cases/sync/v8_ref_option.out +++ b/ops/op/test_cases/sync/v8_ref_option.out @@ -6,7 +6,7 @@ pub const fn op_v8_lifetime() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_v8_lifetime { const NAME: &'static str = stringify!(op_v8_lifetime); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_v8_lifetime), false, false, diff --git a/ops/op2/test_cases/sync/v8_ref_option.rs b/ops/op/test_cases/sync/v8_ref_option.rs similarity index 94% rename from ops/op2/test_cases/sync/v8_ref_option.rs rename to ops/op/test_cases/sync/v8_ref_option.rs index 1e655d91f..6dfd73c04 100644 --- a/ops/op2/test_cases/sync/v8_ref_option.rs +++ b/ops/op/test_cases/sync/v8_ref_option.rs @@ -4,5 +4,5 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::v8; -#[op2(fast)] +#[op(fast)] pub fn op_v8_lifetime<'s>(_s: Option<&v8::String>, _s2: Option<&v8::String>) {} diff --git a/ops/op2/test_cases/sync/v8_string.out b/ops/op/test_cases/sync/v8_string.out similarity index 99% rename from ops/op2/test_cases/sync/v8_string.out rename to ops/op/test_cases/sync/v8_string.out index 0d8d5fd6a..a91d44078 100644 --- a/ops/op2/test_cases/sync/v8_string.out +++ b/ops/op/test_cases/sync/v8_string.out @@ -6,7 +6,7 @@ const fn op_v8_string() -> ::deno_core::_ops::OpDecl { } impl ::deno_core::_ops::Op for op_v8_string { const NAME: &'static str = stringify!(op_v8_string); - const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op2( + const DECL: ::deno_core::_ops::OpDecl = ::deno_core::_ops::OpDecl::new_internal_op( ::deno_core::__op_name_fast!(op_v8_string), false, false, diff --git a/ops/op2/test_cases/sync/v8_string.rs b/ops/op/test_cases/sync/v8_string.rs similarity index 97% rename from ops/op2/test_cases/sync/v8_string.rs rename to ops/op/test_cases/sync/v8_string.rs index 0935dc854..265b44003 100644 --- a/ops/op2/test_cases/sync/v8_string.rs +++ b/ops/op/test_cases/sync/v8_string.rs @@ -4,7 +4,7 @@ deno_ops_compile_test_runner::prelude!(); use deno_core::v8; -#[op2] +#[op] fn op_v8_string<'a>( _str1: &v8::String, _str2: v8::Local, diff --git a/ops/op2/test_cases_fail/lifetimes.rs b/ops/op/test_cases_fail/lifetimes.rs similarity index 93% rename from ops/op2/test_cases_fail/lifetimes.rs rename to ops/op/test_cases_fail/lifetimes.rs index adb486371..d928eb2d4 100644 --- a/ops/op2/test_cases_fail/lifetimes.rs +++ b/ops/op/test_cases_fail/lifetimes.rs @@ -9,8 +9,8 @@ struct Wrap; impl GarbageCollected for Wrap {} -#[op2(fast)] +#[op(fast)] fn op_use_cppgc_object(#[cppgc] _wrap: &'static Wrap) {} -#[op2(fast)] +#[op(fast)] fn op_use_buffer(#[buffer] _buffer: &'static [u8]) {} diff --git a/ops/op2/test_cases_fail/lifetimes.stderr b/ops/op/test_cases_fail/lifetimes.stderr similarity index 64% rename from ops/op2/test_cases_fail/lifetimes.stderr rename to ops/op/test_cases_fail/lifetimes.stderr index f20ff7fcb..8ed548f99 100644 --- a/ops/op2/test_cases_fail/lifetimes.stderr +++ b/ops/op/test_cases_fail/lifetimes.stderr @@ -1,42 +1,42 @@ error: unused import: `deno_core::error::AnyError` - --> ../op2/test_cases_fail/lifetimes.rs:4:5 + --> ../op/test_cases_fail/lifetimes.rs:4:5 | 4 | use deno_core::error::AnyError; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> ../op2/test_cases_fail/lifetimes.rs:2:9 + --> ../op/test_cases_fail/lifetimes.rs:2:9 | 2 | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(unused_imports)]` implied by `#[deny(warnings)]` error: unused import: `std::future::Future` - --> ../op2/test_cases_fail/lifetimes.rs:6:5 + --> ../op/test_cases_fail/lifetimes.rs:6:5 | 6 | use std::future::Future; | ^^^^^^^^^^^^^^^^^^^ error[E0597]: `handle_` does not live long enough - --> ../op2/test_cases_fail/lifetimes.rs:12:1 + --> ../op/test_cases_fail/lifetimes.rs:12:1 | -12 | #[op2(fast)] +12 | #[op(fast)] | ^^^^^^^^^^^- | | | | | `handle_` dropped here while still borrowed | borrowed value does not live long enough | argument requires that `handle_` is borrowed for `'static` | - = note: this error originates in the attribute macro `op2` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0597]: `arg0_temp` does not live long enough - --> ../op2/test_cases_fail/lifetimes.rs:15:1 + --> ../op/test_cases_fail/lifetimes.rs:15:1 | -15 | #[op2(fast)] +15 | #[op(fast)] | ^^^^^^^^^^^- | | | | | `arg0_temp` dropped here while still borrowed | borrowed value does not live long enough | argument requires that `arg0_temp` is borrowed for `'static` | - = note: this error originates in the attribute macro `op2` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/ops/op2/valid_args.md b/ops/op/valid_args.md similarity index 100% rename from ops/op2/valid_args.md rename to ops/op/valid_args.md diff --git a/ops/op2/valid_retvals.md b/ops/op/valid_retvals.md similarity index 100% rename from ops/op2/valid_retvals.md rename to ops/op/valid_retvals.md diff --git a/testing/checkin/runner/ops.rs b/testing/checkin/runner/ops.rs index 24eb3fe4c..43240168d 100644 --- a/testing/checkin/runner/ops.rs +++ b/testing/checkin/runner/ops.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use std::rc::Rc; -use deno_core::op2; +use deno_core::op; use deno_core::stats::RuntimeActivityDiff; use deno_core::stats::RuntimeActivitySnapshot; use deno_core::stats::RuntimeActivityStats; @@ -16,18 +16,18 @@ use super::extensions::SomeType; use super::Output; use super::TestData; -#[op2(fast)] +#[op(fast)] pub fn op_log_debug(#[string] s: &str) { println!("{s}"); } -#[op2(fast)] +#[op(fast)] pub fn op_log_info(#[state] output: &mut Output, #[string] s: String) { println!("{s}"); output.line(s); } -#[op2(fast)] +#[op(fast)] pub fn op_stats_capture(#[string] name: String, state: Rc>) { let stats = state .borrow() @@ -39,7 +39,7 @@ pub fn op_stats_capture(#[string] name: String, state: Rc>) { test_data.insert(name, data); } -#[op2] +#[op] #[serde] pub fn op_stats_dump( #[string] name: String, @@ -49,7 +49,7 @@ pub fn op_stats_dump( stats.dump() } -#[op2] +#[op] #[serde] pub fn op_stats_diff( #[string] before: String, @@ -61,7 +61,7 @@ pub fn op_stats_diff( RuntimeActivityStats::diff(before, after) } -#[op2(fast)] +#[op(fast)] pub fn op_stats_delete( #[string] name: String, #[state] test_data: &mut TestData, @@ -76,19 +76,19 @@ pub struct Stateful { impl GarbageCollected for Stateful {} impl Stateful { - #[op2(method(Stateful))] + #[op(method(Stateful))] #[string] fn get_name(&self) -> String { self.name.clone() } - #[op2(fast, method(Stateful))] + #[op(fast, method(Stateful))] #[smi] fn len(&self) -> u32 { self.name.len() as u32 } - #[op2(async, method(Stateful))] + #[op(async, method(Stateful))] async fn delay(&self, #[smi] millis: u32) { tokio::time::sleep(std::time::Duration::from_millis(millis as u64)).await; println!("name: {}", self.name); @@ -100,7 +100,7 @@ impl Stateful { const STATEFUL_DECL: [OpDecl; 3] = [Stateful::get_name(), Stateful::len(), Stateful::delay()]; -#[op2(fast)] +#[op(fast)] pub fn op_nop_generic(state: &mut OpState) { state.take::(); } diff --git a/testing/checkin/runner/ops_async.rs b/testing/checkin/runner/ops_async.rs index 672ed7496..178b3c445 100644 --- a/testing/checkin/runner/ops_async.rs +++ b/testing/checkin/runner/ops_async.rs @@ -1,5 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use deno_core::op2; +use deno_core::op; use deno_core::v8; use deno_core::GarbageCollected; use deno_core::OpState; @@ -12,7 +12,7 @@ use std::rc::Rc; use super::Output; use super::TestData; -#[op2] +#[op] pub fn op_task_submit( state: &mut OpState, #[global] f: v8::Global, @@ -24,12 +24,12 @@ pub fn op_task_submit( }); } -#[op2(async)] +#[op(async)] pub async fn op_async_yield() { tokio::task::yield_now().await } -#[op2(fast)] +#[op(fast)] pub fn op_async_barrier_create( #[state] test_data: &mut TestData, #[string] name: String, @@ -39,7 +39,7 @@ pub fn op_async_barrier_create( test_data.insert(name, barrier); } -#[op2(async)] +#[op(async)] pub fn op_async_barrier_await( #[state] test_data: &TestData, #[string] name: String, @@ -51,7 +51,7 @@ pub fn op_async_barrier_await( } } -#[op2(async)] +#[op(async)] pub async fn op_async_spin_on_state(state: Rc>) { poll_fn(|cx| { // Ensure that we never get polled when the state has been emptied @@ -68,13 +68,13 @@ pub struct TestResource { impl GarbageCollected for TestResource {} -#[op2(async)] +#[op(async)] #[cppgc] pub async fn op_async_make_cppgc_resource() -> TestResource { TestResource { value: 42 } } -#[op2(async)] +#[op(async)] #[smi] pub async fn op_async_get_cppgc_resource( #[cppgc] resource: &TestResource, @@ -82,7 +82,7 @@ pub async fn op_async_get_cppgc_resource( resource.value } -#[op2(async)] +#[op(async)] pub fn op_async_never_resolves() -> impl Future { futures::future::pending::<()>() } diff --git a/testing/checkin/runner/ops_buffer.rs b/testing/checkin/runner/ops_buffer.rs index 70bdc181d..d95f19d78 100644 --- a/testing/checkin/runner/ops_buffer.rs +++ b/testing/checkin/runner/ops_buffer.rs @@ -1,10 +1,10 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use deno_core::op2; +use deno_core::op; use deno_core::JsBuffer; use super::TestData; -#[op2] +#[op] pub fn op_v8slice_store( #[state] test_data: &mut TestData, #[string] name: String, @@ -13,7 +13,7 @@ pub fn op_v8slice_store( test_data.insert(name, data); } -#[op2] +#[op] #[buffer] pub fn op_v8slice_clone( #[state] test_data: &mut TestData, diff --git a/testing/checkin/runner/ops_error.rs b/testing/checkin/runner/ops_error.rs index f0c8c7d31..b8e47a0eb 100644 --- a/testing/checkin/runner/ops_error.rs +++ b/testing/checkin/runner/ops_error.rs @@ -3,29 +3,29 @@ use anyhow::anyhow; use anyhow::Error; use deno_core::error::custom_error; use deno_core::error::type_error; -use deno_core::op2; +use deno_core::op; -#[op2(async)] +#[op(async)] pub async fn op_async_throw_error_eager() -> Result<(), Error> { Err(type_error("Error")) } -#[op2(async(deferred), fast)] +#[op(async(deferred), fast)] pub async fn op_async_throw_error_deferred() -> Result<(), Error> { Err(type_error("Error")) } -#[op2(async(lazy), fast)] +#[op(async(lazy), fast)] pub async fn op_async_throw_error_lazy() -> Result<(), Error> { Err(type_error("Error")) } -#[op2(fast)] +#[op(fast)] pub fn op_error_custom_sync(#[string] message: String) -> Result<(), Error> { Err(custom_error("BadResource", message)) } -#[op2(fast)] +#[op(fast)] pub fn op_error_context_sync( #[string] message: String, #[string] context: String, @@ -33,7 +33,7 @@ pub fn op_error_context_sync( Err(anyhow!(message).context(context)) } -#[op2(async)] +#[op(async)] pub async fn op_error_context_async( #[string] message: String, #[string] context: String, diff --git a/testing/checkin/runner/ops_io.rs b/testing/checkin/runner/ops_io.rs index 6bd53a11c..107e140ed 100644 --- a/testing/checkin/runner/ops_io.rs +++ b/testing/checkin/runner/ops_io.rs @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use anyhow::Error; -use deno_core::op2; +use deno_core::op; use deno_core::AsyncRefCell; use deno_core::BufView; use deno_core::OpState; @@ -53,7 +53,7 @@ impl Resource for PipeResource { } } -#[op2] +#[op] #[serde] pub fn op_pipe_create(op_state: &mut OpState) -> (ResourceId, ResourceId) { let (s1, s2) = tokio::io::duplex(1024); @@ -87,7 +87,7 @@ impl Resource for FileResource { } } -#[op2(async)] +#[op(async)] #[serde] pub async fn op_file_open( #[string] path: String, diff --git a/testing/checkin/runner/ops_worker.rs b/testing/checkin/runner/ops_worker.rs index 3aa0715f5..f677511da 100644 --- a/testing/checkin/runner/ops_worker.rs +++ b/testing/checkin/runner/ops_worker.rs @@ -2,7 +2,7 @@ use anyhow::anyhow; use anyhow::bail; use anyhow::Error; -use deno_core::op2; +use deno_core::op; use deno_core::url::Url; use deno_core::v8::IsolateHandle; use deno_core::GarbageCollected; @@ -88,7 +88,7 @@ pub fn worker_create( (worker, worker_host_side) } -#[op2] +#[op] #[cppgc] pub fn op_worker_spawn( #[state] this_worker: &Worker, @@ -154,7 +154,7 @@ async fn run_worker_task( Ok(()) } -#[op2(fast)] +#[op(fast)] pub fn op_worker_send( #[cppgc] worker: &WorkerControl, #[string] message: String, @@ -163,13 +163,13 @@ pub fn op_worker_send( Ok(()) } -#[op2(async)] +#[op(async)] #[string] pub async fn op_worker_recv(#[cppgc] worker: &WorkerControl) -> Option { worker.worker_channel.rx.lock().await.recv().await } -#[op2] +#[op] #[cppgc] pub fn op_worker_parent( state: Rc>, @@ -190,7 +190,7 @@ pub fn op_worker_parent( }) } -#[op2(async)] +#[op(async)] pub async fn op_worker_await_close(#[cppgc] worker: &WorkerControl) { loop { if worker @@ -207,7 +207,7 @@ pub async fn op_worker_await_close(#[cppgc] worker: &WorkerControl) { } } -#[op2(fast)] +#[op(fast)] pub fn op_worker_terminate( #[cppgc] worker: &WorkerControl, state: Rc>, diff --git a/testing/checkin/runner/testing.rs b/testing/checkin/runner/testing.rs index 6665744c4..58b3753da 100644 --- a/testing/checkin/runner/testing.rs +++ b/testing/checkin/runner/testing.rs @@ -1,7 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use anyhow::bail; use anyhow::Error; -use deno_core::op2; +use deno_core::op; use deno_core::url::Url; use deno_core::v8; use deno_core::JsRuntime; @@ -37,7 +37,7 @@ pub struct TestFunctions { pub functions: Vec<(String, v8::Global)>, } -#[op2] +#[op] pub fn op_test_register( #[state] tests: &mut TestFunctions, #[string] name: String, From ee9a07c5eabfc980579a6dfbe54f56cdd78b30fb Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 5 Jul 2024 08:34:37 +0530 Subject: [PATCH 2/3] UPDATE test --- ops/op/test_cases_fail/lifetimes.stderr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ops/op/test_cases_fail/lifetimes.stderr b/ops/op/test_cases_fail/lifetimes.stderr index 8ed548f99..7b727bf12 100644 --- a/ops/op/test_cases_fail/lifetimes.stderr +++ b/ops/op/test_cases_fail/lifetimes.stderr @@ -21,9 +21,9 @@ error[E0597]: `handle_` does not live long enough --> ../op/test_cases_fail/lifetimes.rs:12:1 | 12 | #[op(fast)] - | ^^^^^^^^^^^- - | | | - | | `handle_` dropped here while still borrowed + | ^^^^^^^^^^- + | | | + | | `handle_` dropped here while still borrowed | borrowed value does not live long enough | argument requires that `handle_` is borrowed for `'static` | @@ -33,9 +33,9 @@ error[E0597]: `arg0_temp` does not live long enough --> ../op/test_cases_fail/lifetimes.rs:15:1 | 15 | #[op(fast)] - | ^^^^^^^^^^^- - | | | - | | `arg0_temp` dropped here while still borrowed + | ^^^^^^^^^^- + | | | + | | `arg0_temp` dropped here while still borrowed | borrowed value does not live long enough | argument requires that `arg0_temp` is borrowed for `'static` | From 732d2e451c7c04b896ad9570b7fcfba6786a821c Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 5 Jul 2024 08:55:47 +0530 Subject: [PATCH 3/3] Rename more --- .github/workflows/ci-test/action.yml | 4 ++-- core/examples/{op2.js => op.js} | 0 core/examples/{op2.rs => op.rs} | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename core/examples/{op2.js => op.js} (100%) rename core/examples/{op2.rs => op.rs} (94%) diff --git a/.github/workflows/ci-test/action.yml b/.github/workflows/ci-test/action.yml index e44658566..bc003226c 100644 --- a/.github/workflows/ci-test/action.yml +++ b/.github/workflows/ci-test/action.yml @@ -13,5 +13,5 @@ runs: # Only regression tests here for now. # Regression test for https://github.com/denoland/deno/pull/19615. run: |- - cargo run -p deno_core --example op2 - cargo run -p deno_core --example op2 --features include_js_files_for_snapshotting + cargo run -p deno_core --example op + cargo run -p deno_core --example op --features include_js_files_for_snapshotting diff --git a/core/examples/op2.js b/core/examples/op.js similarity index 100% rename from core/examples/op2.js rename to core/examples/op.js diff --git a/core/examples/op2.rs b/core/examples/op.rs similarity index 94% rename from core/examples/op2.rs rename to core/examples/op.rs index ca5018852..725062d7d 100644 --- a/core/examples/op2.rs +++ b/core/examples/op.rs @@ -16,8 +16,8 @@ fn op_use_state( extension!( op_sample, ops = [op_use_state], - esm_entry_point = "ext:op_sample/op2.js", - esm = [ dir "examples", "op2.js" ], + esm_entry_point = "ext:op_sample/op.js", + esm = [ dir "examples", "op.js" ], docs = "A small example demonstrating op usage.", "Contains one op." );
RustFastcallAsyncv8