From f069ef9c34dd3d024afb30e220c9b70f554c9d88 Mon Sep 17 00:00:00 2001 From: Tyler Rockwood Date: Thu, 2 May 2024 20:51:59 +0000 Subject: [PATCH] wasm: cleanup strict stack checking extra function Signed-off-by: Tyler Rockwood --- src/v/wasm/wasmtime.cc | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/src/v/wasm/wasmtime.cc b/src/v/wasm/wasmtime.cc index 0e58b209a30a..9736ab9c45eb 100644 --- a/src/v/wasm/wasmtime.cc +++ b/src/v/wasm/wasmtime.cc @@ -895,37 +895,6 @@ struct host_function { handle functype{ wasm_functype_new(&inputs, &outputs)}; - if (ssc.enabled()) { - if constexpr (ss::is_future::value) { - handle error( - wasmtime_linker_define_async_func( - linker, - Module::name.data(), - Module::name.size(), - function_name.data(), - function_name.size(), - functype.get(), - &invoke_async_host_fn_with_strict_stack_checking, - /*data=*/ssc.allocator, - /*finalizer=*/nullptr)); - check_error(error.get()); - } else { - handle error( - wasmtime_linker_define_func( - linker, - Module::name.data(), - Module::name.size(), - function_name.data(), - function_name.size(), - functype.get(), - &invoke_sync_host_fn_with_strict_stack_checking, - /*data=*/ssc.allocator, - /*finalizer=*/nullptr)); - check_error(error.get()); - } - return; - } - if constexpr (ss::is_future::value) { handle error( wasmtime_linker_define_async_func( @@ -935,8 +904,9 @@ struct host_function { function_name.data(), function_name.size(), functype.get(), - &invoke_async_host_fn, - /*data=*/nullptr, + ssc.enabled() ? &invoke_async_host_fn_with_strict_stack_checking + : &invoke_async_host_fn, + /*data=*/ssc.allocator, /*finalizer=*/nullptr)); check_error(error.get()); } else { @@ -948,8 +918,9 @@ struct host_function { function_name.data(), function_name.size(), functype.get(), - &invoke_sync_host_fn, - /*data=*/nullptr, + ssc.enabled() ? &invoke_sync_host_fn_with_strict_stack_checking + : &invoke_sync_host_fn, + /*data=*/ssc.allocator, /*finalizer=*/nullptr)); check_error(error.get()); }