Rearrange some apis

This commit is contained in:
Lachlan Sneff
2019-01-12 17:52:14 -05:00
parent 60201ea7a6
commit a983e9ce8b
71 changed files with 16821 additions and 74919 deletions

View File

@ -5,17 +5,21 @@
warnings,
dead_code
)]
use std::{f32, f64};
use wabt::wat2wasm;
use std::{f32, f64};
use wasmer_clif_backend::CraneliftCompiler;
use wasmer_runtime::types::Value;
use wasmer_runtime::{module::Module, Instance};
use wasmer_runtime::{Instance, module::Module};
use wasmer_clif_backend::CraneliftCompiler;
use crate::spectests::_common::{
generate_imports,
NaNCheck,
};
use crate::spectests::_common::{generate_imports, NaNCheck};
// Line 1
fn create_module_1() -> Box<Instance> {
fn create_module_1() -> Instance {
let module_str = "(module
(type (;0;) (func (param i64) (result i64)))
(func (;0;) (type 0) (param i64) (result i64)
@ -160,11 +164,8 @@ fn create_module_1() -> Box<Instance> {
(export \"fac-mixed-raw\" (func 4)))
";
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
module
.instantiate(generate_imports())
.expect("WASM can't be instantiated")
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
module.instantiate(generate_imports()).expect("WASM can't be instantiated")
}
fn start_module_1(instance: &mut Instance) {
@ -207,7 +208,7 @@ fn test_module_1() {
c2_l131_action_invoke(&mut instance);
c3_l132_action_invoke(&mut instance);
}
fn create_module_2() -> Box<Instance> {
fn create_module_2() -> Instance {
let module_str = "(module
(type (;0;) (func))
(type (;1;) (func (param i32)))
@ -434,11 +435,8 @@ fn create_module_2() -> Box<Instance> {
(table (;0;) 1 anyfunc))
";
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
module
.instantiate(generate_imports())
.expect("WASM can't be instantiated")
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
module.instantiate(generate_imports()).expect("WASM can't be instantiated")
}
fn start_module_2(instance: &mut Instance) {