@@ -2,15 +2,14 @@ use alloc::{string::String, vec::Vec};
22use wasm:: {
33 addrs:: { FuncAddr , GlobalAddr , MemAddr , ModuleAddr , TableAddr } ,
44 config:: Config ,
5- interop:: InteropValueList ,
65 resumable:: Resumable ,
76 FuncType , GlobalType , HaltExecutionError , MemType , RuntimeError , TableType , ValidationInfo ,
87 Value ,
98} ;
109
1110use crate :: {
1211 stored_types:: { Stored , StoredExternVal , StoredInstantiationOutcome , StoredRunState } ,
13- AbstractStored , StoreId , StoredInteropValueList , StoredRef , StoredValue ,
12+ AbstractStored , StoreId , StoredRef , StoredValue ,
1413} ;
1514
1615pub struct Store < ' b , T : Config > {
@@ -442,38 +441,6 @@ impl<'b, T: Config> Store<'b, T> {
442441 Ok ( stored_run_state)
443442 }
444443
445- /// This is a safer variant of [`Store::func_alloc_typed_unchecked`](crate::Store::func_alloc_typed_unchecked). It is
446- /// functionally equal, with the only difference being that this function
447- /// returns a [`Stored<FuncAddr>`].
448- ///
449- /// # Safety
450- ///
451- /// The caller has to guarantee that if the [`Value`]s returned from the
452- /// given host function are references, their addresses came either from the
453- /// host function arguments or from the current [`Store`] object.
454- ///
455- /// See: [`Store::func_alloc_typed_unchecked`](crate::Store::func_alloc_typed_unchecked) for more information.
456- #[ allow( clippy:: let_and_return) ] // reason = "to follow the 1234 structure"
457- pub unsafe fn func_alloc_typed < Params : InteropValueList , Returns : InteropValueList > (
458- & mut self ,
459- host_func : fn ( & mut T , Vec < Value > ) -> Result < Vec < Value > , HaltExecutionError > ,
460- ) -> Stored < FuncAddr > {
461- // 1. try unwrap
462- // no stored parameters
463- // 2. call
464- // SAFETY: The caller ensures that if the host function returns
465- // references, they originate either from the arguments or the current
466- // store.
467- let func_addr = unsafe {
468- self . inner
469- . func_alloc_typed_unchecked :: < Params , Returns > ( host_func)
470- } ;
471- // 3. rewrap
472- // 4. return
473- // SAFETY: The function address just came from the current store.
474- unsafe { Stored :: from_bare ( func_addr, self . id ) }
475- }
476-
477444 /// This is a safe variant of [`Store::invoke_without_fuel_unchecked`](crate::Store::invoke_without_fuel_unchecked).
478445 pub fn invoke_without_fuel (
479446 & mut self ,
@@ -495,32 +462,6 @@ impl<'b, T: Config> Store<'b, T> {
495462 Ok ( returns)
496463 }
497464
498- /// This is a safe variant of [`Store::invoke_typed_without_fuel_unchecked`](crate::Store::invoke_typed_without_fuel_unchecked).
499- pub fn invoke_typed_without_fuel <
500- Params : StoredInteropValueList ,
501- Returns : StoredInteropValueList ,
502- > (
503- & mut self ,
504- function : Stored < FuncAddr > ,
505- params : Params ,
506- ) -> Result < Returns , RuntimeError > {
507- // 1. try unwrap
508- let function = function. try_unwrap_into_bare ( self . id ) ;
509- let params = params. into_values ( ) . try_unwrap_into_bare ( self . id ) ;
510- // 2. call
511- // SAFETY: It was just checked that the `FuncAddr` and any addresses
512- // contained in the parameters came from the current store through their
513- // store ids.
514- let returns = unsafe { self . inner . invoke_without_fuel_unchecked ( function, params) } ?;
515- // 3. rewrap
516- // SAFETY: All `Value`s just came from the current store.
517- let stored_returns = unsafe { Vec :: from_bare ( returns, self . id ) } ;
518- // 4. return
519- let stored_returns = Returns :: try_from_values ( stored_returns. into_iter ( ) )
520- . map_err ( |_| RuntimeError :: FunctionInvocationSignatureMismatch ) ?;
521- Ok ( stored_returns)
522- }
523-
524465 /// This is a safe variant of [`Store::mem_access_mut_slice_unchecked`](crate::Store::mem_access_mut_slice_unchecked).
525466 pub fn mem_access_mut_slice < R > (
526467 & self ,
0 commit comments