diff --git a/lib/jit/Cargo.toml b/lib/jit/Cargo.toml
index 45df39dd..19891cf6 100644
@@ -23,12 +23,12 @@ 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 }
hashbrown = { version = "0.1.8", optional = true }
-wasmparser = "0.29.2"
+wasmparser = { version = "0.29.2", default-features = false }
[features]
default = ["std"]
-std = ["cranelift-codegen/std", "cranelift-wasm/std"]
-core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"]
+std = ["cranelift-codegen/std", "cranelift-frontend/std", "cranelift-entity/std", "cranelift-wasm/std", "wasmtime-runtime/std", "wasmtime-environ/std", "wasmparser/std"]
+core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core", "wasmtime-runtime/core"]
[badges]
maintenance = { status = "experimental" }
diff --git a/lib/jit/src/context.rs b/lib/jit/src/context.rs
index 1b36f9bc..c0393ed1 100644
@@ -1,13 +1,13 @@
+use super::HashMap;
use crate::action::{get, inspect_memory, invoke};
use crate::{
instantiate, ActionError, ActionOutcome, Compiler, InstanceHandle, Namespace, RuntimeValue,
SetupError,
};
+use core::cell::RefCell;
use cranelift_codegen::isa::TargetIsa;
use std::borrow::ToOwned;
use std::boxed::Box;
-use std::cell::RefCell;
-use std::collections::HashMap;
use std::rc::Rc;
use std::string::{String, ToString};
use std::{fmt, str};
diff --git a/lib/jit/src/lib.rs b/lib/jit/src/lib.rs
index 9c878c6b..1f451151 100644
@@ -21,20 +21,11 @@
clippy::use_self
)
)]
-#![no_std]
-#![cfg_attr(not(feature = "std"), feature(alloc))]
#[cfg(not(feature = "std"))]
-#[macro_use]
-extern crate alloc as std;
-#[cfg(feature = "std")]
-#[macro_use]
-extern crate std;
-
-#[cfg(not(feature = "std"))]
-use hashbrown::{hash_map, HashMap};
+use hashbrown::{hash_map, HashMap, HashSet};
#[cfg(feature = "std")]
-use std::collections::{hash_map, HashMap};
+use std::collections::{hash_map, HashMap, HashSet};
#[macro_use]
extern crate failure_derive;
diff --git a/lib/jit/src/link.rs b/lib/jit/src/link.rs
index 9fbfbdc5..4d70b65f 100644
@@ -1,11 +1,11 @@
//! Linking for JIT-compiled code.
+use super::HashSet;
use crate::resolver::Resolver;
use core::ptr::write_unaligned;
use cranelift_codegen::binemit::Reloc;
use cranelift_entity::PrimaryMap;
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
-use std::collections::HashSet;
use std::vec::Vec;
use wasmtime_environ::{
MemoryPlan, MemoryStyle, Module, Relocation, RelocationTarget, Relocations, TablePlan,
diff --git a/lib/runtime/Cargo.toml b/lib/runtime/Cargo.toml
index 9b42668b..7d70cb8e 100644
@@ -25,6 +25,7 @@ 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 }
indexmap = "1.0.2"
+hashbrown = { version = "0.1.8", optional = true }
[target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3.6", features = ["winbase", "memoryapi"] }
@@ -37,6 +38,7 @@ regex = "1.0.6"
[features]
default = ["std"]
std = ["cranelift-codegen/std", "cranelift-wasm/std", "wasmtime-environ/std"]
+core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"]
[badges]
maintenance = { status = "experimental" }
diff --git a/lib/runtime/src/imports.rs b/lib/runtime/src/imports.rs
index 082f799a..db7496a5 100644
@@ -1,8 +1,8 @@
+use super::HashSet;
use crate::instance::InstanceHandle;
use crate::vmcontext::{VMFunctionImport, VMGlobalImport, VMMemoryImport, VMTableImport};
use cranelift_entity::{BoxedSlice, PrimaryMap};
use cranelift_wasm::{FuncIndex, GlobalIndex, MemoryIndex, TableIndex};
-use std::collections::HashSet;
/// Resolved import pointers.
#[derive(Clone)]
diff --git a/lib/runtime/src/instance.rs b/lib/runtime/src/instance.rs
index c3a25f70..720175f3 100644
@@ -2,6 +2,7 @@
//! wasm module (except its callstack and register state). An
//! `InstanceHandle` is a reference-counting handle for an `Instance`.
+use super::{HashMap, HashSet};
use crate::export::Export;
use crate::imports::Imports;
use crate::memory::LinearMemory;
@@ -28,7 +29,6 @@ use cranelift_wasm::{
use indexmap;
use std::borrow::ToOwned;
use std::boxed::Box;
-use std::collections::{HashMap, HashSet};
use std::rc::Rc;
use std::string::{String, ToString};
use wasmtime_environ::{DataInitializer, Module, TableElements, VMOffsets};
@@ -727,7 +727,7 @@ impl InstanceHandle {
// Collect the exports for the global export map.
for (field, decl) in &instance.module.exports {
- use std::collections::hash_map::Entry::*;
+ use super::hash_map::Entry::*;
let cell: &RefCell<HashMap<std::string::String, core::option::Option<Export>>> =
instance.global_exports.borrow();
let map: &mut HashMap<std::string::String, core::option::Option<Export>> =
diff --git a/lib/runtime/src/lib.rs b/lib/runtime/src/lib.rs
index 624b7e43..6847d3b0 100644
@@ -31,6 +31,18 @@ extern crate failure_derive;
#[cfg(target_os = "windows")]
extern crate winapi;
+#[cfg(not(feature = "std"))]
+#[macro_use]
+extern crate alloc as std;
+#[cfg(feature = "std")]
+#[macro_use]
+extern crate std;
+
+#[cfg(not(feature = "std"))]
+use hashbrown::{hash_map, HashMap, HashSet};
+#[cfg(feature = "std")]
+use std::collections::{hash_map, HashMap, HashSet};
+
mod export;
mod imports;
mod instance;
diff --git a/lib/runtime/src/sig_registry.rs b/lib/runtime/src/sig_registry.rs
index 646cac25..ea4a1698 100644
@@ -1,10 +1,10 @@
//! Implement a registry of function signatures, for fast indirect call
//! signature checking.
+use super::{hash_map, HashMap};
use crate::vmcontext::VMSharedSignatureIndex;
use cast;
use cranelift_codegen::ir;
-use std::collections::{hash_map, HashMap};
/// WebAssembly requires that the caller and callee signatures in an indirect
/// call must match. To implement this efficiently, keep a registry of all