diff --git a/fuzz/.gitignore b/fuzz/.gitignore deleted file mode 100644 index a0925114d6..0000000000 --- a/fuzz/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -target -corpus -artifacts diff --git a/fuzz/corpus/compile/1340712d77d3db3c79b4b0c1494df18615485480 b/fuzz/corpus/compile/1340712d77d3db3c79b4b0c1494df18615485480 new file mode 100644 index 0000000000..e618c158ba Binary files /dev/null and b/fuzz/corpus/compile/1340712d77d3db3c79b4b0c1494df18615485480 differ diff --git a/fuzz/fuzz_targets/compile.rs b/fuzz/fuzz_targets/compile.rs index 674e8f46cd..e94e659838 100644 --- a/fuzz/fuzz_targets/compile.rs +++ b/fuzz/fuzz_targets/compile.rs @@ -10,7 +10,7 @@ extern crate wasmtime_jit; use cranelift_codegen::settings; use wasmparser::validate; -use wasmtime_environ::{Module, ModuleEnvironment}; +use wasmtime_jit::{CompiledModule, Compiler, NullResolver}; fuzz_target!(|data: &[u8]| { if !validate(data, None) { @@ -21,14 +21,9 @@ fuzz_target!(|data: &[u8]| { panic!("host machine is not a supported target"); }); let isa = isa_builder.finish(settings::Flags::new(flag_builder)); - let mut module = Module::new(); - let environment = ModuleEnvironment::new(&*isa, &mut module); - let translation = match environment.translate(data) { - Ok(translation) => translation, - Err(_) => return, - }; - let imports_resolver = |_env: &str, _function: &str| None; - let _exec = match wasmtime_jit::compile_and_link_module(&*isa, &translation, imports_resolver) { + let mut compiler = Compiler::new(isa); + let mut resolver = NullResolver {}; + let _compiled = match CompiledModule::new(&mut compiler, data, &mut resolver) { Ok(x) => x, Err(_) => return, }; diff --git a/lib/environ/Cargo.toml b/lib/environ/Cargo.toml index d1a074cbc2..3961c5d9a7 100644 --- a/lib/environ/Cargo.toml +++ b/lib/environ/Cargo.toml @@ -18,12 +18,12 @@ cranelift-wasm = "0.26.0" cast = { version = "0.2.2", default-features = false } failure = { version = "0.1.3", default-features = false } failure_derive = { version = "0.1.3", default-features = false } -hashmap_core = { version = "0.1.9", optional = true } +hashbrown = { version = "0.1.8", optional = true } [features] default = ["std"] std = ["cranelift-codegen/std", "cranelift-wasm/std"] -core = ["hashmap_core", "cranelift-codegen/core", "cranelift-wasm/core"] +core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core"] [badges] maintenance = { status = "experimental" } diff --git a/lib/environ/src/lib.rs b/lib/environ/src/lib.rs index 9642a73c50..3df9331acc 100644 --- a/lib/environ/src/lib.rs +++ b/lib/environ/src/lib.rs @@ -35,7 +35,7 @@ extern crate alloc as std; extern crate std; #[cfg(not(feature = "std"))] -use hashmap_core::HashMap; +use hashbrown::HashMap; #[cfg(feature = "std")] use std::collections::HashMap; diff --git a/lib/jit/Cargo.toml b/lib/jit/Cargo.toml index 5ccd702150..84dcf169a9 100644 --- a/lib/jit/Cargo.toml +++ b/lib/jit/Cargo.toml @@ -22,12 +22,12 @@ region = "1.0.0" failure = { version = "0.1.3", default-features = false } failure_derive = { version = "0.1.3", default-features = false } target-lexicon = { version = "0.2.0", default-features = false } -hashmap_core = { version = "0.1.9", optional = true } +hashbrown = { version = "0.1.8", optional = true } [features] default = ["std"] std = ["cranelift-codegen/std", "cranelift-wasm/std"] -core = ["hashmap_core", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"] +core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"] [badges] maintenance = { status = "experimental" } diff --git a/lib/jit/src/lib.rs b/lib/jit/src/lib.rs index 40c9b0b26b..bb484b6803 100644 --- a/lib/jit/src/lib.rs +++ b/lib/jit/src/lib.rs @@ -32,7 +32,7 @@ extern crate alloc as std; extern crate std; #[cfg(not(feature = "std"))] -use hashmap_core::{map as hash_map, HashMap}; +use hashbrown::{map as hash_map, HashMap}; #[cfg(feature = "std")] use std::collections::{hash_map, HashMap}; diff --git a/lib/runtime/src/lib.rs b/lib/runtime/src/lib.rs index b49802dcf5..b7cb319170 100644 --- a/lib/runtime/src/lib.rs +++ b/lib/runtime/src/lib.rs @@ -32,7 +32,7 @@ extern crate alloc as std; extern crate std; #[cfg(not(feature = "std"))] -use hashmap_core::{map as hash_map, HashMap}; +use hashbrown::{map as hash_map, HashMap}; #[cfg(feature = "std")] use std::collections::{hash_map, HashMap}; diff --git a/test-all.sh b/test-all.sh index f8cf22c95c..0450084289 100755 --- a/test-all.sh +++ b/test-all.sh @@ -62,13 +62,10 @@ if rustup toolchain list | grep -q nightly; then cargo +nightly install cargo-fuzz fi - echo "Fuzz check temporarily disabled until " - echo "https://github.com/Amanieu/hashmap_core/pull/8" - echo "is merged." - #fuzz_module="8f0d725b20dcea52335cf521a5bb083833a5241f" - #ASAN_OPTIONS=detect_leaks=0 \ - #cargo +nightly fuzz run compile \ - # "$topdir/fuzz/corpus/compile/$fuzz_module" + fuzz_module="1340712d77d3db3c79b4b0c1494df18615485480" + ASAN_OPTIONS=detect_leaks=0 \ + cargo +nightly fuzz run compile \ + "$topdir/fuzz/corpus/compile/$fuzz_module" else echo "nightly toolchain not found, skipping fuzz target integration test" fi