mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Merge branch 'fix/emscripten-translate' of github.com:wasmerio/wasmer into fix/emscripten-translate
This commit is contained in:
commit
563cda7ba2
@ -238,7 +238,7 @@ impl Instance {
|
||||
self.call_with_index(func_index, args)
|
||||
}
|
||||
|
||||
/// Returns a immutable reference to the
|
||||
/// Returns an immutable reference to the
|
||||
/// [`Ctx`] used by this Instance.
|
||||
///
|
||||
/// [`Ctx`]: struct.Ctx.html
|
||||
@ -254,7 +254,7 @@ impl Instance {
|
||||
unsafe { &mut *self.inner.vmctx }
|
||||
}
|
||||
|
||||
/// Returns a iterator over all of the items
|
||||
/// Returns an iterator over all of the items
|
||||
/// exported from this instance.
|
||||
pub fn exports(&mut self) -> ExportIter {
|
||||
ExportIter::new(&self.module, &mut self.inner)
|
||||
|
@ -36,7 +36,7 @@ fn main() -> Result<()> {
|
||||
|
||||
let import_object = imports! {
|
||||
"env" => {
|
||||
"print_i32" => func!(print_num),
|
||||
"print_num" => func!(print_num),
|
||||
"memory" => memory,
|
||||
"global" => global,
|
||||
"table" => table,
|
||||
@ -51,7 +51,6 @@ fn main() -> Result<()> {
|
||||
|
||||
let outer_module = wasmer_runtime_core::compile_with(EXAMPLE_WASM, &CraneliftCompiler::new())?;
|
||||
let outer_instance = outer_module.instantiate(&outer_imports)?;
|
||||
|
||||
let ret = outer_instance.call("main", &[Value::I32(42)])?;
|
||||
println!("ret: {:?}", ret);
|
||||
|
||||
|
@ -47,7 +47,7 @@ pub fn generate_imports() -> ImportObject {
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
let instance = module
|
||||
.instantiate(ImportObject::new())
|
||||
.instantiate(&ImportObject::new())
|
||||
.expect("WASM can't be instantiated");
|
||||
let mut imports = ImportObject::new();
|
||||
imports.register("spectest", instance);
|
||||
|
@ -25,12 +25,12 @@ mod tests {
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
let instance = module
|
||||
.instantiate(ImportObject::new())
|
||||
.instantiate(&ImportObject::new())
|
||||
.expect("WASM can't be instantiated");
|
||||
let result = instance.call("stack-overflow", &[]);
|
||||
|
||||
match result {
|
||||
Err(err) => match *err {
|
||||
Err(err) => match err {
|
||||
CallError::Runtime(RuntimeError::Unknown { msg }) => {
|
||||
assert!(!msg.contains("segmentation violation"));
|
||||
assert!(!msg.contains("bus error"));
|
||||
|
@ -85,7 +85,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
||||
};
|
||||
|
||||
let mut instance = module
|
||||
.instantiate(import_object)
|
||||
.instantiate(&import_object)
|
||||
.map_err(|e| format!("Can't instantiate module: {:?}", e))?;
|
||||
|
||||
webassembly::run_instance(
|
||||
|
@ -41,7 +41,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)?;
|
||||
let instance = module.instantiate(&import_object)?;
|
||||
|
||||
debug!("webassembly - instance created");
|
||||
Ok(ResultObject {
|
||||
|
Loading…
Reference in New Issue
Block a user