@@ -15,11 +15,6 @@ mod utils;
1515#[ cfg( test) ]
1616mod tests;
1717
18- #[ cfg( test) ]
19- use self :: code_map:: CompiledFuncRef ;
20- #[ cfg( test) ]
21- use crate :: { core:: UntypedVal , ir:: Instruction , ir:: RegSpan } ;
22-
2318pub ( crate ) use self :: {
2419 block_type:: BlockType ,
2520 config:: FuelCosts ,
@@ -274,54 +269,6 @@ impl Engine {
274269 . init_lazy_func ( func_idx, func, bytes, module, func_to_validate)
275270 }
276271
277- /// Resolves the [`EngineFunc`] to the underlying Wasmi bytecode instructions.
278- ///
279- /// # Note
280- ///
281- /// - This is a variant of [`Engine::resolve_instr`] that returns register
282- /// machine based bytecode instructions.
283- /// - This API is mainly intended for unit testing purposes and shall not be used
284- /// outside of this context. The function bodies are intended to be data private
285- /// to the Wasmi interpreter.
286- ///
287- /// # Errors
288- ///
289- /// If the `func` fails Wasm to Wasmi bytecode translation after it was lazily initialized.
290- ///
291- /// # Panics
292- ///
293- /// - If the [`EngineFunc`] is invalid for the [`Engine`].
294- /// - If register machine bytecode translation is disabled.
295- #[ cfg( test) ]
296- pub ( crate ) fn resolve_instr (
297- & self ,
298- func : EngineFunc ,
299- index : usize ,
300- ) -> Result < Option < Instruction > , Error > {
301- self . inner . resolve_instr ( func, index)
302- }
303-
304- /// Resolves the function local constant of [`EngineFunc`] at `index` if any.
305- ///
306- /// # Note
307- ///
308- /// This API is intended for unit testing purposes and shall not be used
309- /// outside of this context. The function bodies are intended to be data
310- /// private to the Wasmi interpreter.
311- ///
312- /// # Errors
313- ///
314- /// If the `func` fails Wasm to Wasmi bytecode translation after it was lazily initialized.
315- ///
316- /// # Panics
317- ///
318- /// - If the [`EngineFunc`] is invalid for the [`Engine`].
319- /// - If register machine bytecode translation is disabled.
320- #[ cfg( test) ]
321- fn get_func_const ( & self , func : EngineFunc , index : usize ) -> Result < Option < UntypedVal > , Error > {
322- self . inner . get_func_const ( func, index)
323- }
324-
325272 /// Executes the given [`Func`] with parameters `params`.
326273 ///
327274 /// Stores the execution result into `results` upon a successful execution.
@@ -739,55 +686,6 @@ impl EngineInner {
739686 . init_func_as_uncompiled ( func, func_idx, bytes, module, func_to_validate)
740687 }
741688
742- /// Resolves the [`InternalFuncEntity`] for [`EngineFunc`] and applies `f` to it.
743- ///
744- /// # Panics
745- ///
746- /// If [`EngineFunc`] is invalid for [`Engine`].
747- #[ cfg( test) ]
748- fn resolve_func < ' a , F , R > ( & ' a self , func : EngineFunc , f : F ) -> Result < R , Error >
749- where
750- F : FnOnce ( CompiledFuncRef < ' a > ) -> R ,
751- {
752- // Note: We use `None` so this test-only function will never charge for compilation fuel.
753- Ok ( f ( self . code_map . get ( None , func) ?) )
754- }
755-
756- /// Returns the [`Instruction`] of `func` at `index`.
757- ///
758- /// Returns `None` if the function has no instruction at `index`.
759- ///
760- /// # Errors
761- ///
762- /// If the `func` fails Wasm to Wasmi bytecode translation after it was lazily initialized.
763- ///
764- /// # Pancis
765- ///
766- /// If `func` cannot be resolved to a function for the [`EngineInner`].
767- #[ cfg( test) ]
768- fn resolve_instr ( & self , func : EngineFunc , index : usize ) -> Result < Option < Instruction > , Error > {
769- self . resolve_func ( func, |func| func. instrs ( ) . get ( index) . copied ( ) )
770- }
771-
772- /// Returns the function local constant value of `func` at `index`.
773- ///
774- /// Returns `None` if the function has no function local constant at `index`.
775- ///
776- /// # Errors
777- ///
778- /// If the `func` fails Wasm to Wasmi bytecode translation after it was lazily initialized.
779- ///
780- /// # Pancis
781- ///
782- /// If `func` cannot be resolved to a function for the [`EngineInner`].
783- #[ cfg( test) ]
784- fn get_func_const ( & self , func : EngineFunc , index : usize ) -> Result < Option < UntypedVal > , Error > {
785- // Function local constants are stored in reverse order of their indices since
786- // they are allocated in reverse order to their absolute indices during function
787- // translation. That is why we need to access them in reverse order.
788- self . resolve_func ( func, |func| func. consts ( ) . iter ( ) . rev ( ) . nth ( index) . copied ( ) )
789- }
790-
791689 /// Recycles the given [`Stack`].
792690 fn recycle_stack ( & self , stack : Stack ) {
793691 self . stacks . lock ( ) . recycle ( stack)
0 commit comments