diff --git a/Cargo.lock b/Cargo.lock index f31e1cb97..f63153bbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1594,8 +1594,6 @@ name = "wasmer-interface-types" version = "0.7.0" dependencies = [ "nom 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmer-clif-backend 0.7.0", - "wasmer-runtime-core 0.7.0", ] [[package]] diff --git a/lib/interface-types/src/interpreter/instructions/call.rs b/lib/interface-types/src/interpreter/instructions/call.rs index d58368c1c..f6375c485 100644 --- a/lib/interface-types/src/interpreter/instructions/call.rs +++ b/lib/interface-types/src/interpreter/instructions/call.rs @@ -6,7 +6,7 @@ use crate::interpreter::wasm::{ executable_instruction!( call(function_index: usize, instruction_name: String) -> _ { move |runtime| -> _ { - let instance = runtime.wasm_instance; + let instance = &mut runtime.wasm_instance; let index = FunctionIndex::new(function_index); match instance.local_or_import(index) { diff --git a/lib/interface-types/src/interpreter/instructions/call_export.rs b/lib/interface-types/src/interpreter/instructions/call_export.rs index a1a43404e..62e360aa8 100644 --- a/lib/interface-types/src/interpreter/instructions/call_export.rs +++ b/lib/interface-types/src/interpreter/instructions/call_export.rs @@ -3,7 +3,7 @@ use crate::interpreter::wasm::values::InterfaceType; executable_instruction!( call_export(export_name: String, instruction_name: String) -> _ { move |runtime| -> _ { - let instance = runtime.wasm_instance; + let instance = &mut runtime.wasm_instance; match instance.export(&export_name) { Some(export) => { diff --git a/lib/interface-types/src/interpreter/instructions/mod.rs b/lib/interface-types/src/interpreter/instructions/mod.rs index 183e0dc82..d84d2b47e 100644 --- a/lib/interface-types/src/interpreter/instructions/mod.rs +++ b/lib/interface-types/src/interpreter/instructions/mod.rs @@ -175,7 +175,7 @@ pub(crate) mod tests { } fn local_or_import( - &self, + &mut self, index: I, ) -> Option<&LocalImport> { self.locals_or_imports.get(&index.index()) diff --git a/lib/interface-types/src/interpreter/instructions/write_utf8.rs b/lib/interface-types/src/interpreter/instructions/write_utf8.rs index b0738f328..a1e21509f 100644 --- a/lib/interface-types/src/interpreter/instructions/write_utf8.rs +++ b/lib/interface-types/src/interpreter/instructions/write_utf8.rs @@ -4,7 +4,7 @@ use std::convert::TryInto; executable_instruction!( write_utf8(allocator_name: String, instruction_name: String) -> _ { move |runtime| -> _ { - let instance = runtime.wasm_instance; + let instance = &mut runtime.wasm_instance; match instance.export(&allocator_name) { Some(allocator) => { @@ -17,7 +17,7 @@ executable_instruction!( )) } - match runtime.wasm_instance.memory(0) { + match instance.memory(0) { Some(memory) => match runtime.stack.pop1() { Some(string) => { let memory_view = memory.view(); diff --git a/lib/interface-types/src/interpreter/mod.rs b/lib/interface-types/src/interpreter/mod.rs index 1b133a7bf..551311a83 100644 --- a/lib/interface-types/src/interpreter/mod.rs +++ b/lib/interface-types/src/interpreter/mod.rs @@ -18,7 +18,7 @@ where { invocation_inputs: &'invocation [InterfaceValue], stack: Stack, - wasm_instance: &'instance Instance, + wasm_instance: &'instance mut Instance, _phantom: PhantomData<(Export, LocalImport, Memory, MemoryView)>, } @@ -58,7 +58,7 @@ where pub fn run( &self, invocation_inputs: &[InterfaceValue], - wasm_instance: &Instance, + wasm_instance: &mut Instance, ) -> Result, String> { let mut runtime = Runtime { invocation_inputs, diff --git a/lib/interface-types/src/interpreter/wasm/structures.rs b/lib/interface-types/src/interpreter/wasm/structures.rs index a38511c8f..7ec386f68 100644 --- a/lib/interface-types/src/interpreter/wasm/structures.rs +++ b/lib/interface-types/src/interpreter/wasm/structures.rs @@ -70,7 +70,7 @@ where MV: MemoryView, { fn export(&self, export_name: &str) -> Option<&E>; - fn local_or_import(&self, index: I) -> Option<&LI>; + fn local_or_import(&mut self, index: I) -> Option<&LI>; fn memory(&self, index: usize) -> Option<&M>; } @@ -151,7 +151,7 @@ where None } - fn local_or_import(&self, _index: I) -> Option<&LI> { + fn local_or_import(&mut self, _index: I) -> Option<&LI> { None } } diff --git a/lib/interface-types/src/macros.rs b/lib/interface-types/src/macros.rs index aee817824..a0b99940d 100644 --- a/lib/interface-types/src/macros.rs +++ b/lib/interface-types/src/macros.rs @@ -68,8 +68,8 @@ macro_rules! test_executable_instruction { (&vec![$($instructions),*]).try_into().unwrap(); let invocation_inputs = vec![$($invocation_inputs),*]; - let instance = $instance; - let run = interpreter.run(&invocation_inputs, &instance); + let mut instance = $instance; + let run = interpreter.run(&invocation_inputs, &mut instance); assert!(run.is_ok()); @@ -102,8 +102,8 @@ macro_rules! test_executable_instruction { (&vec![$($instructions),*]).try_into().unwrap(); let invocation_inputs = vec![$($invocation_inputs),*]; - let instance = $instance; - let run = interpreter.run(&invocation_inputs, &instance); + let mut instance = $instance; + let run = interpreter.run(&invocation_inputs, &mut instance); assert!(run.is_err());