Rename validate_module2 → validate_module
This commit is contained in:
parent
44acdd6eb7
commit
e78f8ad37e
|
@ -3,7 +3,7 @@ use alloc::prelude::v1::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
isa,
|
isa,
|
||||||
validation::{validate_module2, Error, Validation},
|
validation::{validate_module, Error, Validation},
|
||||||
};
|
};
|
||||||
use parity_wasm::elements::Module;
|
use parity_wasm::elements::Module;
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ pub struct WasmiValidation {
|
||||||
code_map: Vec<isa::Instructions>,
|
code_map: Vec<isa::Instructions>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This implementation of `Validation` is compiling wasm code at the
|
||||||
|
// validation time.
|
||||||
impl Validation for WasmiValidation {
|
impl Validation for WasmiValidation {
|
||||||
type Output = Vec<isa::Instructions>;
|
type Output = Vec<isa::Instructions>;
|
||||||
type FunctionValidator = compile::Compiler;
|
type FunctionValidator = compile::Compiler;
|
||||||
|
@ -38,7 +40,7 @@ impl Validation for WasmiValidation {
|
||||||
|
|
||||||
/// Validate a module and compile it to the internal representation.
|
/// Validate a module and compile it to the internal representation.
|
||||||
pub fn compile_module(module: Module) -> Result<CompiledModule, Error> {
|
pub fn compile_module(module: Module) -> Result<CompiledModule, Error> {
|
||||||
let code_map = validate_module2::<WasmiValidation>(&module)?;
|
let code_map = validate_module::<WasmiValidation>(&module)?;
|
||||||
Ok(CompiledModule { module, code_map })
|
Ok(CompiledModule { module, code_map })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,7 @@ pub trait FunctionValidator {
|
||||||
fn finish(self) -> Self::Output;
|
fn finish(self) -> Self::Output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Rename to validate_module
|
pub fn validate_module<V: Validation>(module: &Module) -> Result<V::Output, Error> {
|
||||||
pub fn validate_module2<V: Validation>(module: &Module) -> Result<V::Output, Error> {
|
|
||||||
let mut context_builder = ModuleContextBuilder::new();
|
let mut context_builder = ModuleContextBuilder::new();
|
||||||
let mut imported_globals = Vec::new();
|
let mut imported_globals = Vec::new();
|
||||||
let mut validation = V::new(&module);
|
let mut validation = V::new(&module);
|
||||||
|
|
Loading…
Reference in New Issue