Struct wasmtime_environ::wasm::wasmparser::FuncValidator [−][src]
pub struct FuncValidator<T> { /* fields omitted */ }
Expand description
Validation context for a WebAssembly function.
This structure is created by
Validator::code_section_entry
and is created per-function in a WebAssembly module. This structure is
suitable for sending to other threads while the original
Validator
continues processing other functions.
Implementations
impl<T> FuncValidator<T> where
T: WasmModuleResources,
[src]
impl<T> FuncValidator<T> where
T: WasmModuleResources,
[src]pub fn new(
ty: u32,
offset: usize,
resources: T,
features: &WasmFeatures
) -> Result<FuncValidator<T>, BinaryReaderError>
[src]
pub fn new(
ty: u32,
offset: usize,
resources: T,
features: &WasmFeatures
) -> Result<FuncValidator<T>, BinaryReaderError>
[src]Creates a new FuncValidator
.
The returned FuncValidator
can be used to validate a function with
the type ty
specified. The resources
indicate what the containing
module has for the function to use, and the features
configure what
WebAssembly proposals are enabled for this function.
The returned validator can be used to then parse a FunctionBody
, for
example, to read locals and validate operators.
pub fn operand_stack_height(&self) -> u32
[src]
pub fn operand_stack_height(&self) -> u32
[src]Get the current height of the operand stack.
This returns the height of the whole operand stack for this function, not just for the current control frame.
pub fn validate(
&mut self,
body: &FunctionBody<'_>
) -> Result<(), BinaryReaderError>
[src]
pub fn validate(
&mut self,
body: &FunctionBody<'_>
) -> Result<(), BinaryReaderError>
[src]Convenience function to validate an entire function’s body.
You may not end up using this in final implementations because you’ll often want to interleave validation with parsing.
pub fn read_locals(
&mut self,
reader: &mut BinaryReader<'_>
) -> Result<(), BinaryReaderError>
[src]
pub fn read_locals(
&mut self,
reader: &mut BinaryReader<'_>
) -> Result<(), BinaryReaderError>
[src]Reads the local defintions from the given BinaryReader
, often sourced
from a FunctionBody
.
This function will automatically advance the BinaryReader
forward,
leaving reading operators up to the caller afterwards.
pub fn define_locals(
&mut self,
offset: usize,
count: u32,
ty: Type
) -> Result<(), BinaryReaderError>
[src]
pub fn define_locals(
&mut self,
offset: usize,
count: u32,
ty: Type
) -> Result<(), BinaryReaderError>
[src]Defines locals into this validator.
This should be used if the application is already reading local definitions and there’s no need to re-parse the function again.
pub fn op(
&mut self,
offset: usize,
operator: &Operator<'_>
) -> Result<(), BinaryReaderError>
[src]
pub fn op(
&mut self,
offset: usize,
operator: &Operator<'_>
) -> Result<(), BinaryReaderError>
[src]Validates the next operator in a function.
This functions is expected to be called once-per-operator in a WebAssembly function. Each operator’s offset in the original binary and the operator itself are passed to this function to provide more useful error messages.
pub fn finish(&mut self, offset: usize) -> Result<(), BinaryReaderError>
[src]
pub fn finish(&mut self, offset: usize) -> Result<(), BinaryReaderError>
[src]Function that must be called after the last opcode has been processed.
This will validate that the function was properly terminated with the
end
opcode. If this function is not called then the function will not
be properly validated.
The offset
provided to this function will be used as a position for an
error if validation fails.
Auto Trait Implementations
impl<T> RefUnwindSafe for FuncValidator<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for FuncValidator<T> where
T: Send,
T: Send,
impl<T> Sync for FuncValidator<T> where
T: Sync,
T: Sync,
impl<T> Unpin for FuncValidator<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for FuncValidator<T> where
T: UnwindSafe,
T: UnwindSafe,