From eb3d79ab1bcdc554acf03034606836443a0971e5 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 16 Mar 2023 18:50:41 +0530 Subject: [PATCH] chore(ops): inline FastFunction trait methods (#18226) --- ops/fast_call.rs | 3 +++ ops/optimizer_tests/async_nop.out | 3 +++ ops/optimizer_tests/async_result.out | 3 +++ ops/optimizer_tests/callback_options.out | 3 +++ ops/optimizer_tests/cow_str.out | 3 +++ ops/optimizer_tests/f64_slice.out | 3 +++ ops/optimizer_tests/op_ffi_ptr_value.out | 3 +++ ops/optimizer_tests/op_state.out | 3 +++ ops/optimizer_tests/op_state_basic1.out | 3 +++ ops/optimizer_tests/op_state_generics.out | 3 +++ ops/optimizer_tests/op_state_result.out | 3 +++ ops/optimizer_tests/op_state_warning.out | 3 +++ ops/optimizer_tests/op_state_with_transforms.out | 3 +++ ops/optimizer_tests/opstate_with_arity.out | 3 +++ ops/optimizer_tests/owned_string.out | 3 +++ ops/optimizer_tests/raw_ptr.out | 3 +++ ops/optimizer_tests/serde_v8_value.out | 3 +++ ops/optimizer_tests/strings.out | 3 +++ ops/optimizer_tests/uint8array.out | 3 +++ ops/optimizer_tests/unit_result.out | 3 +++ ops/optimizer_tests/unit_result2.out | 3 +++ ops/optimizer_tests/unit_ret.out | 3 +++ ops/optimizer_tests/wasm_op.out | 3 +++ 23 files changed, 69 insertions(+) diff --git a/ops/fast_call.rs b/ops/fast_call.rs index 0ddf5c8784..a6162a0198 100644 --- a/ops/fast_call.rs +++ b/ops/fast_call.rs @@ -376,11 +376,13 @@ pub(crate) fn generate( brace_token: Default::default(), items: vec![ parse_quote! { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { #fast_fn_ident #caller_generics as *const ::std::ffi::c_void } }, parse_quote! { + #[inline(always)] fn args(&self) -> &'static [#core::v8::fast_api::Type] { use #core::v8::fast_api::Type::*; use #core::v8::fast_api::CType; @@ -388,6 +390,7 @@ pub(crate) fn generate( } }, parse_quote! { + #[inline(always)] fn return_type(&self) -> #core::v8::fast_api::CType { #core::v8::fast_api::CType::#output_variant } diff --git a/ops/optimizer_tests/async_nop.out b/ops/optimizer_tests/async_nop.out index 1fed63735d..d1e9534063 100644 --- a/ops/optimizer_tests/async_nop.out +++ b/ops/optimizer_tests/async_nop.out @@ -85,14 +85,17 @@ struct op_void_async_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_void_async_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_void_async_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Int32, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/async_result.out b/ops/optimizer_tests/async_result.out index 7270ca3d52..1d45b11f17 100644 --- a/ops/optimizer_tests/async_result.out +++ b/ops/optimizer_tests/async_result.out @@ -95,14 +95,17 @@ struct op_async_result_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_async_result_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_async_result_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Int32, Uint32, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/callback_options.out b/ops/optimizer_tests/callback_options.out index be84d686a4..3a18be60f7 100644 --- a/ops/optimizer_tests/callback_options.out +++ b/ops/optimizer_tests/callback_options.out @@ -54,14 +54,17 @@ struct op_fallback_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_fallback_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_fallback_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out index c1c4917f65..e676057630 100644 --- a/ops/optimizer_tests/cow_str.out +++ b/ops/optimizer_tests/cow_str.out @@ -62,14 +62,17 @@ struct op_cow_str_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_cow_str_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_cow_str_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, SeqOneByteString] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/f64_slice.out b/ops/optimizer_tests/f64_slice.out index 9526d988a5..dd982b1937 100644 --- a/ops/optimizer_tests/f64_slice.out +++ b/ops/optimizer_tests/f64_slice.out @@ -80,14 +80,17 @@ struct op_f64_buf_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_f64_buf_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_f64_buf_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, TypedArray(CType::Float64), CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/op_ffi_ptr_value.out b/ops/optimizer_tests/op_ffi_ptr_value.out index 5ef91e21f0..df38b72278 100644 --- a/ops/optimizer_tests/op_ffi_ptr_value.out +++ b/ops/optimizer_tests/op_ffi_ptr_value.out @@ -94,14 +94,17 @@ struct op_ffi_ptr_value_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_ffi_ptr_value_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_ffi_ptr_value_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Pointer, TypedArray(CType::Uint32), CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/op_state.out b/ops/optimizer_tests/op_state.out index 520d41e1a0..619a097482 100644 --- a/ops/optimizer_tests/op_state.out +++ b/ops/optimizer_tests/op_state.out @@ -62,14 +62,17 @@ struct op_set_exit_code_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_set_exit_code_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_set_exit_code_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Int32, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/op_state_basic1.out b/ops/optimizer_tests/op_state_basic1.out index 7d803ac398..b2926753ea 100644 --- a/ops/optimizer_tests/op_state_basic1.out +++ b/ops/optimizer_tests/op_state_basic1.out @@ -89,14 +89,17 @@ struct foo_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for foo_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { foo_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Uint32, Uint32, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Uint32 } diff --git a/ops/optimizer_tests/op_state_generics.out b/ops/optimizer_tests/op_state_generics.out index 28315eb261..88eeefe148 100644 --- a/ops/optimizer_tests/op_state_generics.out +++ b/ops/optimizer_tests/op_state_generics.out @@ -64,14 +64,17 @@ impl<'scope, SP> deno_core::v8::fast_api::FastFunction for op_foo_fast where SP: SomePermission + 'static, { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_foo_fast_fn:: as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/op_state_result.out b/ops/optimizer_tests/op_state_result.out index 0b7301bfc3..fb0fdb25f4 100644 --- a/ops/optimizer_tests/op_state_result.out +++ b/ops/optimizer_tests/op_state_result.out @@ -102,14 +102,17 @@ struct foo_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for foo_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { foo_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Uint32, Uint32, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Uint32 } diff --git a/ops/optimizer_tests/op_state_warning.out b/ops/optimizer_tests/op_state_warning.out index 1942a6376d..5a4b481c4f 100644 --- a/ops/optimizer_tests/op_state_warning.out +++ b/ops/optimizer_tests/op_state_warning.out @@ -93,14 +93,17 @@ struct op_listen_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_listen_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_listen_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Uint32 } diff --git a/ops/optimizer_tests/op_state_with_transforms.out b/ops/optimizer_tests/op_state_with_transforms.out index ecd56ceeb3..07e1fefb93 100644 --- a/ops/optimizer_tests/op_state_with_transforms.out +++ b/ops/optimizer_tests/op_state_with_transforms.out @@ -111,14 +111,17 @@ impl<'scope, TP> deno_core::v8::fast_api::FastFunction for op_now_fast where TP: TimersPermission + 'static, { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_now_fast_fn:: as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, TypedArray(CType::Uint8), CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/opstate_with_arity.out b/ops/optimizer_tests/opstate_with_arity.out index 7c831ccfec..ab4e905d5b 100644 --- a/ops/optimizer_tests/opstate_with_arity.out +++ b/ops/optimizer_tests/opstate_with_arity.out @@ -120,14 +120,17 @@ struct op_add_4_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_add_4_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_add_4_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Uint32, Uint32, Uint32, Uint32, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Uint32 } diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out index 56d3cbfdca..62fb45ed7a 100644 --- a/ops/optimizer_tests/owned_string.out +++ b/ops/optimizer_tests/owned_string.out @@ -74,14 +74,17 @@ struct op_string_length_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_string_length_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_string_length_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, SeqOneByteString] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Uint32 } diff --git a/ops/optimizer_tests/raw_ptr.out b/ops/optimizer_tests/raw_ptr.out index 2b4e8c0b4a..12f93f99d5 100644 --- a/ops/optimizer_tests/raw_ptr.out +++ b/ops/optimizer_tests/raw_ptr.out @@ -137,14 +137,17 @@ impl<'scope, FP> deno_core::v8::fast_api::FastFunction for op_ffi_ptr_of_fast *const ::std::ffi::c_void { op_ffi_ptr_of_fast_fn:: as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint32), CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/serde_v8_value.out b/ops/optimizer_tests/serde_v8_value.out index 3ea0aacb31..6ee56d4606 100644 --- a/ops/optimizer_tests/serde_v8_value.out +++ b/ops/optimizer_tests/serde_v8_value.out @@ -74,14 +74,17 @@ struct op_is_proxy_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_is_proxy_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_is_proxy_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, V8Value] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Bool } diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out index 8aa93a37a0..623ff1bbb0 100644 --- a/ops/optimizer_tests/strings.out +++ b/ops/optimizer_tests/strings.out @@ -75,14 +75,17 @@ struct op_string_length_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_string_length_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_string_length_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, SeqOneByteString] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Uint32 } diff --git a/ops/optimizer_tests/uint8array.out b/ops/optimizer_tests/uint8array.out index 06e50ce662..49926c747b 100644 --- a/ops/optimizer_tests/uint8array.out +++ b/ops/optimizer_tests/uint8array.out @@ -151,14 +151,17 @@ struct op_import_spki_x25519_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_import_spki_x25519_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_import_spki_x25519_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, TypedArray(CType::Uint8), TypedArray(CType::Uint8)] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Bool } diff --git a/ops/optimizer_tests/unit_result.out b/ops/optimizer_tests/unit_result.out index 082d29a453..0a66f4fe61 100644 --- a/ops/optimizer_tests/unit_result.out +++ b/ops/optimizer_tests/unit_result.out @@ -74,14 +74,17 @@ struct op_unit_result_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_unit_result_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_unit_result_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/unit_result2.out b/ops/optimizer_tests/unit_result2.out index 6f5a5915d7..045f022faf 100644 --- a/ops/optimizer_tests/unit_result2.out +++ b/ops/optimizer_tests/unit_result2.out @@ -107,14 +107,17 @@ struct op_set_nodelay_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_set_nodelay_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_set_nodelay_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, Uint32, Bool, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/unit_ret.out b/ops/optimizer_tests/unit_ret.out index 3924beb537..a3a0d5ea92 100644 --- a/ops/optimizer_tests/unit_ret.out +++ b/ops/optimizer_tests/unit_ret.out @@ -63,14 +63,17 @@ struct op_unit_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_unit_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_unit_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void } diff --git a/ops/optimizer_tests/wasm_op.out b/ops/optimizer_tests/wasm_op.out index 219537f607..8359262929 100644 --- a/ops/optimizer_tests/wasm_op.out +++ b/ops/optimizer_tests/wasm_op.out @@ -50,14 +50,17 @@ struct op_wasm_fast { _phantom: ::std::marker::PhantomData<()>, } impl<'scope> deno_core::v8::fast_api::FastFunction for op_wasm_fast { + #[inline(always)] fn function(&self) -> *const ::std::ffi::c_void { op_wasm_fast_fn as *const ::std::ffi::c_void } + #[inline(always)] fn args(&self) -> &'static [deno_core::v8::fast_api::Type] { use deno_core::v8::fast_api::Type::*; use deno_core::v8::fast_api::CType; &[V8Value, CallbackOptions] } + #[inline(always)] fn return_type(&self) -> deno_core::v8::fast_api::CType { deno_core::v8::fast_api::CType::Void }