From b80252e1654904b4ca61043084ca1b34b95b52c7 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Thu, 28 Feb 2019 23:02:03 -0600 Subject: [PATCH] Setup the spectests lib to use llvm-backend --- Cargo.lock | 1 + lib/runtime-core/src/types.rs | 7 +------ lib/spectests/Cargo.toml | 1 + lib/spectests/build/spectests.rs | 9 +++++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3cf75ae4..f06c9e940 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1273,6 +1273,7 @@ version = "0.1.2" dependencies = [ "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-clif-backend 0.1.2", + "wasmer-llvm-backend 0.1.0", "wasmer-runtime-core 0.1.2", ] diff --git a/lib/runtime-core/src/types.rs b/lib/runtime-core/src/types.rs index 618f24004..9ee5270dd 100644 --- a/lib/runtime-core/src/types.rs +++ b/lib/runtime-core/src/types.rs @@ -1,9 +1,4 @@ -use crate::{ - memory::MemoryType, - module::ModuleInfo, - structures::TypedIndex, - units::Pages, -}; +use crate::{memory::MemoryType, module::ModuleInfo, structures::TypedIndex, units::Pages}; use std::{borrow::Cow, mem}; /// Represents a WebAssembly type. diff --git a/lib/spectests/Cargo.toml b/lib/spectests/Cargo.toml index f69782b40..49f052d77 100644 --- a/lib/spectests/Cargo.toml +++ b/lib/spectests/Cargo.toml @@ -16,6 +16,7 @@ wabt = "0.7.2" [dev-dependencies] wasmer-clif-backend = { path = "../clif-backend", version = "0.1.2" } +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.1.0" } wabt = "0.7.2" [features] diff --git a/lib/spectests/build/spectests.rs b/lib/spectests/build/spectests.rs index 54d9404d6..25b3b63b8 100644 --- a/lib/spectests/build/spectests.rs +++ b/lib/spectests/build/spectests.rs @@ -78,6 +78,7 @@ static COMMON: &'static str = r##" use std::{{f32, f64}}; use wabt::wat2wasm; use wasmer_clif_backend::CraneliftCompiler; +use wasmer_llvm_backend::LLVMCompiler; use wasmer_runtime_core::import::ImportObject; use wasmer_runtime_core::types::Value; use wasmer_runtime_core::{{Instance, module::Module}}; @@ -97,7 +98,7 @@ static IMPORT_MODULE: &str = r#" pub fn generate_imports() -> ImportObject { let wasm_binary = wat2wasm(IMPORT_MODULE.as_bytes()).expect("WAST not valid or malformed"); - let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new()) + let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &LLVMCompiler::new()) .expect("WASM can't be compiled"); let instance = module .instantiate(&ImportObject::new()) @@ -358,7 +359,7 @@ fn test_module_{}() {{ let module_str = \"{}\"; println!(\"{{}}\", module_str); let wasm_binary = wat2wasm(module_str.as_bytes()).expect(\"WAST not valid or malformed\"); - let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new()).expect(\"WASM can't be compiled\"); + let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &LLVMCompiler::new()).expect(\"WASM can't be compiled\"); module.instantiate(&generate_imports()).expect(\"WASM can't be instantiated\") }}\n", self.last_module, @@ -381,7 +382,7 @@ fn test_module_{}() {{ "#[test] fn {}_assert_invalid() {{ let wasm_binary = {:?}; - let module = wasmer_runtime_core::compile_with(&wasm_binary, &CraneliftCompiler::new()); + let module = wasmer_runtime_core::compile_with(&wasm_binary, &LLVMCompiler::new()); assert!(module.is_err(), \"WASM should not compile as is invalid\"); }}\n", command_name, @@ -512,7 +513,7 @@ fn {}_assert_invalid() {{ "#[test] fn {}_assert_malformed() {{ let wasm_binary = {:?}; - let compilation = wasmer_runtime_core::compile_with(&wasm_binary, &CraneliftCompiler::new()); + let compilation = wasmer_runtime_core::compile_with(&wasm_binary, &LLVMCompiler::new()); assert!(compilation.is_err(), \"WASM should not compile as is malformed\"); }}\n", command_name,