Fix some ugliness
This commit is contained in:
@@ -26,6 +26,8 @@ impl Block {
|
||||
}
|
||||
}
|
||||
|
||||
const DISASSEMBLE: bool = false;
|
||||
|
||||
pub fn translate_wasm<M: ModuleContext>(
|
||||
session: &mut CodeGenSession<M>,
|
||||
func_idx: u32,
|
||||
@@ -36,7 +38,7 @@ where
|
||||
{
|
||||
let ty = session.module_context.func_type(func_idx);
|
||||
|
||||
if false {
|
||||
if DISASSEMBLE {
|
||||
let mut microwasm = vec![];
|
||||
|
||||
let microwasm_conv = MicrowasmConv::new(
|
||||
|
||||
@@ -112,40 +112,17 @@ pub fn code(
|
||||
) -> Result<TranslatedCodeSection, Error> {
|
||||
let func_count = code.get_count();
|
||||
let mut session = CodeGenSession::new(func_count, translation_ctx);
|
||||
|
||||
for (idx, body) in code.into_iter().enumerate() {
|
||||
let body = body?;
|
||||
|
||||
if true {
|
||||
let mut microwasm = vec![];
|
||||
|
||||
let mut microwasm_conv = MicrowasmConv::new(
|
||||
translation_ctx,
|
||||
translation_ctx
|
||||
.func_type(idx as _)
|
||||
.params
|
||||
.iter()
|
||||
.map(|t| MWType::from_wasm(*t).unwrap()),
|
||||
translation_ctx
|
||||
.func_type(idx as _)
|
||||
.returns
|
||||
.iter()
|
||||
.map(|t| MWType::from_wasm(*t).unwrap()),
|
||||
&body,
|
||||
);
|
||||
|
||||
for ops in microwasm_conv {
|
||||
microwasm.extend(ops?);
|
||||
}
|
||||
|
||||
println!("{}", crate::microwasm::dis(idx, µwasm));
|
||||
}
|
||||
|
||||
function_body::translate_wasm(
|
||||
&mut session,
|
||||
idx as u32,
|
||||
&body,
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(session.into_translated_code_section()?)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user