Browse Source

Migrate back to `std::` stylistically (#554)

* Migrate back to `std::` stylistically

This commit moves away from idioms such as `alloc::` and `core::` as
imports of standard data structures and types. Instead it migrates all
crates to uniformly use `std::` for importing standard data structures
and types. This also removes the `std` and `core` features from all
crates to and removes any conditional checking for `feature = "std"`

All of this support was previously added in #407 in an effort to make
wasmtime/cranelift "`no_std` compatible". Unfortunately though this
change comes at a cost:

* The usage of `alloc` and `core` isn't idiomatic. Especially trying to
  dual between types like `HashMap` from `std` as well as from
  `hashbrown` causes imports to be surprising in some cases.
* Unfortunately there was no CI check that crates were `no_std`, so none
  of them actually were. Many crates still imported from `std` or
  depended on crates that used `std`.

It's important to note, however, that **this does not mean that wasmtime
will not run in embedded environments**. The style of the code today and
idioms aren't ready in Rust to support this degree of multiplexing and
makes it somewhat difficult to keep up with the style of `wasmtime`.
Instead it's intended that embedded runtime support will be added as
necessary. Currently only `std` is necessary to build `wasmtime`, and
platforms that natively need to execute `wasmtime` will need to use a
Rust target that supports `std`. Note though that not all of `std` needs
to be supported, but instead much of it could be configured off to
return errors, and `wasmtime` would be configured to gracefully handle
errors.

The goal of this PR is to move `wasmtime` back to idiomatic usage of
features/`std`/imports/etc and help development in the short-term.
Long-term when platform concerns arise (if any) they can be addressed by
moving back to `no_std` crates (but fixing the issues mentioned above)
or ensuring that the target in Rust has `std` available.

* Start filling out platform support doc
pull/597/head
Alex Crichton 5 years ago
committed by Dan Gohman
parent
commit
39e57e3e9a
  1. 17
      crates/api/Cargo.toml
  2. 2
      crates/api/examples/hello.rs
  3. 6
      crates/api/src/callable.rs
  4. 6
      crates/api/src/context.rs
  5. 11
      crates/api/src/externals.rs
  6. 7
      crates/api/src/instance.rs
  7. 8
      crates/api/src/lib.rs
  8. 5
      crates/api/src/module.rs
  9. 9
      crates/api/src/ref.rs
  10. 8
      crates/api/src/runtime.rs
  11. 11
      crates/api/src/trampoline/create_handle.rs
  12. 4
      crates/api/src/trampoline/func.rs
  13. 1
      crates/api/src/trampoline/global.rs
  14. 4
      crates/api/src/trampoline/memory.rs
  15. 2
      crates/api/src/trampoline/mod.rs
  16. 4
      crates/api/src/trampoline/table.rs
  17. 1
      crates/api/src/trap.rs
  18. 12
      crates/api/src/types.rs
  19. 2
      crates/api/src/values.rs
  20. 27
      crates/api/src/wasm.rs
  21. 8
      crates/debug/Cargo.toml
  22. 5
      crates/debug/src/gc.rs
  23. 14
      crates/debug/src/lib.rs
  24. 1
      crates/debug/src/read_debuginfo.rs
  25. 12
      crates/debug/src/transform/address_transform.rs
  26. 3
      crates/debug/src/transform/attr.rs
  27. 5
      crates/debug/src/transform/expression.rs
  28. 5
      crates/debug/src/transform/line_program.rs
  29. 3
      crates/debug/src/transform/mod.rs
  30. 1
      crates/debug/src/transform/range_info_builder.rs
  31. 4
      crates/debug/src/transform/simulate.rs
  32. 3
      crates/debug/src/transform/unit.rs
  33. 1
      crates/debug/src/transform/utils.rs
  34. 2
      crates/debug/src/write_debuginfo.rs
  35. 5
      crates/environ/Cargo.toml
  36. 1
      crates/environ/src/address_map.rs
  37. 3
      crates/environ/src/cache.rs
  38. 4
      crates/environ/src/cache/config.rs
  39. 2
      crates/environ/src/cache/config/tests.rs
  40. 4
      crates/environ/src/cache/tests.rs
  41. 7
      crates/environ/src/cache/worker.rs
  42. 2
      crates/environ/src/cache/worker/tests.rs
  43. 1
      crates/environ/src/compilation.rs
  44. 1
      crates/environ/src/cranelift.rs
  45. 4
      crates/environ/src/func_environ.rs
  46. 3
      crates/environ/src/lib.rs
  47. 5
      crates/environ/src/module.rs
  48. 5
      crates/environ/src/module_environ.rs
  49. 2
      crates/environ/src/vmoffsets.rs
  50. 4
      crates/interface-types/Cargo.toml
  51. 9
      crates/interface-types/src/lib.rs
  52. 5
      crates/interface-types/src/value.rs
  53. 24
      crates/jit/Cargo.toml
  54. 6
      crates/jit/src/action.rs
  55. 5
      crates/jit/src/code_memory.rs
  56. 9
      crates/jit/src/compiler.rs
  57. 8
      crates/jit/src/context.rs
  58. 11
      crates/jit/src/instantiate.rs
  59. 8
      crates/jit/src/lib.rs
  60. 5
      crates/jit/src/link.rs
  61. 3
      crates/jit/src/namespace.rs
  62. 2
      crates/jit/src/target_tunables.rs
  63. 2
      crates/lightbeam/src/function_body.rs
  64. 4
      crates/lightbeam/src/module.rs
  65. 4
      crates/misc/py/src/function.rs
  66. 4
      crates/misc/py/src/instance.rs
  67. 4
      crates/misc/py/src/memory.rs
  68. 2
      crates/misc/py/src/module.rs
  69. 6
      crates/obj/src/context.rs
  70. 2
      crates/obj/src/data_segment.rs
  71. 1
      crates/obj/src/function.rs
  72. 2
      crates/obj/src/lib.rs
  73. 1
      crates/obj/src/module.rs
  74. 2
      crates/obj/src/table.rs
  75. 15
      crates/runtime/Cargo.toml
  76. 2
      crates/runtime/src/imports.rs
  77. 31
      crates/runtime/src/instance.rs
  78. 6
      crates/runtime/src/jit_int.rs
  79. 14
      crates/runtime/src/lib.rs
  80. 3
      crates/runtime/src/memory.rs
  81. 6
      crates/runtime/src/mmap.rs
  82. 10
      crates/runtime/src/sig_registry.rs
  83. 6
      crates/runtime/src/signalhandlers.rs
  84. 3
      crates/runtime/src/table.rs
  85. 4
      crates/runtime/src/trap_registry.rs
  86. 5
      crates/runtime/src/traphandlers.rs
  87. 26
      crates/runtime/src/vmcontext.rs
  88. 4
      crates/wasi-c/src/instantiate.rs
  89. 3
      crates/wasi-c/src/lib.rs
  90. 2
      crates/wasi-c/src/syscalls.rs
  91. 2
      crates/wasi-c/src/translate.rs
  92. 111
      crates/wasi-c/src/wasm32.rs
  93. 4
      crates/wasi/src/instantiate.rs
  94. 2
      crates/wasi/src/lib.rs
  95. 2
      crates/wast/src/lib.rs
  96. 4
      crates/wast/src/spectest.rs
  97. 42
      docs/stability-platform-support.md
  98. 6
      fuzz/fuzz_targets/compile.rs
  99. 6
      tests/instantiate.rs

17
crates/api/Cargo.toml

@ -26,23 +26,6 @@ target-lexicon = { version = "0.9.0", default-features = false }
anyhow = "1.0.19"
thiserror = "1.0.4"
region = "2.0.0"
hashbrown = { version = "0.6.0", optional = true }
[features]
default = ["std"]
std = [
"cranelift-codegen/std",
"cranelift-wasm/std",
"wasmtime-environ/std",
"wasmparser/std"
]
core = [
"hashbrown/nightly",
"cranelift-codegen/core",
"cranelift-wasm/core",
"wasmtime-environ/core",
"wasmparser/core"
]
[dev-dependencies]
# for wasmtime.rs

2
crates/api/examples/hello.rs

@ -1,7 +1,7 @@
//! Translation of hello example
use anyhow::{ensure, format_err, Context as _, Result};
use core::cell::Ref;
use std::cell::Ref;
use std::rc::Rc;
use wasmtime_api::*;

6
crates/api/src/callable.rs

@ -4,8 +4,8 @@ use crate::trampoline::generate_func_export;
use crate::trap::Trap;
use crate::types::FuncType;
use crate::values::Val;
use alloc::{rc::Rc, vec::Vec};
use cranelift_codegen::ir;
use std::rc::Rc;
use wasmtime_jit::InstanceHandle;
use wasmtime_runtime::Export;
@ -43,8 +43,8 @@ impl WasmtimeFn {
impl WrappedCallable for WasmtimeFn {
fn call(&self, params: &[Val], results: &mut [Val]) -> Result<(), HostRef<Trap>> {
use core::cmp::max;
use core::{mem, ptr};
use std::cmp::max;
use std::{mem, ptr};
let (vmctx, body, signature) = match self.wasmtime_export() {
Export::Function {

6
crates/api/src/context.rs

@ -1,7 +1,7 @@
use crate::Config;
use alloc::rc::Rc;
use core::cell::{RefCell, RefMut};
use core::hash::{Hash, Hasher};
use std::cell::{RefCell, RefMut};
use std::hash::{Hash, Hasher};
use std::rc::Rc;
use wasmtime_jit::{Compiler, Features};
#[derive(Clone)]

11
crates/api/src/externals.rs

@ -5,10 +5,9 @@ use crate::trampoline::{generate_global_export, generate_memory_export, generate
use crate::trap::Trap;
use crate::types::{ExternType, FuncType, GlobalType, MemoryType, TableType, ValType};
use crate::values::{from_checked_anyfunc, into_checked_anyfunc, Val};
use alloc::boxed::Box;
use alloc::rc::Rc;
use core::result::Result;
use core::slice;
use std::fmt;
use std::rc::Rc;
use std::slice;
use wasmtime_runtime::InstanceHandle;
// Externals
@ -172,8 +171,8 @@ impl Func {
}
}
impl core::fmt::Debug for Func {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl fmt::Debug for Func {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Func")
}
}

7
crates/api/src/instance.rs

@ -4,11 +4,10 @@ use crate::module::Module;
use crate::r#ref::HostRef;
use crate::runtime::Store;
use crate::types::{ExportType, ExternType, Name};
use crate::{HashMap, HashSet};
use alloc::string::{String, ToString};
use alloc::{boxed::Box, rc::Rc, vec::Vec};
use anyhow::Result;
use core::cell::RefCell;
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::rc::Rc;
use wasmtime_jit::{instantiate, Resolver};
use wasmtime_runtime::{Export, InstanceHandle};

8
crates/api/src/lib.rs

@ -1,7 +1,6 @@
//! Wasmtime embed API. Based on wasm-c-api.
#![allow(improper_ctypes)]
#![cfg_attr(not(feature = "std"), no_std)]
mod callable;
mod context;
@ -17,8 +16,6 @@ mod values;
pub mod wasm;
extern crate alloc;
pub use crate::callable::Callable;
pub use crate::externals::*;
pub use crate::instance::Instance;
@ -28,8 +25,3 @@ pub use crate::runtime::{Config, Engine, Store};
pub use crate::trap::Trap;
pub use crate::types::*;
pub use crate::values::*;
#[cfg(not(feature = "std"))]
use hashbrown::{hash_map, HashMap, HashSet};
#[cfg(feature = "std")]
use std::collections::{hash_map, HashMap, HashSet};

5
crates/api/src/module.rs

@ -4,7 +4,6 @@ use crate::types::{
ExportType, ExternType, FuncType, GlobalType, ImportType, Limits, MemoryType, Mutability,
TableType, ValType,
};
use alloc::{boxed::Box, string::String, vec::Vec};
use anyhow::Result;
use wasmparser::{validate, ExternalKind, ImportSectionEntryType, ModuleReader, SectionCode};
@ -12,7 +11,7 @@ fn into_memory_type(mt: wasmparser::MemoryType) -> MemoryType {
assert!(!mt.shared);
MemoryType::new(Limits::new(
mt.limits.initial,
mt.limits.maximum.unwrap_or(::core::u32::MAX),
mt.limits.maximum.unwrap_or(std::u32::MAX),
))
}
@ -53,7 +52,7 @@ fn into_table_type(tt: wasmparser::TableType) -> TableType {
let ty = into_valtype(&tt.element_type);
let limits = Limits::new(
tt.limits.initial,
tt.limits.maximum.unwrap_or(::core::u32::MAX),
tt.limits.maximum.unwrap_or(std::u32::MAX),
);
TableType::new(ty, limits)
}

9
crates/api/src/ref.rs

@ -1,8 +1,7 @@
use alloc::boxed::Box;
use alloc::rc::{Rc, Weak};
use core::any::Any;
use core::cell::{self, RefCell};
use core::fmt;
use std::any::Any;
use std::cell::{self, RefCell};
use std::fmt;
use std::rc::{Rc, Weak};
pub trait HostInfo {
fn finalize(&mut self) {}

8
crates/api/src/runtime.rs

@ -1,9 +1,9 @@
use crate::context::Context;
use crate::r#ref::HostRef;
use crate::HashMap;
use alloc::{rc::Rc, string::String};
use core::cell::RefCell;
use cranelift_codegen::{ir, settings};
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use wasmtime_jit::{CompilationStrategy, Features};
// Runtime Environment
@ -143,7 +143,7 @@ impl Store {
&mut self,
signature: &ir::Signature,
) -> wasmtime_runtime::VMSharedSignatureIndex {
use crate::hash_map::Entry;
use std::collections::hash_map::Entry;
let index = self.context().compiler().signatures().register(signature);
match self.signature_cache.entry(index) {
Entry::Vacant(v) => {

11
crates/api/src/trampoline/create_handle.rs

@ -1,16 +1,13 @@
//! Support for a calling of an imported function.
use crate::runtime::Store;
use crate::{HashMap, HashSet};
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::string::String;
use alloc::vec::Vec;
use anyhow::Result;
use core::any::Any;
use core::cell::{RefCell, RefMut};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;
use std::any::Any;
use std::cell::{RefCell, RefMut};
use std::collections::{HashMap, HashSet};
use std::rc::Rc;
use wasmtime_environ::Module;
use wasmtime_runtime::{Imports, InstanceHandle, VMFunctionBody};

4
crates/api/src/trampoline/func.rs

@ -3,15 +3,15 @@
use super::create_handle::create_handle;
use crate::r#ref::HostRef;
use crate::{Callable, FuncType, Store, Trap, Val};
use alloc::{boxed::Box, rc::Rc, string::ToString, vec::Vec};
use anyhow::Result;
use core::cmp;
use cranelift_codegen::ir::{types, InstBuilder, StackSlotData, StackSlotKind, TrapCode};
use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::{binemit, ir, isa, Context};
use cranelift_entity::{EntityRef, PrimaryMap};
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
use cranelift_wasm::{DefinedFuncIndex, FuncIndex};
use std::cmp;
use std::rc::Rc;
use wasmtime_environ::{CompiledFunction, Export, Module};
use wasmtime_jit::CodeMemory;
use wasmtime_runtime::{InstanceHandle, VMContext, VMFunctionBody};

1
crates/api/src/trampoline/global.rs

@ -1,6 +1,5 @@
use super::create_handle::create_handle;
use crate::{GlobalType, Mutability, Val};
use alloc::boxed::Box;
use anyhow::Result;
use cranelift_entity::PrimaryMap;
use wasmtime_environ::Module;

4
crates/api/src/trampoline/memory.rs

@ -1,7 +1,5 @@
use super::create_handle::create_handle;
use crate::MemoryType;
use alloc::boxed::Box;
use alloc::string::ToString;
use anyhow::Result;
use cranelift_entity::PrimaryMap;
use wasmtime_environ::Module;
@ -14,7 +12,7 @@ pub fn create_handle_with_memory(memory: &MemoryType) -> Result<InstanceHandle>
let memory = cranelift_wasm::Memory {
minimum: memory.limits().min(),
maximum: if memory.limits().max() == core::u32::MAX {
maximum: if memory.limits().max() == std::u32::MAX {
None
} else {
Some(memory.limits().max())

2
crates/api/src/trampoline/mod.rs

@ -12,8 +12,8 @@ use self::memory::create_handle_with_memory;
use self::table::create_handle_with_table;
use super::{Callable, FuncType, GlobalType, MemoryType, Store, TableType, Val};
use crate::r#ref::HostRef;
use alloc::rc::Rc;
use anyhow::Result;
use std::rc::Rc;
pub use self::global::GlobalState;

4
crates/api/src/trampoline/table.rs

@ -1,7 +1,5 @@
use super::create_handle::create_handle;
use crate::{TableType, ValType};
use alloc::boxed::Box;
use alloc::string::ToString;
use anyhow::Result;
use cranelift_entity::PrimaryMap;
use cranelift_wasm::TableElementType;
@ -13,7 +11,7 @@ pub fn create_handle_with_table(table: &TableType) -> Result<InstanceHandle> {
let table = cranelift_wasm::Table {
minimum: table.limits().min(),
maximum: if table.limits().max() == core::u32::MAX {
maximum: if table.limits().max() == std::u32::MAX {
None
} else {
Some(table.limits().max())

1
crates/api/src/trap.rs

@ -1,4 +1,3 @@
use alloc::string::{String, ToString};
use thiserror::Error;
#[derive(Error, Debug)]

12
crates/api/src/types.rs

@ -1,7 +1,3 @@
use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use cranelift_codegen::ir;
// Type Representations
@ -28,7 +24,7 @@ impl Limits {
pub fn at_least(min: u32) -> Limits {
Limits {
min,
max: ::core::u32::MAX,
max: ::std::u32::MAX,
}
}
@ -277,7 +273,7 @@ impl TableType {
false
});
let ty = ValType::FuncRef;
let limits = Limits::new(table.minimum, table.maximum.unwrap_or(::core::u32::MAX));
let limits = Limits::new(table.minimum, table.maximum.unwrap_or(::std::u32::MAX));
TableType::new(ty, limits)
}
}
@ -300,7 +296,7 @@ impl MemoryType {
pub(crate) fn from_cranelift_memory(memory: &cranelift_wasm::Memory) -> MemoryType {
MemoryType::new(Limits::new(
memory.minimum,
memory.maximum.unwrap_or(::core::u32::MAX),
memory.maximum.unwrap_or(::std::u32::MAX),
))
}
}
@ -326,7 +322,7 @@ impl From<String> for Name {
}
}
impl ::alloc::string::ToString for Name {
impl ToString for Name {
fn to_string(&self) -> String {
self.0.to_owned()
}

2
crates/api/src/values.rs

@ -2,8 +2,8 @@ use crate::externals::Func;
use crate::r#ref::{AnyRef, HostRef};
use crate::runtime::Store;
use crate::types::ValType;
use core::ptr;
use cranelift_codegen::ir;
use std::ptr;
use wasmtime_jit::RuntimeValue;
#[derive(Debug, Clone)]

27
crates/api/src/wasm.rs

@ -10,9 +10,8 @@ use super::{
HostInfo, HostRef, ImportType, Instance, Limits, Memory, MemoryType, Module, Name, Store,
Table, TableType, Trap, Val, ValType,
};
use alloc::boxed::Box;
use alloc::rc::Rc;
use core::{mem, ptr, slice};
use std::rc::Rc;
use std::{mem, ptr, slice};
macro_rules! declare_vec {
($name:ident, $elem_ty:path) => {
@ -343,12 +342,12 @@ pub struct wasm_func_t {
func: HostRef<Func>,
ext: Option<Box<wasm_extern_t>>,
}
pub type wasm_func_callback_t = ::core::option::Option<
pub type wasm_func_callback_t = std::option::Option<
unsafe extern "C" fn(args: *const wasm_val_t, results: *mut wasm_val_t) -> *mut wasm_trap_t,
>;
pub type wasm_func_callback_with_env_t = ::core::option::Option<
pub type wasm_func_callback_with_env_t = std::option::Option<
unsafe extern "C" fn(
env: *mut ::core::ffi::c_void,
env: *mut std::ffi::c_void,
args: *const wasm_val_t,
results: *mut wasm_val_t,
) -> *mut wasm_trap_t,
@ -567,8 +566,8 @@ impl Into<HostRef<Trap>> for wasm_trap_t {
struct CallbackWithEnv {
callback: wasm_func_callback_with_env_t,
env: *mut ::core::ffi::c_void,
finalizer: ::core::option::Option<unsafe extern "C" fn(env: *mut ::core::ffi::c_void)>,
env: *mut std::ffi::c_void,
finalizer: std::option::Option<unsafe extern "C" fn(env: *mut std::ffi::c_void)>,
}
impl Callable for CallbackWithEnv {
@ -799,8 +798,8 @@ pub unsafe extern "C" fn wasm_func_new_with_env(
store: *mut wasm_store_t,
ty: *const wasm_functype_t,
callback: wasm_func_callback_with_env_t,
env: *mut ::core::ffi::c_void,
finalizer: ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>,
env: *mut std::ffi::c_void,
finalizer: std::option::Option<unsafe extern "C" fn(arg1: *mut std::ffi::c_void)>,
) -> *mut wasm_func_t {
let store = &(*store).store;
let ty = (*ty).functype.clone();
@ -1614,8 +1613,8 @@ pub unsafe extern "C" fn wasm_tabletype_new(
}
struct HostInfoState {
info: *mut ::core::ffi::c_void,
finalizer: ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>,
info: *mut std::ffi::c_void,
finalizer: std::option::Option<unsafe extern "C" fn(arg1: *mut std::ffi::c_void)>,
}
impl HostInfo for HostInfoState {
@ -1631,8 +1630,8 @@ impl HostInfo for HostInfoState {
#[no_mangle]
pub unsafe extern "C" fn wasm_instance_set_host_info_with_finalizer(
instance: *mut wasm_instance_t,
info: *mut ::core::ffi::c_void,
finalizer: ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>,
info: *mut std::ffi::c_void,
finalizer: std::option::Option<unsafe extern "C" fn(arg1: *mut std::ffi::c_void)>,
) {
let info = if info.is_null() && finalizer.is_none() {
None

8
crates/debug/Cargo.toml

@ -18,17 +18,11 @@ cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
faerie = "0.13.0"
wasmtime-environ = { path = "../environ", default-features = false }
wasmtime-environ = { path = "../environ" }
target-lexicon = { version = "0.9.0", default-features = false }
anyhow = "1.0"
hashbrown = { version = "0.6.0", optional = true }
thiserror = "1.0.4"
more-asserts = "0.2.1"
[features]
default = ["std"]
std = ["cranelift-codegen/std", "cranelift-wasm/std", "wasmtime-environ/std"]
core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core"]
[badges]
maintenance = { status = "actively-developed" }

5
crates/debug/src/gc.rs

@ -1,9 +1,8 @@
use crate::transform::AddressTransform;
use crate::{HashMap, HashSet};
use alloc::vec::Vec;
use gimli::constants;
use gimli::read;
use gimli::{Reader, UnitSectionOffset};
use std::collections::{HashMap, HashSet};
#[derive(Debug)]
pub struct Dependencies {
@ -20,7 +19,7 @@ impl Dependencies {
}
fn add_edge(&mut self, a: UnitSectionOffset, b: UnitSectionOffset) {
use crate::hash_map::Entry;
use std::collections::hash_map::Entry;
match self.edges.entry(a) {
Entry::Occupied(mut o) => {
o.get_mut().insert(b);

14
crates/debug/src/lib.rs

@ -2,16 +2,10 @@
#![allow(clippy::cast_ptr_alignment)]
use alloc::string::String;
use alloc::vec::Vec;
use anyhow::Error;
use cranelift_codegen::isa::TargetFrontendConfig;
use faerie::{Artifact, Decl};
#[cfg(not(feature = "std"))]
use hashbrown::{hash_map, HashMap, HashSet};
use more_asserts::assert_gt;
#[cfg(feature = "std")]
use std::collections::{hash_map, HashMap, HashSet};
use target_lexicon::{BinaryFormat, Triple};
use wasmtime_environ::{ModuleAddressMap, ModuleVmctxInfo, ValueLabelsRanges};
@ -24,8 +18,6 @@ mod read_debuginfo;
mod transform;
mod write_debuginfo;
extern crate alloc;
struct FunctionRelocResolver {}
impl SymbolResolver for FunctionRelocResolver {
fn resolve_symbol(&self, symbol: usize, addend: i64) -> ResolvedSymbol {
@ -80,12 +72,12 @@ pub fn emit_debugsections_image(
assert_gt!(funcs.len(), 0);
let mut segment_body: (usize, usize) = (!0, 0);
for (body_ptr, body_len) in funcs {
segment_body.0 = ::core::cmp::min(segment_body.0, *body_ptr as usize);
segment_body.1 = ::core::cmp::max(segment_body.1, *body_ptr as usize + body_len);
segment_body.0 = std::cmp::min(segment_body.0, *body_ptr as usize);
segment_body.1 = std::cmp::max(segment_body.1, *body_ptr as usize + body_len);
}
let segment_body = (segment_body.0 as *const u8, segment_body.1 - segment_body.0);
let body = unsafe { ::core::slice::from_raw_parts(segment_body.0, segment_body.1) };
let body = unsafe { std::slice::from_raw_parts(segment_body.0, segment_body.1) };
obj.declare_with("all", Decl::function(), body.to_vec())?;
emit_dwarf(&mut obj, dwarf, &resolver)?;

1
crates/debug/src/read_debuginfo.rs

@ -1,4 +1,3 @@
use alloc::{boxed::Box, string::String, vec::Vec};
use gimli::{
DebugAbbrev, DebugAddr, DebugInfo, DebugLine, DebugLineStr, DebugLoc, DebugLocLists,
DebugRanges, DebugRngLists, DebugStr, DebugStrOffsets, DebugTypes, EndianSlice, LittleEndian,

12
crates/debug/src/transform/address_transform.rs

@ -1,14 +1,12 @@
use crate::HashMap;
use crate::WasmFileInfo;
use alloc::boxed::Box;
use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use core::iter::FromIterator;
use cranelift_codegen::ir::SourceLoc;
use cranelift_entity::{EntityRef, PrimaryMap};
use cranelift_wasm::DefinedFuncIndex;
use gimli::write;
use more_asserts::assert_le;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::iter::FromIterator;
use wasmtime_environ::{FunctionAddressMap, ModuleAddressMap};
pub type GeneratedAddress = usize;
@ -163,7 +161,7 @@ fn build_function_lookup(
active_ranges.clone().into_boxed_slice(),
);
}
active_ranges.retain(|r| ranges[*r].wasm_end.cmp(&wasm_start) != core::cmp::Ordering::Less);
active_ranges.retain(|r| ranges[*r].wasm_end.cmp(&wasm_start) != std::cmp::Ordering::Less);
active_ranges.push(range_index);
last_wasm_pos = Some(wasm_start);
}
@ -494,10 +492,10 @@ impl AddressTransform {
mod tests {
use super::{build_function_lookup, get_wasm_code_offset, AddressTransform};
use crate::read_debuginfo::WasmFileInfo;
use core::iter::FromIterator;
use cranelift_codegen::ir::SourceLoc;
use cranelift_entity::PrimaryMap;
use gimli::write::Address;
use std::iter::FromIterator;
use wasmtime_environ::{FunctionAddressMap, InstructionAddressMap, ModuleAddressMap};
#[test]

3
crates/debug/src/transform/attr.rs

@ -3,12 +3,11 @@ use super::expression::{compile_expression, CompiledExpression, FunctionFrameInf
use super::range_info_builder::RangeInfoBuilder;
use super::unit::PendingDieRef;
use super::{DebugInputContext, Reader, TransformError};
use crate::HashMap;
use alloc::vec::Vec;
use anyhow::Error;
use gimli::{
write, AttributeValue, DebugLineOffset, DebugStr, DebuggingInformationEntry, UnitOffset,
};
use std::collections::HashMap;
pub(crate) enum FileAttributeContext<'a> {
Root(Option<DebugLineOffset>),

5
crates/debug/src/transform/expression.rs

@ -1,6 +1,4 @@
use super::address_transform::AddressTransform;
use crate::{HashMap, HashSet};
use alloc::vec::Vec;
use anyhow::Error;
use cranelift_codegen::ir::{StackSlots, ValueLabel, ValueLoc};
use cranelift_codegen::isa::RegUnit;
@ -9,6 +7,7 @@ use cranelift_entity::EntityRef;
use cranelift_wasm::{get_vmctx_value_label, DefinedFuncIndex};
use gimli::{self, write, Expression, Operation, Reader, ReaderOffset, Register, X86_64};
use more_asserts::{assert_le, assert_lt};
use std::collections::{HashMap, HashSet};
#[derive(Debug)]
pub struct FunctionFrameInfo<'a> {
@ -201,7 +200,7 @@ impl CompiledExpression {
addr_tr: &AddressTransform,
frame_info: Option<&FunctionFrameInfo>,
endian: gimli::RunTimeEndian,
) -> alloc::vec::Vec<(write::Address, u64, write::Expression)> {
) -> Vec<(write::Address, u64, write::Expression)> {
if scope.is_empty() {
return vec![];
}

5
crates/debug/src/transform/line_program.rs

@ -1,15 +1,14 @@
use super::address_transform::AddressTransform;
use super::attr::clone_attr_string;
use super::{Reader, TransformError};
use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use anyhow::Error;
use core::iter::FromIterator;
use cranelift_entity::EntityRef;
use gimli::{
write, DebugLine, DebugLineOffset, DebugStr, DebuggingInformationEntry, LineEncoding, Unit,
};
use more_asserts::assert_le;
use std::collections::BTreeMap;
use std::iter::FromIterator;
#[derive(Debug)]
enum SavedLineProgramRow {

3
crates/debug/src/transform/mod.rs

@ -1,5 +1,5 @@
use crate::gc::build_dependencies;
use crate::{DebugInfoData, HashSet};
use crate::DebugInfoData;
use anyhow::Error;
use cranelift_codegen::isa::TargetFrontendConfig;
use gimli::{
@ -7,6 +7,7 @@ use gimli::{
UnitSectionOffset,
};
use simulate::generate_simulated_dwarf;
use std::collections::HashSet;
use thiserror::Error;
use unit::clone_unit;
use wasmtime_environ::{ModuleAddressMap, ModuleVmctxInfo, ValueLabelsRanges};

1
crates/debug/src/transform/range_info_builder.rs

@ -1,6 +1,5 @@
use super::address_transform::AddressTransform;
use super::{DebugInputContext, Reader};
use alloc::vec::Vec;
use anyhow::Error;
use cranelift_entity::EntityRef;
use cranelift_wasm::DefinedFuncIndex;

4
crates/debug/src/transform/simulate.rs

@ -2,14 +2,12 @@ use super::expression::{CompiledExpression, FunctionFrameInfo};
use super::utils::{add_internal_types, append_vmctx_info, get_function_frame_info};
use super::AddressTransform;
use crate::read_debuginfo::WasmFileInfo;
use crate::{HashMap, HashSet};
use alloc::string::String;
use alloc::vec::Vec;
use anyhow::Error;
use cranelift_entity::EntityRef;
use cranelift_wasm::get_vmctx_value_label;
use gimli::write;
use gimli::{self, LineEncoding};
use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
use wasmtime_environ::{ModuleVmctxInfo, ValueLabelsRanges};

3
crates/debug/src/transform/unit.rs

@ -5,12 +5,11 @@ use super::line_program::clone_line_program;
use super::range_info_builder::RangeInfoBuilder;
use super::utils::{add_internal_types, append_vmctx_info, get_function_frame_info};
use super::{DebugInputContext, Reader, TransformError};
use crate::{HashMap, HashSet};
use alloc::{string::String, vec::Vec};
use anyhow::Error;
use cranelift_entity::EntityRef;
use gimli::write;
use gimli::{AttributeValue, DebuggingInformationEntry, Unit, UnitOffset};
use std::collections::{HashMap, HashSet};
use wasmtime_environ::{ModuleVmctxInfo, ValueLabelsRanges};
pub(crate) type PendingDieRef = (write::UnitEntryId, gimli::DwAt, UnitOffset);

1
crates/debug/src/transform/utils.rs

@ -1,6 +1,5 @@
use super::address_transform::AddressTransform;
use super::expression::{CompiledExpression, FunctionFrameInfo};
use alloc::vec::Vec;
use anyhow::Error;
use cranelift_wasm::DefinedFuncIndex;
use gimli::write;

2
crates/debug/src/write_debuginfo.rs

@ -1,8 +1,8 @@
use alloc::{string::String, vec::Vec};
use faerie::artifact::{Decl, SectionKind};
use faerie::*;
use gimli::write::{Address, Dwarf, EndianVec, Result, Sections, Writer};
use gimli::{RunTimeEndian, SectionId};
use std::result;
#[derive(Clone)]
struct DebugReloc {

5
crates/environ/Cargo.toml

@ -48,10 +48,5 @@ rand = { version = "0.7.0", features = ["small_rng"] }
cranelift-codegen = { version = "0.50.0", features = ["enable-serde", "all-arch"] }
filetime = "0.2.7"
[features]
default = ["std"]
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
core = ["cranelift-codegen/core", "cranelift-wasm/core"]
[badges]
maintenance = { status = "actively-developed" }

1
crates/environ/src/address_map.rs

@ -1,7 +1,6 @@
//! Data structures to provide transformation of the source
// addresses of a WebAssembly module into the native code.
use alloc::vec::Vec;
use cranelift_codegen::ir;
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;

3
crates/environ/src/cache.rs

@ -2,8 +2,6 @@ use crate::address_map::{ModuleAddressMap, ValueLabelsRanges};
use crate::compilation::{Compilation, Relocations, Traps};
use crate::module::Module;
use crate::module_environ::FunctionBodyData;
use alloc::string::{String, ToString};
use core::hash::Hasher;
use cranelift_codegen::{ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;
@ -12,6 +10,7 @@ use log::{debug, trace, warn};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::fs;
use std::hash::Hasher;
use std::io::Write;
use std::path::{Path, PathBuf};

4
crates/environ/src/cache/config.rs

@ -1,9 +1,6 @@
//! Module for configuring the cache system.
use super::worker;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::time::Duration;
use directories::ProjectDirs;
use lazy_static::lazy_static;
use log::{debug, error, trace, warn};
@ -17,6 +14,7 @@ use std::fs;
use std::mem;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Duration;
// wrapped, so we have named section in config,
// also, for possible future compatibility

2
crates/environ/src/cache/config/tests.rs

@ -1,7 +1,7 @@
use super::CacheConfig;
use core::time::Duration;
use std::fs;
use std::path::PathBuf;
use std::time::Duration;
use tempfile::{self, TempDir};
// note: config loading during validation creates cache directory to canonicalize its path,

4
crates/environ/src/cache/tests.rs

@ -3,15 +3,13 @@ use super::*;
use crate::address_map::{FunctionAddressMap, InstructionAddressMap};
use crate::compilation::{CompiledFunction, Relocation, RelocationTarget, TrapInformation};
use crate::module::{MemoryPlan, MemoryStyle, Module};
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::cmp::min;
use cranelift_codegen::{binemit, ir, isa, settings, ValueLocRange};
use cranelift_entity::EntityRef;
use cranelift_entity::{PrimaryMap, SecondaryMap};
use cranelift_wasm::{DefinedFuncIndex, FuncIndex, Global, GlobalInit, Memory, SignatureIndex};
use rand::rngs::SmallRng;
use rand::{Rng, SeedableRng};
use std::cmp::min;
use std::fs;
use std::str::FromStr;
use target_lexicon::triple;

7
crates/environ/src/cache/worker.rs

@ -6,12 +6,10 @@
//! Background tasks can be CPU intensive, but the worker thread has low priority.
use super::{cache_config, fs_write_atomic, CacheConfig};
use alloc::vec::Vec;
use core::cmp;
use core::time::Duration;
use log::{debug, info, trace, warn};
use serde::{Deserialize, Serialize};
use spin::Once;
use std::cmp;
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs;
@ -21,6 +19,7 @@ use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
#[cfg(test)]
use std::sync::{Arc, Condvar, Mutex};
use std::thread;
use std::time::Duration;
#[cfg(not(test))]
use std::time::SystemTime;
#[cfg(test)]
@ -234,7 +233,7 @@ impl WorkerThread {
#[cfg(target_os = "windows")]
fn lower_thread_priority() {
use core::convert::TryInto;
use std::convert::TryInto;
use winapi::um::processthreadsapi::{GetCurrentThread, SetThreadPriority};
use winapi::um::winbase::THREAD_MODE_BACKGROUND_BEGIN;

2
crates/environ/src/cache/worker/tests.rs

@ -1,7 +1,7 @@
use super::*;
use crate::cache::config::tests::test_prolog;
use core::iter::repeat;
use more_asserts::{assert_ge, assert_gt, assert_lt};
use std::iter::repeat;
use std::process;
// load_config! comes from crate::cache(::config::tests);

1
crates/environ/src/compilation.rs

@ -4,7 +4,6 @@
use crate::address_map::{ModuleAddressMap, ValueLabelsRanges};
use crate::module;
use crate::module_environ::FunctionBodyData;
use alloc::vec::Vec;
use cranelift_codegen::{binemit, ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::{DefinedFuncIndex, FuncIndex, ModuleTranslationState, WasmError};

1
crates/environ/src/cranelift.rs

@ -14,7 +14,6 @@ use crate::func_environ::{
};
use crate::module::Module;
use crate::module_environ::FunctionBodyData;
use alloc::vec::Vec;
use cranelift_codegen::binemit;
use cranelift_codegen::ir;
use cranelift_codegen::ir::ExternalName;

4
crates/environ/src/func_environ.rs

@ -1,9 +1,6 @@
use crate::module::{MemoryPlan, MemoryStyle, Module, TableStyle};
use crate::vmoffsets::VMOffsets;
use crate::WASM_PAGE_SIZE;
use alloc::vec::Vec;
use core::clone::Clone;
use core::convert::TryFrom;
use cranelift_codegen::cursor::FuncCursor;
use cranelift_codegen::ir;
use cranelift_codegen::ir::condcodes::*;
@ -18,6 +15,7 @@ use cranelift_wasm::{
};
#[cfg(feature = "lightbeam")]
use cranelift_wasm::{DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex};
use std::convert::TryFrom;
/// Compute an `ir::ExternalName` for a given wasm function index.
pub fn get_func_name(func_index: FuncIndex) -> ir::ExternalName {

3
crates/environ/src/lib.rs

@ -5,7 +5,6 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(
feature = "cargo-clippy",
@ -25,8 +24,6 @@
)
)]
extern crate alloc;
mod address_map;
mod compilation;
mod func_environ;

5
crates/environ/src/module.rs

@ -2,10 +2,6 @@
use crate::module_environ::FunctionBodyData;
use crate::tunables::Tunables;
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use core::hash::{Hash, Hasher};
use cranelift_codegen::ir;
use cranelift_entity::{EntityRef, PrimaryMap};
use cranelift_wasm::{
@ -14,6 +10,7 @@ use cranelift_wasm::{
};
use indexmap::IndexMap;
use more_asserts::assert_ge;
use std::hash::{Hash, Hasher};
/// A WebAssembly table initializer.
#[derive(Clone, Debug, Hash)]

5
crates/environ/src/module_environ.rs

@ -1,10 +1,6 @@
use crate::func_environ::FuncEnvironment;
use crate::module::{Export, MemoryPlan, Module, TableElements, TablePlan};
use crate::tunables::Tunables;
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use core::convert::TryFrom;
use cranelift_codegen::ir;
use cranelift_codegen::ir::{AbiParam, ArgumentPurpose};
use cranelift_codegen::isa::TargetFrontendConfig;
@ -13,6 +9,7 @@ use cranelift_wasm::{
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
ModuleTranslationState, SignatureIndex, Table, TableIndex, WasmResult,
};
use std::convert::TryFrom;
/// Contains function data: byte code and its offset in the module.
#[derive(Hash)]

2
crates/environ/src/vmoffsets.rs

@ -3,13 +3,13 @@
use crate::module::Module;
use crate::BuiltinFunctionIndex;
use core::convert::TryFrom;
use cranelift_codegen::ir;
use cranelift_wasm::{
DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex, GlobalIndex, MemoryIndex,
SignatureIndex, TableIndex,
};
use more_asserts::assert_lt;
use std::convert::TryFrom;
#[cfg(target_pointer_width = "32")]
fn cast_to_u32(sz: usize) -> u32 {

4
crates/interface-types/Cargo.toml

@ -17,8 +17,8 @@ walrus = "0.13"
wasmparser = { version = "0.39.2", default-features = false }
wasm-webidl-bindings = "0.6"
wasmtime = { path = '../api' }
wasmtime-jit = { path = '../jit', default-features = false }
wasmtime-runtime = { path = '../runtime', default-features = false }
wasmtime-jit = { path = '../jit' }
wasmtime-runtime = { path = '../runtime' }
wasmtime-wasi = { path = '../wasi' }
[badges]

9
crates/interface-types/src/lib.rs

@ -7,15 +7,10 @@
#![deny(missing_docs)]
extern crate alloc;
use alloc::boxed::Box;
use alloc::string::ToString;
use alloc::vec::Vec;
use anyhow::{bail, format_err, Result};
use core::convert::TryFrom;
use core::str;
use cranelift_codegen::ir;
use std::convert::TryFrom;
use std::str;
use wasm_webidl_bindings::ast;
use wasmtime_api as api;
use wasmtime_jit::RuntimeValue;

5
crates/interface-types/src/value.rs

@ -1,6 +1,5 @@
use alloc::string::{String, ToString};
use core::convert::TryFrom;
use core::fmt;
use std::convert::TryFrom;
use std::fmt;
/// The set of all possible WebAssembly Interface Types
#[derive(Debug, Clone)]

24
crates/jit/Cargo.toml

@ -15,13 +15,12 @@ cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
cranelift-frontend = "0.50.0"
wasmtime-environ = { path = "../environ", default-features = false }
wasmtime-runtime = { path = "../runtime", default-features = false }
wasmtime-debug = { path = "../debug", default-features = false }
wasmtime-environ = { path = "../environ" }
wasmtime-runtime = { path = "../runtime" }
wasmtime-debug = { path = "../debug" }
region = "2.0.0"
thiserror = "1.0.4"
target-lexicon = { version = "0.9.0", default-features = false }
hashbrown = { version = "0.6.0", optional = true }
wasmparser = { version = "0.39.2", default-features = false }
more-asserts = "0.2.1"
anyhow = "1.0"
@ -30,23 +29,6 @@ anyhow = "1.0"
winapi = { version = "0.3.7", features = ["winnt", "impl-default"] }
[features]
default = ["std"]
std = [
"cranelift-codegen/std",
"cranelift-wasm/std",
"wasmtime-environ/std",
"wasmtime-debug/std",
"wasmtime-runtime/std",
"wasmparser/std"
]
core = [
"hashbrown/nightly",
"cranelift-codegen/core",
"cranelift-wasm/core",
"wasmtime-environ/core",
"wasmtime-debug/core",
"wasmparser/core"
]
lightbeam = ["wasmtime-environ/lightbeam"]
[badges]

6
crates/jit/src/action.rs

@ -2,11 +2,9 @@
use crate::compiler::Compiler;
use crate::instantiate::SetupError;
use alloc::string::String;
use alloc::vec::Vec;
use core::cmp::max;
use core::{fmt, mem, ptr, slice};
use cranelift_codegen::ir;
use std::cmp::max;
use std::{fmt, mem, ptr, slice};
use thiserror::Error;
use wasmtime_runtime::{wasmtime_call_trampoline, Export, InstanceHandle, VMInvokeArgument};

5
crates/jit/src/code_memory.rs

@ -1,11 +1,8 @@
//! Memory management for executable code.
use crate::function_table::FunctionTable;
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use core::{cmp, mem};
use region;
use std::{cmp, mem};
use wasmtime_environ::{Compilation, CompiledFunction};
use wasmtime_runtime::{Mmap, VMFunctionBody};

9
crates/jit/src/compiler.rs

@ -1,13 +1,8 @@
//! JIT compilation.
use super::HashMap;
use crate::code_memory::CodeMemory;
use crate::instantiate::SetupError;
use crate::target_tunables::target_tunables;
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use core::convert::TryFrom;
use cranelift_codegen::ir::InstBuilder;
use cranelift_codegen::isa::{TargetFrontendConfig, TargetIsa};
use cranelift_codegen::print_errors::pretty_error;
@ -16,6 +11,8 @@ use cranelift_codegen::{binemit, ir};
use cranelift_entity::{EntityRef, PrimaryMap};
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
use cranelift_wasm::{DefinedFuncIndex, DefinedMemoryIndex, ModuleTranslationState};
use std::collections::HashMap;
use std::convert::TryFrom;
use wasmtime_debug::{emit_debugsections_image, DebugInfoData};
use wasmtime_environ::{
Compilation, CompileError, CompiledFunction, Compiler as _C, FunctionBodyData, Module,
@ -202,7 +199,7 @@ impl Compiler {
signature: &ir::Signature,
value_size: usize,
) -> Result<*const VMFunctionBody, SetupError> {
use super::hash_map::Entry::{Occupied, Vacant};
use std::collections::hash_map::Entry::{Occupied, Vacant};
Ok(match self.trampoline_park.entry(callee_address) {
Occupied(entry) => *entry.get(),
Vacant(entry) => {

8
crates/jit/src/context.rs

@ -1,14 +1,12 @@
use crate::action::{get, inspect_memory, invoke};
use crate::HashMap;
use crate::{
instantiate, ActionError, ActionOutcome, CompilationStrategy, CompiledModule, Compiler,
InstanceHandle, Namespace, RuntimeValue, SetupError,
};
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::string::{String, ToString};
use core::cell::RefCell;
use cranelift_codegen::isa::TargetIsa;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use thiserror::Error;
use wasmparser::{validate, OperatorValidatorConfig, ValidatingParserConfig};

11
crates/jit/src/instantiate.rs

@ -3,19 +3,15 @@
//! `CompiledModule` to allow compiling and instantiating to be done as separate
//! steps.
use super::HashMap;
use crate::compiler::Compiler;
use crate::link::link_module;
use crate::resolver::Resolver;
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::string::String;
use alloc::vec::Vec;
use core::cell::RefCell;
use cranelift_entity::{BoxedSlice, PrimaryMap};
use cranelift_wasm::{DefinedFuncIndex, SignatureIndex};
#[cfg(feature = "std")]
use std::cell::RefCell;
use std::collections::HashMap;
use std::io::Write;
use std::rc::Rc;
use thiserror::Error;
use wasmtime_debug::read_debuginfo;
use wasmtime_environ::{
@ -120,7 +116,6 @@ impl<'data> RawCompiledModule<'data> {
// Make all code compiled thus far executable.
compiler.publish_compiled_code();
#[cfg(feature = "std")]
let dbg_jit_registration = if let Some(img) = dbg_image {
let mut bytes = Vec::new();
bytes.write_all(&img).expect("all written");

8
crates/jit/src/lib.rs

@ -2,7 +2,6 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(
feature = "cargo-clippy",
@ -22,13 +21,6 @@
)
)]
extern crate alloc;
#[cfg(not(feature = "std"))]
use hashbrown::{hash_map, HashMap, HashSet};
#[cfg(feature = "std")]
use std::collections::{hash_map, HashMap, HashSet};
mod action;
mod code_memory;
mod compiler;

5
crates/jit/src/link.rs

@ -1,14 +1,13 @@
//! Linking for JIT-compiled code.
use crate::resolver::Resolver;
use crate::HashSet;
use alloc::vec::Vec;
use core::ptr::write_unaligned;
use cranelift_codegen::binemit::Reloc;
use cranelift_codegen::ir::JumpTableOffsets;
use cranelift_entity::PrimaryMap;
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
use more_asserts::assert_ge;
use std::collections::HashSet;
use std::ptr::write_unaligned;
use wasmtime_environ::{
MemoryPlan, MemoryStyle, Module, Relocation, RelocationTarget, Relocations, TablePlan,
};

3
crates/jit/src/namespace.rs

@ -2,9 +2,8 @@
//! to exports. This file provides one possible way to manage multiple instances
//! and resolve imports to exports among them.
use super::HashMap;
use crate::resolver::Resolver;
use alloc::string::String;
use std::collections::HashMap;
use wasmtime_runtime::{Export, InstanceHandle};
/// A namespace containing instances keyed by name.

2
crates/jit/src/target_tunables.rs

@ -1,4 +1,4 @@
use core::cmp::min;
use std::cmp::min;
use target_lexicon::{OperatingSystem, Triple};
use wasmtime_environ::Tunables;

2
crates/lightbeam/src/function_body.rs

@ -5,13 +5,13 @@ use crate::backend::{
use crate::error::Error;
use crate::microwasm::*;
use crate::module::{ModuleContext, SigType, Signature};
use core::{fmt, mem};
use cranelift_codegen::binemit;
use dynasmrt::DynasmApi;
use either::{Either, Left, Right};
use more_asserts::assert_ge;
use multi_mut::HashMapMultiMut;
use std::{collections::HashMap, hash::Hash};
use std::{fmt, mem};
#[derive(Debug)]
struct Block {

4
crates/lightbeam/src/module.rs

@ -2,13 +2,13 @@ use crate::backend::TranslatedCodeSection;
use crate::error::Error;
use crate::microwasm;
use crate::translate_sections;
use core::{convert::TryInto, mem};
use cranelift_codegen::{
ir::{self, AbiParam, Signature as CraneliftSignature},
isa,
};
use memoffset::offset_of;
use more_asserts::assert_le;
use std::{convert::TryInto, mem};
use thiserror::Error;
use wasmparser::{FuncType, MemoryType, ModuleReader, SectionCode, Type};
@ -167,7 +167,7 @@ impl ExecutableModule {
self.context
.as_ref()
.map(|ctx| (&**ctx) as *const VmCtx as *const u8)
.unwrap_or(core::ptr::null()),
.unwrap_or(std::ptr::null()),
)
}

4
crates/misc/py/src/function.rs

@ -1,12 +1,10 @@
//! Support for a calling of a bounds (exported) function.
extern crate alloc;
use crate::value::{pyobj_to_value, value_to_pyobj};
use alloc::rc::Rc;
use pyo3::exceptions::Exception;
use pyo3::prelude::*;
use pyo3::types::{PyAny, PyDict, PyTuple};
use std::rc::Rc;
use wasmtime_api as api;
use wasmtime_interface_types::ModuleData;

4
crates/misc/py/src/instance.rs

@ -1,12 +1,10 @@
//! WebAssembly Instance API object.
extern crate alloc;
use crate::function::Function;
use crate::memory::Memory;
use alloc::rc::Rc;
use pyo3::prelude::*;
use pyo3::types::PyDict;
use std::rc::Rc;
use wasmtime_api as api;
use wasmtime_interface_types::ModuleData;

4
crates/misc/py/src/memory.rs

@ -1,14 +1,12 @@
//! WebAssembly Memory API object.
extern crate alloc;
use core::ptr;
use pyo3::class::PyBufferProtocol;
use pyo3::exceptions::BufferError;
use pyo3::ffi;
use pyo3::prelude::*;
use std::ffi::CStr;
use std::os::raw::{c_int, c_void};
use std::ptr;
use wasmtime_api as api;
#[pyclass]

2
crates/misc/py/src/module.rs

@ -1,7 +1,5 @@
//! WebAssembly Module API object.
extern crate alloc;
use pyo3::prelude::*;
use wasmtime_api as api;

6
crates/obj/src/context.rs

@ -1,14 +1,12 @@
#![allow(clippy::cast_ptr_alignment)]
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::ptr;
use cranelift_codegen::isa::TargetFrontendConfig;
use cranelift_entity::EntityRef;
use cranelift_wasm::GlobalInit;
use more_asserts::assert_le;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::ptr;
use wasmtime_environ::{Module, TargetSharedSignatureIndex, VMOffsets};
pub struct TableRelocation {
@ -32,7 +30,7 @@ pub fn layout_vmcontext(
let target_index = match signature_registry.entry(sig) {
Entry::Occupied(o) => *o.get(),
Entry::Vacant(v) => {
assert_le!(signature_registry_len, ::core::u32::MAX as usize);
assert_le!(signature_registry_len, std::u32::MAX as usize);
let id = TargetSharedSignatureIndex::new(signature_registry_len as u32);
signature_registry_len += 1;
*v.insert(id)

2
crates/obj/src/data_segment.rs

@ -1,5 +1,3 @@
use alloc::string::String;
use alloc::vec::Vec;
use faerie::{Artifact, Decl};
use wasmtime_environ::DataInitializer;

1
crates/obj/src/function.rs

@ -1,4 +1,3 @@
use alloc::string::String;
use cranelift_codegen::settings;
use cranelift_codegen::settings::Configurable;
use cranelift_entity::EntityRef;

2
crates/obj/src/lib.rs

@ -26,8 +26,6 @@
)
)]
extern crate alloc;
mod context;
mod data_segment;
mod function;

1
crates/obj/src/module.rs

@ -2,7 +2,6 @@ use crate::context::layout_vmcontext;
use crate::data_segment::{declare_data_segment, emit_data_segment};
use crate::function::{declare_functions, emit_functions};
use crate::table::{declare_table, emit_table};
use alloc::string::String;
use cranelift_codegen::isa::TargetFrontendConfig;
use faerie::{Artifact, Decl, Link};
use wasmtime_environ::{Compilation, DataInitializer, Module, Relocations};

2
crates/obj/src/table.rs

@ -1,5 +1,3 @@
use alloc::string::String;
use alloc::vec::Vec;
use faerie::{Artifact, Decl};
/// Declares data segment symbol

15
crates/runtime/Cargo.toml

@ -14,14 +14,12 @@ edition = "2018"
cranelift-codegen = { version = "0.50.0", features = ["enable-serde"] }
cranelift-entity = { version = "0.50.0", features = ["enable-serde"] }
cranelift-wasm = { version = "0.50.0", features = ["enable-serde"] }
wasmtime-environ = { path = "../environ", default-features = false }
wasmtime-environ = { path = "../environ" }
region = "2.0.0"
lazy_static = "1.2.0"
libc = { version = "0.2.60", default-features = false }
memoffset = "0.5.3"
indexmap = "1.0.2"
hashbrown = { version = "0.6.0", optional = true }
spin = { version = "0.5.2", optional = true }
thiserror = "1.0.4"
more-asserts = "0.2.1"
@ -31,16 +29,5 @@ winapi = { version = "0.3.7", features = ["winbase", "memoryapi"] }
[build-dependencies]
cc = "1.0"
[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",
"spin"
]
[badges]
maintenance = { status = "actively-developed" }

2
crates/runtime/src/imports.rs

@ -1,8 +1,8 @@
use crate::instance::InstanceHandle;
use crate::vmcontext::{VMFunctionImport, VMGlobalImport, VMMemoryImport, VMTableImport};
use crate::HashSet;
use cranelift_entity::{BoxedSlice, PrimaryMap};
use cranelift_wasm::{FuncIndex, GlobalIndex, MemoryIndex, TableIndex};
use std::collections::HashSet;
/// Resolved import pointers.
#[derive(Clone)]

31
crates/runtime/src/instance.rs

@ -15,16 +15,6 @@ use crate::vmcontext::{
VMGlobalDefinition, VMGlobalImport, VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex,
VMTableDefinition, VMTableImport,
};
use crate::{HashMap, HashSet};
use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::string::{String, ToString};
use core::any::Any;
use core::borrow::Borrow;
use core::cell::RefCell;
use core::convert::TryFrom;
use core::{mem, ptr, slice};
use cranelift_entity::{BoxedSlice, EntityRef, PrimaryMap};
use cranelift_wasm::{
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex,
@ -32,6 +22,13 @@ use cranelift_wasm::{
};
use memoffset::offset_of;
use more_asserts::assert_lt;
use std::any::Any;
use std::borrow::Borrow;
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::rc::Rc;
use std::{mem, ptr, slice};
use thiserror::Error;
use wasmtime_environ::{DataInitializer, Module, TableElements, VMOffsets};
@ -613,10 +610,8 @@ impl Instance {
}
pub(crate) fn lookup_global_export(&self, field: &str) -> Option<Export> {
let cell: &RefCell<HashMap<alloc::string::String, core::option::Option<Export>>> =
self.global_exports.borrow();
let map: &mut HashMap<alloc::string::String, core::option::Option<Export>> =
&mut cell.borrow_mut();
let cell: &RefCell<HashMap<String, Option<Export>>> = self.global_exports.borrow();
let map: &mut HashMap<String, Option<Export>> = &mut cell.borrow_mut();
if let Some(Some(export)) = map.get(field) {
return Some(export.clone());
}
@ -790,11 +785,9 @@ impl InstanceHandle {
// Collect the exports for the global export map.
for (field, decl) in &instance.module.exports {
use crate::hash_map::Entry::*;
let cell: &RefCell<HashMap<alloc::string::String, core::option::Option<Export>>> =
instance.global_exports.borrow();
let map: &mut HashMap<alloc::string::String, core::option::Option<Export>> =
&mut cell.borrow_mut();
use std::collections::hash_map::Entry::*;
let cell: &RefCell<HashMap<String, Option<Export>>> = instance.global_exports.borrow();
let map: &mut HashMap<String, Option<Export>> = &mut cell.borrow_mut();
match map.entry(field.to_string()) {
Vacant(entry) => {
entry.insert(Some(lookup_by_declaration(

6
crates/runtime/src/jit_int.rs

@ -2,9 +2,7 @@
//! the __jit_debug_register_code() and __jit_debug_descriptor to register
//! or unregister generated object images with debuggers.
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::ptr;
use std::ptr;
#[repr(C)]
struct JITCodeEntry {
@ -41,7 +39,7 @@ extern "C" fn __jit_debug_register_code() {
// Hack to not allow inlining even when Rust wants to do it in release mode.
let x = 3;
unsafe {
core::ptr::read_volatile(&x);
std::ptr::read_volatile(&x);
}
}

14
crates/runtime/src/lib.rs

@ -3,7 +3,6 @@
#![allow(improper_ctypes)]
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(
feature = "cargo-clippy",
@ -22,9 +21,6 @@
clippy::use_self
)
)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
mod export;
mod imports;
@ -56,15 +52,5 @@ pub use crate::vmcontext::{
VMTableDefinition, VMTableImport,
};
#[cfg(not(feature = "std"))]
use hashbrown::{hash_map, HashMap, HashSet};
#[cfg(feature = "std")]
use std::collections::{hash_map, HashMap, HashSet};
#[cfg(not(feature = "std"))]
use spin::{RwLock, RwLockReadGuard, RwLockWriteGuard};
#[cfg(feature = "std")]
use std::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
/// Version number of this crate.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

3
crates/runtime/src/memory.rs

@ -4,9 +4,8 @@
use crate::mmap::Mmap;
use crate::vmcontext::VMMemoryDefinition;
use alloc::string::String;
use core::convert::TryFrom;
use more_asserts::{assert_ge, assert_le};
use std::convert::TryFrom;
use wasmtime_environ::{MemoryPlan, MemoryStyle, WASM_MAX_PAGES, WASM_PAGE_SIZE};
/// A linear memory instance.

6
crates/runtime/src/mmap.rs

@ -1,16 +1,14 @@
//! Low-level abstraction for allocating and managing zero-filled pages
//! of memory.
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::ptr;
use core::slice;
#[cfg(not(target_os = "windows"))]
use libc;
use more_asserts::assert_le;
use more_asserts::assert_lt;
use region;
use std::io;
use std::ptr;
use std::slice;
/// Round `size` up to the nearest multiple of `page_size`.
fn round_up_to_page_size(size: usize, page_size: usize) -> usize {

10
crates/runtime/src/sig_registry.rs

@ -2,10 +2,10 @@
//! signature checking.
use crate::vmcontext::VMSharedSignatureIndex;
use crate::{hash_map, HashMap};
use core::convert::TryFrom;
use cranelift_codegen::ir;
use more_asserts::{assert_lt, debug_assert_lt};
use std::collections::{hash_map, HashMap};
use std::convert::TryFrom;
/// WebAssembly requires that the caller and callee signatures in an indirect
/// call must match. To implement this efficiently, keep a registry of all
@ -30,12 +30,12 @@ impl SignatureRegistry {
match self.signature_hash.entry(sig.clone()) {
hash_map::Entry::Occupied(entry) => *entry.get(),
hash_map::Entry::Vacant(entry) => {
// Keep `signature_hash` len under 2**32 -- VMSharedSignatureIndex::new(core::u32::MAX)
// Keep `signature_hash` len under 2**32 -- VMSharedSignatureIndex::new(std::u32::MAX)
// is reserved for VMSharedSignatureIndex::default().
debug_assert_lt!(
len,
core::u32::MAX as usize,
"Invariant check: signature_hash.len() < core::u32::MAX"
std::u32::MAX as usize,
"Invariant check: signature_hash.len() < std::u32::MAX"
);
let sig_id = VMSharedSignatureIndex::new(u32::try_from(len).unwrap());
entry.insert(sig_id);

6
crates/runtime/src/signalhandlers.rs

@ -5,10 +5,10 @@
#![allow(non_snake_case)]
use crate::vmcontext::VMContext;
use crate::RwLock;
use core::borrow::{Borrow, BorrowMut};
use core::cell::Cell;
use lazy_static::lazy_static;
use std::borrow::{Borrow, BorrowMut};
use std::cell::Cell;
use std::sync::RwLock;
#[derive(Default)]
struct TrapContext {

3
crates/runtime/src/table.rs

@ -3,9 +3,8 @@
//! `Table` is to WebAssembly tables what `LinearMemory` is to WebAssembly linear memories.
use crate::vmcontext::{VMCallerCheckedAnyfunc, VMTableDefinition};
use alloc::vec::Vec;
use core::convert::{TryFrom, TryInto};
use cranelift_wasm::TableElementType;
use std::convert::{TryFrom, TryInto};
use wasmtime_environ::{TablePlan, TableStyle};
/// A table instance.

4
crates/runtime/src/trap_registry.rs

@ -1,7 +1,7 @@
use crate::HashMap;
use crate::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use cranelift_codegen::ir;
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
lazy_static! {
static ref REGISTRY: RwLock<TrapRegistry> = RwLock::new(TrapRegistry::default());

5
crates/runtime/src/traphandlers.rs

@ -4,10 +4,9 @@
use crate::trap_registry::get_trap_registry;
use crate::trap_registry::TrapDescription;
use crate::vmcontext::{VMContext, VMFunctionBody};
use alloc::string::{String, ToString};
use core::cell::Cell;
use core::ptr;
use cranelift_codegen::ir;
use std::cell::Cell;
use std::ptr;
extern "C" {
fn WasmtimeCallTrampoline(

26
crates/runtime/src/vmcontext.rs

@ -2,8 +2,8 @@
//! fields that compiled wasm code accesses directly.
use crate::instance::Instance;
use core::any::Any;
use core::{ptr, u32};
use std::any::Any;
use std::{ptr, u32};
use wasmtime_environ::BuiltinFunctionIndex;
/// An imported function.
@ -20,8 +20,8 @@ pub struct VMFunctionImport {
#[cfg(test)]
mod test_vmfunction_import {
use super::VMFunctionImport;
use core::mem::size_of;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -53,7 +53,7 @@ pub struct VMFunctionBody(u8);
#[cfg(test)]
mod test_vmfunction_body {
use super::VMFunctionBody;
use core::mem::size_of;
use std::mem::size_of;
#[test]
fn check_vmfunction_body_offsets() {
@ -76,8 +76,8 @@ pub struct VMTableImport {
#[cfg(test)]
mod test_vmtable_import {
use super::VMTableImport;
use core::mem::size_of;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -114,8 +114,8 @@ pub struct VMMemoryImport {
#[cfg(test)]
mod test_vmmemory_import {
use super::VMMemoryImport;
use core::mem::size_of;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -149,8 +149,8 @@ pub struct VMGlobalImport {
#[cfg(test)]
mod test_vmglobal_import {
use super::VMGlobalImport;
use core::mem::size_of;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -184,8 +184,8 @@ pub struct VMMemoryDefinition {
#[cfg(test)]
mod test_vmmemory_definition {
use super::VMMemoryDefinition;
use core::mem::size_of;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -228,8 +228,8 @@ pub struct VMTableDefinition {
#[cfg(test)]
mod test_vmtable_definition {
use super::VMTableDefinition;
use core::mem::size_of;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -265,8 +265,8 @@ pub struct VMGlobalDefinition {
#[cfg(test)]
mod test_vmglobal_definition {
use super::VMGlobalDefinition;
use core::mem::{align_of, size_of};
use more_asserts::assert_ge;
use std::mem::{align_of, size_of};
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -432,7 +432,7 @@ pub struct VMSharedSignatureIndex(u32);
#[cfg(test)]
mod test_vmshared_signature_index {
use super::VMSharedSignatureIndex;
use core::mem::size_of;
use std::mem::size_of;
use wasmtime_environ::{Module, TargetSharedSignatureIndex, VMOffsets};
#[test]
@ -485,8 +485,8 @@ pub struct VMCallerCheckedAnyfunc {
#[cfg(test)]
mod test_vmcaller_checked_anyfunc {
use super::VMCallerCheckedAnyfunc;
use core::mem::size_of;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
#[test]
@ -559,7 +559,7 @@ pub struct VMInvokeArgument([u8; 16]);
#[cfg(test)]
mod test_vm_invoke_argument {
use super::VMInvokeArgument;
use core::mem::{align_of, size_of};
use std::mem::{align_of, size_of};
use wasmtime_environ::{Module, VMOffsets};
#[test]

4
crates/wasi-c/src/instantiate.rs

@ -3,17 +3,17 @@ use crate::host::{
fd_table, fd_table_init, fd_table_insert_existing,
};
use crate::syscalls;
use alloc::rc::Rc;
use core::cell::RefCell;
use cranelift_codegen::ir::types;
use cranelift_codegen::{ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;
use std::cell::RefCell;
use std::collections::HashMap;
use std::ffi::CString;
use std::fs::File;
use std::mem;
use std::os::unix::io::AsRawFd;
use std::rc::Rc;
use target_lexicon::HOST;
use wasmtime_environ::{translate_signature, Export, Module};
use wasmtime_runtime::{Imports, InstanceHandle, InstantiationError, VMFunctionBody};

3
crates/wasi-c/src/lib.rs

@ -1,6 +1,3 @@
extern crate alloc;
extern crate core;
mod host;
mod instantiate;
mod syscalls;

2
crates/wasi-c/src/syscalls.rs

@ -2,9 +2,9 @@ use crate::host::{argv_environ_values, fd_prestats, fd_table};
use crate::instantiate::WASIState;
use crate::translate::*;
use crate::{host, wasm32};
use core::convert::TryFrom;
use cranelift_codegen::ir::types::{Type, I32, I64};
use log::{log_enabled, trace};
use std::convert::TryFrom;
use std::{mem, ptr, slice, str};
use wasmtime_runtime::VMContext;

2
crates/wasi-c/src/translate.rs

@ -1,7 +1,7 @@
use crate::{host, wasm32};
use core::convert::TryFrom;
use log::{debug, error};
use more_asserts::assert_le;
use std::convert::TryFrom;
use std::mem::{align_of, size_of, zeroed};
use std::slice;
use wasmtime_runtime::{Export, VMContext};

111
crates/wasi-c/src/wasm32.rs

@ -108,7 +108,7 @@ fn bindgen_test_layout_fsid_t() {
concat!("Alignment of ", stringify!(fsid_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<fsid_t>())).__val as *const _ as usize },
unsafe { &(*(std::ptr::null::<fsid_t>())).__val as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -167,7 +167,7 @@ fn bindgen_test_layout_wasi_dirent_t() {
concat!("Size of: ", stringify!(__wasi_dirent_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_dirent_t>())).d_next as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_dirent_t>())).d_next as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -177,7 +177,7 @@ fn bindgen_test_layout_wasi_dirent_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_dirent_t>())).d_ino as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_dirent_t>())).d_ino as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
@ -187,7 +187,7 @@ fn bindgen_test_layout_wasi_dirent_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_dirent_t>())).d_namlen as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_dirent_t>())).d_namlen as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
@ -197,7 +197,7 @@ fn bindgen_test_layout_wasi_dirent_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_dirent_t>())).d_type as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_dirent_t>())).d_type as *const _ as usize },
20usize,
concat!(
"Offset of field: ",
@ -249,7 +249,7 @@ fn bindgen_test_layout___wasi_event_t___wasi_event_u___wasi_event_u_fd_readwrite
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t___wasi_event_u___wasi_event_u_fd_readwrite_t>()))
&(*(std::ptr::null::<__wasi_event_t___wasi_event_u___wasi_event_u_fd_readwrite_t>()))
.nbytes as *const _ as usize
},
0usize,
@ -262,7 +262,7 @@ fn bindgen_test_layout___wasi_event_t___wasi_event_u___wasi_event_u_fd_readwrite
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t___wasi_event_u___wasi_event_u_fd_readwrite_t>()))
&(*(std::ptr::null::<__wasi_event_t___wasi_event_u___wasi_event_u_fd_readwrite_t>()))
.flags as *const _ as usize
},
8usize,
@ -288,7 +288,7 @@ fn bindgen_test_layout___wasi_event_t___wasi_event_u() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t___wasi_event_u>())).fd_readwrite as *const _
&(*(std::ptr::null::<__wasi_event_t___wasi_event_u>())).fd_readwrite as *const _
as usize
},
0usize,
@ -313,7 +313,7 @@ fn bindgen_test_layout___wasi_event_t() {
concat!("Alignment of ", stringify!(__wasi_event_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_event_t>())).userdata as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_event_t>())).userdata as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -323,7 +323,7 @@ fn bindgen_test_layout___wasi_event_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_event_t>())).error as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_event_t>())).error as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
@ -333,7 +333,7 @@ fn bindgen_test_layout___wasi_event_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_event_t>())).type_ as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_event_t>())).type_ as *const _ as usize },
10usize,
concat!(
"Offset of field: ",
@ -343,7 +343,7 @@ fn bindgen_test_layout___wasi_event_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_event_t>())).u as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_event_t>())).u as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
@ -389,7 +389,7 @@ fn bindgen_test_layout___wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t(
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t>()))
&(*(std::ptr::null::<__wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t>()))
.pr_name_len as *const _ as usize
},
0usize,
@ -418,7 +418,7 @@ fn bindgen_test_layout___wasi_prestat_t___wasi_prestat_u() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_prestat_t___wasi_prestat_u>())).dir as *const _ as usize
&(*(std::ptr::null::<__wasi_prestat_t___wasi_prestat_u>())).dir as *const _ as usize
},
0usize,
concat!(
@ -442,7 +442,7 @@ fn bindgen_test_layout___wasi_prestat_t() {
concat!("Alignment of ", stringify!(__wasi_prestat_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_prestat_t>())).pr_type as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_prestat_t>())).pr_type as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -452,7 +452,7 @@ fn bindgen_test_layout___wasi_prestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_prestat_t>())).u as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_prestat_t>())).u as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
@ -489,8 +489,8 @@ fn bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_1() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_1>())).nbytes
as *const _ as usize
&(*(std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_1>())).nbytes as *const _
as usize
},
0usize,
concat!(
@ -502,8 +502,8 @@ fn bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_1() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_1>())).flags
as *const _ as usize
&(*(std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_1>())).flags as *const _
as usize
},
8usize,
concat!(
@ -541,8 +541,8 @@ fn bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_2() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>())).signal
as *const _ as usize
&(*(std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>())).signal as *const _
as usize
},
0usize,
concat!(
@ -554,7 +554,7 @@ fn bindgen_test_layout_wasi_event_t__bindgen_ty_1__bindgen_ty_2() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>())).exitcode
&(*(std::ptr::null::<__wasi_event_t__bindgen_ty_1__bindgen_ty_2>())).exitcode
as *const _ as usize
},
4usize,
@ -576,8 +576,7 @@ fn bindgen_test_layout_wasi_event_t__bindgen_ty_1() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_event_t__bindgen_ty_1>())).fd_readwrite as *const _
as usize
&(*(std::ptr::null::<__wasi_event_t__bindgen_ty_1>())).fd_readwrite as *const _ as usize
},
0usize,
concat!(
@ -596,7 +595,7 @@ fn bindgen_test_layout_wasi_event_t() {
concat!("Size of: ", stringify!(__wasi_event_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_event_t>())).userdata as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_event_t>())).userdata as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -606,7 +605,7 @@ fn bindgen_test_layout_wasi_event_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_event_t>())).error as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_event_t>())).error as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
@ -616,7 +615,7 @@ fn bindgen_test_layout_wasi_event_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_event_t>())).type_ as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_event_t>())).type_ as *const _ as usize },
10usize,
concat!(
"Offset of field: ",
@ -643,7 +642,7 @@ fn bindgen_test_layout_wasi_fdstat_t() {
concat!("Size of: ", stringify!(__wasi_fdstat_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_fdstat_t>())).fs_filetype as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_fdstat_t>())).fs_filetype as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -653,7 +652,7 @@ fn bindgen_test_layout_wasi_fdstat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_fdstat_t>())).fs_flags as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_fdstat_t>())).fs_flags as *const _ as usize },
2usize,
concat!(
"Offset of field: ",
@ -663,7 +662,7 @@ fn bindgen_test_layout_wasi_fdstat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_fdstat_t>())).fs_rights_base as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_fdstat_t>())).fs_rights_base as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
@ -674,7 +673,7 @@ fn bindgen_test_layout_wasi_fdstat_t() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_fdstat_t>())).fs_rights_inheriting as *const _ as usize
&(*(std::ptr::null::<__wasi_fdstat_t>())).fs_rights_inheriting as *const _ as usize
},
16usize,
concat!(
@ -705,7 +704,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
concat!("Size of: ", stringify!(__wasi_filestat_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_dev as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_dev as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -715,7 +714,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_ino as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_ino as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
@ -725,7 +724,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_filetype as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_filetype as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
@ -735,7 +734,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_nlink as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_nlink as *const _ as usize },
20usize,
concat!(
"Offset of field: ",
@ -745,7 +744,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_size as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_size as *const _ as usize },
24usize,
concat!(
"Offset of field: ",
@ -755,7 +754,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_atim as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_atim as *const _ as usize },
32usize,
concat!(
"Offset of field: ",
@ -765,7 +764,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_mtim as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_mtim as *const _ as usize },
40usize,
concat!(
"Offset of field: ",
@ -775,7 +774,7 @@ fn bindgen_test_layout_wasi_filestat_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_filestat_t>())).st_ctim as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_filestat_t>())).st_ctim as *const _ as usize },
48usize,
concat!(
"Offset of field: ",
@ -804,7 +803,7 @@ fn bindgen_test_layout_wasi_ciovec_t() {
concat!("Alignment of ", stringify!(__wasi_ciovec_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_ciovec_t>())).buf as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_ciovec_t>())).buf as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -814,7 +813,7 @@ fn bindgen_test_layout_wasi_ciovec_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_ciovec_t>())).buf_len as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_ciovec_t>())).buf_len as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
@ -843,7 +842,7 @@ fn bindgen_test_layout_wasi_iovec_t() {
concat!("Alignment of ", stringify!(__wasi_iovec_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_iovec_t>())).buf as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_iovec_t>())).buf as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -853,7 +852,7 @@ fn bindgen_test_layout_wasi_iovec_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_iovec_t>())).buf_len as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_iovec_t>())).buf_len as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
@ -914,7 +913,7 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u___wasi_subscr
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<
&(*(std::ptr::null::<
__wasi_subscription_t___wasi_subscription_u___wasi_subscription_u_clock_t,
>()))
.identifier as *const _ as usize
@ -929,7 +928,7 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u___wasi_subscr
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<
&(*(std::ptr::null::<
__wasi_subscription_t___wasi_subscription_u___wasi_subscription_u_clock_t,
>()))
.clock_id as *const _ as usize
@ -944,7 +943,7 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u___wasi_subscr
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<
&(*(std::ptr::null::<
__wasi_subscription_t___wasi_subscription_u___wasi_subscription_u_clock_t,
>()))
.timeout as *const _ as usize
@ -959,7 +958,7 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u___wasi_subscr
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<
&(*(std::ptr::null::<
__wasi_subscription_t___wasi_subscription_u___wasi_subscription_u_clock_t,
>()))
.precision as *const _ as usize
@ -974,7 +973,7 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u___wasi_subscr
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<
&(*(std::ptr::null::<
__wasi_subscription_t___wasi_subscription_u___wasi_subscription_u_clock_t,
>()))
.flags as *const _ as usize
@ -1022,7 +1021,7 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u___wasi_subscr
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<
&(*(std::ptr::null::<
__wasi_subscription_t___wasi_subscription_u___wasi_subscription_u_fd_readwrite_t,
>()))
.fd as *const _ as usize
@ -1058,8 +1057,8 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_subscription_t___wasi_subscription_u>())).clock
as *const _ as usize
&(*(std::ptr::null::<__wasi_subscription_t___wasi_subscription_u>())).clock as *const _
as usize
},
0usize,
concat!(
@ -1071,7 +1070,7 @@ fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u() {
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<__wasi_subscription_t___wasi_subscription_u>())).fd_readwrite
&(*(std::ptr::null::<__wasi_subscription_t___wasi_subscription_u>())).fd_readwrite
as *const _ as usize
},
0usize,
@ -1096,7 +1095,7 @@ fn bindgen_test_layout___wasi_subscription_t() {
concat!("Alignment of ", stringify!(__wasi_subscription_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_subscription_t>())).userdata as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_subscription_t>())).userdata as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
@ -1106,7 +1105,7 @@ fn bindgen_test_layout___wasi_subscription_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_subscription_t>())).type_ as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_subscription_t>())).type_ as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
@ -1116,7 +1115,7 @@ fn bindgen_test_layout___wasi_subscription_t() {
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<__wasi_subscription_t>())).u as *const _ as usize },
unsafe { &(*(std::ptr::null::<__wasi_subscription_t>())).u as *const _ as usize },
16usize,
concat!(
"Offset of field: ",

4
crates/wasi/src/instantiate.rs

@ -1,12 +1,12 @@
use super::syscalls;
use alloc::rc::Rc;
use core::cell::RefCell;
use cranelift_codegen::ir::types;
use cranelift_codegen::{ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;
use std::cell::RefCell;
use std::collections::HashMap;
use std::fs::File;
use std::rc::Rc;
use target_lexicon::HOST;
use wasi_common::{WasiCtx, WasiCtxBuilder};
use wasmtime_api as api;

2
crates/wasi/src/lib.rs

@ -1,7 +1,5 @@
#![allow(improper_ctypes)]
extern crate alloc;
mod instantiate;
mod syscalls;

2
crates/wast/src/lib.rs

@ -22,8 +22,6 @@
)
)]
extern crate alloc;
mod spectest;
mod wast;

4
crates/wast/src/spectest.rs

@ -1,12 +1,12 @@
#![allow(improper_ctypes)]
use alloc::rc::Rc;
use core::cell::RefCell;
use cranelift_codegen::ir::types;
use cranelift_codegen::{ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
use std::cell::RefCell;
use std::collections::hash_map::HashMap;
use std::rc::Rc;
use target_lexicon::HOST;
use wasmtime_environ::{translate_signature, Export, MemoryPlan, Module, TablePlan};
use wasmtime_jit::target_tunables;

42
docs/stability-platform-support.md

@ -1,3 +1,43 @@
# Platform Support
... more coming soon
The `wasmtime` project is a configurable and lightweight runtime for WebAssembly
which has a number of ways it can be configured. Not all features are supported
on all platforms, but it is intended that `wasmtime` can run in some capacity on
almost all platforms! The matrix of what's being tested, what works, and what's
supported where is evolving over time, and this document hopes to capture a
snapshot of what the current state of the world looks like.
All features of `wasmtime` should work on the following platforms:
* Linux x86\_64
* macOS x86\_64
* Windows x86\_64
For more detailed information about supported platforms, please check out the
sections below!
## JIT compiler support
The JIT compiler, backed by either `lightbeam` or `cranelift` supports only the
x86\_64 architecture at this time. Support for at least ARM, AArch64, and x86 is
planned at this time.
Usage of the JIT compiler will require a host operating system which supports
creating executable memory pages on-the-fly. In Rust terms this generally means
that `std` needs to be supported on this platform.
## Interpreter support
At this time `wasmtime` does not have a mode in which it simply interprets
WebAssembly code. It is planned to add support for an interpreter, however, and
this will have minimal system dependencies. It is planned that the system will
need to support some form of dynamic memory allocation, but other than that not
much else will be needed.
## What about `#[no_std]`?
The `wasmtime` project does not currently use `#[no_std]` for its crates, but
this is not because it won't support it! At this time we're still gathering use
cases for for what `#[no_std]` might entail, so if you're interested in this
we'd love to hear about your use case! Feel free to open an issue on the
`wasmtime` repository to discuss this.

6
fuzz/fuzz_targets/compile.rs

@ -1,14 +1,12 @@
#![no_main]
extern crate alloc;
extern crate core;
extern crate libfuzzer_sys;
use alloc::rc::Rc;
use core::cell::RefCell;
use cranelift_codegen::settings;
use libfuzzer_sys::fuzz_target;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use wasmparser::validate;
use wasmtime_jit::{CompilationStrategy, CompiledModule, Compiler, NullResolver};

6
tests/instantiate.rs

@ -1,12 +1,10 @@
extern crate alloc;
use alloc::rc::Rc;
use core::cell::RefCell;
use cranelift_codegen::settings;
use cranelift_codegen::settings::Configurable;
use more_asserts::assert_gt;
use std::cell::RefCell;
use std::collections::HashMap;
use std::path::PathBuf;
use std::rc::Rc;
use wasmtime_jit::{instantiate, CompilationStrategy, Compiler, NullResolver};
const PATH_MODULE_RS2WASM_ADD_FUNC: &str = r"tests/wat/rs2wasm-add-func.wat";

Loading…
Cancel
Save