Skip to content

Commit

Permalink
wip: translated the core Wasm module in the Wasm component translation
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat committed Mar 3, 2025
1 parent a3d608d commit 1beebcd
Show file tree
Hide file tree
Showing 10 changed files with 468 additions and 367 deletions.
12 changes: 6 additions & 6 deletions frontend-wasm2/src/code_translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::{
func_translation_state::{ControlStackFrame, ElseData, FuncTranslationState},
function_builder_ext::FunctionBuilderExt,
module_translation_state::ModuleTranslationState,
types::{ir_type, BlockType, FuncIndex, GlobalIndex, ModuleTypes},
types::{ir_type, BlockType, FuncIndex, GlobalIndex, ModuleTypesBuilder},
Module,
},
ssa::Variable,
Expand All @@ -51,7 +51,7 @@ pub fn translate_operator(
state: &mut FuncTranslationState,
module_state: &mut ModuleTranslationState,
module: &Module,
mod_types: &ModuleTypes,
mod_types: &ModuleTypesBuilder,
diagnostics: &DiagnosticsHandler,
span: SourceSpan,
) -> WasmResult<()> {
Expand Down Expand Up @@ -905,7 +905,7 @@ fn translate_block(
blockty: &wasmparser::BlockType,
builder: &mut FunctionBuilderExt,
state: &mut FuncTranslationState,
mod_types: &ModuleTypes,
mod_types: &ModuleTypesBuilder,
diagnostics: &DiagnosticsHandler,
span: SourceSpan,
) -> WasmResult<()> {
Expand Down Expand Up @@ -1039,7 +1039,7 @@ fn translate_if(
blockty: &wasmparser::BlockType,
state: &mut FuncTranslationState,
builder: &mut FunctionBuilderExt,
mod_types: &ModuleTypes,
mod_types: &ModuleTypesBuilder,
diagnostics: &DiagnosticsHandler,
span: SourceSpan,
) -> WasmResult<()> {
Expand Down Expand Up @@ -1101,7 +1101,7 @@ fn translate_loop(
blockty: &wasmparser::BlockType,
builder: &mut FunctionBuilderExt,
state: &mut FuncTranslationState,
mod_types: &ModuleTypes,
mod_types: &ModuleTypesBuilder,
diagnostics: &DiagnosticsHandler,
span: SourceSpan,
) -> WasmResult<()> {
Expand Down Expand Up @@ -1130,7 +1130,7 @@ fn translate_unreachable_operator(
op: &Operator,
builder: &mut FunctionBuilderExt,
state: &mut FuncTranslationState,
mod_types: &ModuleTypes,
mod_types: &ModuleTypesBuilder,
diagnostics: &DiagnosticsHandler,
span: SourceSpan,
) -> WasmResult<()> {
Expand Down
4 changes: 2 additions & 2 deletions frontend-wasm2/src/component/build_ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn translate_component(
config: &WasmTranslationConfig,
context: Rc<Context>,
) -> WasmResult<midenc_hir2::dialects::builtin::ComponentRef> {
let (mut component_types_builder, parsed_root_component) =
let (mut component_types_builder, mut parsed_root_component) =
parse(config, wasm, context.session())?;
// Extract component name from exported component instance
let id = {
Expand All @@ -50,7 +50,7 @@ pub fn translate_component(
};
let translator = ComponentTranslator::new(
id,
&parsed_root_component.static_modules,
&mut parsed_root_component.static_modules,
&parsed_root_component.static_components,
config,
context,
Expand Down
Loading

0 comments on commit 1beebcd

Please sign in to comment.