This commit is contained in:
Graham Kelly 2024-03-14 16:58:45 -04:00
parent a323e41c18
commit 5efb86d252
2 changed files with 104 additions and 102 deletions

View file

@ -24,6 +24,7 @@ addr2line = "0.19"
libfuzzer-sys = { version = "0.4", optional = true }
wasm-smith = { version = "0.8", optional = true }
indexmap = "2.2.2"
stacker = "0.1.15"
[features]
default = []

View file

@ -16,8 +16,6 @@ use treeify::Trees;
pub mod localify;
use localify::Localifier;
pub struct WasmFuncBackend<'a> {
body: &'a FunctionBody,
trees: Trees,
@ -83,6 +81,7 @@ impl<'a> WasmFuncBackend<'a> {
}
fn lower_block(&self, block: &WasmBlock<'_>, func: &mut wasm_encoder::Function) {
stacker::maybe_grow(32 * 1024, 1024 * 1024, move || {
match block {
WasmBlock::Block { body, .. } => {
func.instruction(&wasm_encoder::Instruction::Block(
@ -145,7 +144,8 @@ impl<'a> WasmFuncBackend<'a> {
for &inst in &self.body.blocks[*block].insts {
// If this value is "owned", do nothing: it will be lowered in
// the one place it's used.
if self.trees.owner.contains_key(&inst) || self.trees.remat.contains(&inst) {
if self.trees.owner.contains_key(&inst) || self.trees.remat.contains(&inst)
{
continue;
}
if let &ValueDef::Operator(..) = &self.body.values[inst] {
@ -193,6 +193,7 @@ impl<'a> WasmFuncBackend<'a> {
func.instruction(&wasm_encoder::Instruction::Unreachable);
}
}
})
}
fn lower_value(&self, value: Value, func: &mut wasm_encoder::Function) {