clean up implementation

This commit is contained in:
Mark McCaskey
2019-03-27 14:01:27 -07:00
parent f9a29445ca
commit 09068c1a74
11 changed files with 109 additions and 58 deletions

View File

@ -4,6 +4,7 @@ use wasmer_runtime::{
error::{CallResult, Result},
ImportObject, Instance, Module,
};
use wasmer_runtime_core::backend::CompilerConfig;
use wasmer_runtime_core::types::Value;
use wasmer_emscripten::{is_emscripten_module, run_emscripten_instance};
@ -42,7 +43,7 @@ pub fn instantiate(buffer_source: &[u8], import_object: ImportObject) -> Result<
let module = compile(&buffer_source[..])?;
debug!("webassembly - instantiating");
let instance = module.instantiate(&import_object, None)?;
let instance = module.instantiate(&import_object)?;
debug!("webassembly - instance created");
Ok(ResultObject {
@ -76,6 +77,14 @@ pub fn compile(buffer_source: &[u8]) -> Result<Module> {
Ok(module)
}
pub fn compile_with_config(
buffer_source: &[u8],
compiler_config: CompilerConfig,
) -> Result<Module> {
let module = runtime::compile_with_config(buffer_source, compiler_config)?;
Ok(module)
}
/// Performs common instance operations needed when an instance is first run
/// including data setup, handling arguments and calling a main function
pub fn run_instance(