stacker
This commit is contained in:
parent
a323e41c18
commit
5efb86d252
|
@ -24,6 +24,7 @@ addr2line = "0.19"
|
||||||
libfuzzer-sys = { version = "0.4", optional = true }
|
libfuzzer-sys = { version = "0.4", optional = true }
|
||||||
wasm-smith = { version = "0.8", optional = true }
|
wasm-smith = { version = "0.8", optional = true }
|
||||||
indexmap = "2.2.2"
|
indexmap = "2.2.2"
|
||||||
|
stacker = "0.1.15"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -16,8 +16,6 @@ use treeify::Trees;
|
||||||
pub mod localify;
|
pub mod localify;
|
||||||
use localify::Localifier;
|
use localify::Localifier;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub struct WasmFuncBackend<'a> {
|
pub struct WasmFuncBackend<'a> {
|
||||||
body: &'a FunctionBody,
|
body: &'a FunctionBody,
|
||||||
trees: Trees,
|
trees: Trees,
|
||||||
|
@ -83,6 +81,7 @@ impl<'a> WasmFuncBackend<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_block(&self, block: &WasmBlock<'_>, func: &mut wasm_encoder::Function) {
|
fn lower_block(&self, block: &WasmBlock<'_>, func: &mut wasm_encoder::Function) {
|
||||||
|
stacker::maybe_grow(32 * 1024, 1024 * 1024, move || {
|
||||||
match block {
|
match block {
|
||||||
WasmBlock::Block { body, .. } => {
|
WasmBlock::Block { body, .. } => {
|
||||||
func.instruction(&wasm_encoder::Instruction::Block(
|
func.instruction(&wasm_encoder::Instruction::Block(
|
||||||
|
@ -145,7 +144,8 @@ impl<'a> WasmFuncBackend<'a> {
|
||||||
for &inst in &self.body.blocks[*block].insts {
|
for &inst in &self.body.blocks[*block].insts {
|
||||||
// If this value is "owned", do nothing: it will be lowered in
|
// If this value is "owned", do nothing: it will be lowered in
|
||||||
// the one place it's used.
|
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
if let &ValueDef::Operator(..) = &self.body.values[inst] {
|
if let &ValueDef::Operator(..) = &self.body.values[inst] {
|
||||||
|
@ -193,6 +193,7 @@ impl<'a> WasmFuncBackend<'a> {
|
||||||
func.instruction(&wasm_encoder::Instruction::Unreachable);
|
func.instruction(&wasm_encoder::Instruction::Unreachable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_value(&self, value: Value, func: &mut wasm_encoder::Function) {
|
fn lower_value(&self, value: Value, func: &mut wasm_encoder::Function) {
|
||||||
|
|
Loading…
Reference in a new issue