Wasm: implement dead code elimination

This commit is contained in:
Brian Carroll 2022-01-11 21:16:20 +00:00
parent 98400cae1b
commit 8a01c3f98a
6 changed files with 230 additions and 66 deletions

View file

@ -37,6 +37,18 @@ impl Serialize for ValueType {
}
}
impl From<u8> for ValueType {
fn from(x: u8) -> Self {
match x {
0x7f => Self::I32,
0x7e => Self::I64,
0x7d => Self::F32,
0x7c => Self::F64,
_ => internal_error!("Invalid ValueType 0x{:02x}", x),
}
}
}
const BLOCK_NO_RESULT: u8 = 0x40;
/// A control block in our model of the VM