Skip to main content

dusk_wasmtime_environ/
lib.rs

1//! Standalone environment for WebAssembly using Cranelift. Provides functions to translate
2//! `get_global`, `set_global`, `memory.size`, `memory.grow`, `call_indirect` that hardcode in
3//! the translation the base addresses of regions of memory that will hold the globals, tables and
4//! linear memories.
5
6#![deny(missing_docs)]
7#![warn(clippy::cast_sign_loss)]
8
9mod address_map;
10mod builtin;
11mod demangling;
12mod gc;
13mod module;
14mod module_artifacts;
15mod module_types;
16pub mod obj;
17mod ref_bits;
18mod scopevec;
19mod stack_map;
20mod trap_encoding;
21mod tunables;
22mod vmoffsets;
23
24pub use crate::address_map::*;
25pub use crate::builtin::*;
26pub use crate::demangling::*;
27pub use crate::gc::*;
28pub use crate::module::*;
29pub use crate::module_artifacts::*;
30pub use crate::module_types::*;
31pub use crate::ref_bits::*;
32pub use crate::scopevec::ScopeVec;
33pub use crate::stack_map::StackMap;
34pub use crate::trap_encoding::*;
35pub use crate::tunables::*;
36pub use crate::vmoffsets::*;
37pub use object;
38
39#[cfg(feature = "compile")]
40mod compile;
41#[cfg(feature = "compile")]
42mod module_environ;
43#[cfg(feature = "compile")]
44pub use crate::compile::*;
45#[cfg(feature = "compile")]
46pub use crate::module_environ::*;
47
48#[cfg(feature = "component-model")]
49pub mod component;
50#[cfg(all(feature = "component-model", feature = "compile"))]
51pub mod fact;
52
53// Reexport all of these type-level since they're quite commonly used and it's
54// much easier to refer to everything through one crate rather than importing
55// one of three and making sure you're using the right one.
56pub use cranelift_entity::*;
57pub use wasmtime_types::*;
58
59/// WebAssembly page sizes are defined to be 64KiB.
60pub const WASM_PAGE_SIZE: u32 = 0x10000;
61
62/// The number of pages (for 32-bit modules) we can have before we run out of
63/// byte index space.
64pub const WASM32_MAX_PAGES: u64 = 1 << 16;
65/// The number of pages (for 64-bit modules) we can have before we run out of
66/// byte index space.
67pub const WASM64_MAX_PAGES: u64 = 1 << 48;
68
69/// Version number of this crate.
70pub const VERSION: &str = env!("CARGO_PKG_VERSION");