cranelift-wasm: Remove ModuleTranslationState (#5365)

* cranelift-wasm: Remove `ModuleTranslationState`

We were putting data into it, but never reading data out of it. Can be removed.

* cranelift-wasm: move `funct_state.rs` sub module to `state.rs`

Since it is the only submodule of `state` it can just be the whole `state`
module.
This commit is contained in:
Nick Fitzgerald
2022-12-01 11:04:36 -08:00
committed by GitHub
parent ebb693aa18
commit 1eeec7b698
6 changed files with 4 additions and 62 deletions

View File

@@ -6,7 +6,6 @@ use crate::sections_translator::{
parse_global_section, parse_import_section, parse_memory_section, parse_name_section,
parse_start_section, parse_table_section, parse_tag_section, parse_type_section,
};
use crate::state::ModuleTranslationState;
use crate::WasmResult;
use cranelift_codegen::timing;
use std::prelude::v1::*;
@@ -17,9 +16,8 @@ use wasmparser::{NameSectionReader, Parser, Payload, Validator};
pub fn translate_module<'data>(
data: &'data [u8],
environ: &mut dyn ModuleEnvironment<'data>,
) -> WasmResult<ModuleTranslationState> {
) -> WasmResult<()> {
let _tt = timing::wasm_translate_module();
let mut module_translation_state = ModuleTranslationState::new();
let mut validator = Validator::new_with_features(environ.wasm_features());
for payload in Parser::new(0).parse_all(data) {
@@ -37,7 +35,7 @@ pub fn translate_module<'data>(
Payload::TypeSection(types) => {
validator.type_section(&types)?;
parse_type_section(types, &mut module_translation_state, environ)?;
parse_type_section(types, environ)?;
}
Payload::ImportSection(imports) => {
@@ -127,5 +125,5 @@ pub fn translate_module<'data>(
}
}
Ok(module_translation_state)
Ok(())
}