winch: Prepare for an update to the wasm-tools crates (#5238)

This commit prepares the `winch` crate for updating `wasm-tools`,
notably changing a bit about how the visitation of operators works. This
moves the function body and wasm validator out of the `CodeGen`
structure and into parameters threaded into the emission of the actual
function.

Additionally the `VisitOperator` implementation was updated to remove
the explicit calls to the validator, favoring instead a macro-generated
solution to guarantee that all validation happens before any translation
proceeds. This means that the `VisitOperator for CodeGen` impl is now
infallible and the various methods have been inlined into the trait
methods as well as removing the `Result<_>`.

Finally this commit updates translation to call `validator.finish(..)`
which is required to perform the final validation steps of the function
body.
This commit is contained in:
Alex Crichton
2022-11-10 14:01:42 -06:00
committed by GitHub
parent 1f09954fa4
commit 3b9668558f
7 changed files with 91 additions and 105 deletions

View File

@@ -85,7 +85,7 @@ pub trait TargetIsa: Send + Sync {
fn compile_function(
&self,
sig: &FuncType,
body: FunctionBody,
body: &FunctionBody,
validator: FuncValidator<ValidatorResources>,
) -> Result<Vec<String>>;