This commit is contained in:
Heyang Zhou
2019-05-04 09:56:52 -07:00
parent c4e4efc694
commit a590d7cd07
5 changed files with 65 additions and 13 deletions

View File

@ -4,7 +4,7 @@ use std::{
};
use crate::{
backend::RunnableModule,
vm::InternalCtx,
vm::Ctx,
module::ModuleInfo,
types::Value,
};
@ -17,7 +17,7 @@ pub trait Loader {
type Instance: Instance;
type Error: Debug;
fn load(&self, rm: &dyn RunnableModule, module: &ModuleInfo, ctx: &InternalCtx) -> Result<Self::Instance, Self::Error>;
fn load(&self, rm: &dyn RunnableModule, module: &ModuleInfo, ctx: &Ctx) -> Result<Self::Instance, Self::Error>;
}
pub trait Instance {
@ -31,7 +31,7 @@ impl Loader for LocalLoader {
type Instance = LocalInstance;
type Error = String;
fn load(&self, rm: &dyn RunnableModule, module: &ModuleInfo, ctx: &InternalCtx) -> Result<Self::Instance, Self::Error> {
fn load(&self, rm: &dyn RunnableModule, module: &ModuleInfo, ctx: &Ctx) -> Result<Self::Instance, Self::Error> {
let code = rm.get_code().unwrap();
let mut code_mem = CodeMemory::new(code.len());
code_mem[..code.len()].copy_from_slice(code);