Skip to content

Commit

Permalink
remove run_instance function
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlansneff committed Apr 22, 2019
1 parent c8937c4 commit 53c576f
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/webassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,3 @@ pub fn compile(buffer_source: &[u8]) -> Result<Module> {
let module = runtime::compile(buffer_source)?;
Ok(module)
}

// /// The same as `compile` but takes a `CompilerConfig` for the purpose of
// /// changing the compiler's behavior
// pub fn compile_with_config_with(
// 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(
module: &Module,
instance: &mut Instance,
abi: InstanceABI,
path: &str,
args: Vec<&str>,
) -> CallResult<()> {
match abi {
InstanceABI::Emscripten => {
run_emscripten_instance(module, instance, path, args)?;
}
InstanceABI::WASI => {
instance.call("_start", &[])?;
}
InstanceABI::None => {
let args: Vec<Value> = args
.into_iter()
.map(|x| Value::I32(x.parse().unwrap()))
.collect();
instance.call("main", &args)?;
}
}
Ok(())
}

0 comments on commit 53c576f

Please sign in to comment.