diff --git a/src/lib.rs b/src/lib.rs index 104b7e0..60fd41f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -380,6 +380,7 @@ pub use self::module::{ModuleInstance, ModuleRef, ExternVal, NotStartedModuleRef pub use self::global::{GlobalInstance, GlobalRef}; pub use self::func::{FuncInstance, FuncRef, FuncInvocation, ResumableError}; pub use self::types::{Signature, ValueType, GlobalDescriptor, TableDescriptor, MemoryDescriptor}; +pub use self::validation::{ValidatedModule, validate_module}; /// WebAssembly-specific sizes and units. pub mod memory_units { diff --git a/src/validation/mod.rs b/src/validation/mod.rs index d6e452f..a8c1e58 100644 --- a/src/validation/mod.rs +++ b/src/validation/mod.rs @@ -40,8 +40,11 @@ impl From for Error { } #[derive(Clone)] +/// A deserialized and validated module pub struct ValidatedModule { + /// The instructions in each Function, represented using isa::Instructions pub code_map: Vec, + /// The deserialized module pub module: Module, } @@ -165,6 +168,7 @@ pub fn deny_floating_point(module: &Module) -> Result<(), Error> { Ok(()) } +/// Validate a module. This checks all of the invariants given by the WebAssembly spec. pub fn validate_module(module: Module) -> Result { let mut context_builder = ModuleContextBuilder::new(); let mut imported_globals = Vec::new();