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, trivial_numeric_casts, unused_extern_crates)]
7#![warn(unused_import_braces)]
8#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
9#![cfg_attr(
10    feature = "cargo-clippy",
11    allow(clippy::new_without_default, clippy::new_without_default)
12)]
13#![cfg_attr(
14    feature = "cargo-clippy",
15    warn(
16        clippy::float_arithmetic,
17        clippy::mut_mut,
18        clippy::nonminimal_bool,
19        clippy::map_unwrap_or,
20        clippy::clippy::print_stdout,
21        clippy::unicode_not_nfc,
22        clippy::use_self
23    )
24)]
25
26mod address_map;
27mod builtin;
28mod compilation;
29mod module;
30mod module_environ;
31mod module_types;
32pub mod obj;
33mod ref_bits;
34mod scopevec;
35mod stack_map;
36mod trap_encoding;
37mod tunables;
38mod vmoffsets;
39
40pub use crate::address_map::*;
41pub use crate::builtin::*;
42pub use crate::compilation::*;
43pub use crate::module::*;
44pub use crate::module_environ::*;
45pub use crate::module_types::*;
46pub use crate::ref_bits::*;
47pub use crate::scopevec::ScopeVec;
48pub use crate::stack_map::StackMap;
49pub use crate::trap_encoding::*;
50pub use crate::tunables::Tunables;
51pub use crate::vmoffsets::*;
52pub use object;
53
54#[cfg(feature = "component-model")]
55pub mod component;
56#[cfg(feature = "component-model")]
57pub mod fact;
58
59// Reexport all of these type-level since they're quite commonly used and it's
60// much easier to refer to everything through one crate rather than importing
61// one of three and making sure you're using the right one.
62pub use cranelift_entity::*;
63pub use wasmtime_types::*;
64
65/// WebAssembly page sizes are defined to be 64KiB.
66pub const WASM_PAGE_SIZE: u32 = 0x10000;
67
68/// The number of pages (for 32-bit modules) we can have before we run out of
69/// byte index space.
70pub const WASM32_MAX_PAGES: u64 = 1 << 16;
71/// The number of pages (for 64-bit modules) we can have before we run out of
72/// byte index space.
73pub const WASM64_MAX_PAGES: u64 = 1 << 48;
74
75/// Version number of this crate.
76pub const VERSION: &str = env!("CARGO_PKG_VERSION");