From 5de0533875b6f439ea9e562cba93204ec15e3ba8 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 16 Apr 2026 23:29:00 +0200 Subject: chore: remove ref stack Signed-off-by: Henry --- crates/parser/src/optimize.rs | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'crates/parser/src/optimize.rs') diff --git a/crates/parser/src/optimize.rs b/crates/parser/src/optimize.rs index 1369d7a..c066c29 100644 --- a/crates/parser/src/optimize.rs +++ b/crates/parser/src/optimize.rs @@ -21,7 +21,6 @@ fn rewrite(instructions: &mut [Instruction], self_func_addr: u32) { Instruction::LocalCopy32(a, b) if a == b => instructions[read] = Instruction::Nop, Instruction::LocalCopy64(a, b) if a == b => instructions[read] = Instruction::Nop, Instruction::LocalCopy128(a, b) if a == b => instructions[read] = Instruction::Nop, - Instruction::LocalCopyRef(a, b) if a == b => instructions[read] = Instruction::Nop, Instruction::Call(addr) if addr == self_func_addr => instructions[read] = Instruction::CallSelf, Instruction::ReturnCall(addr) if addr == self_func_addr => instructions[read] = Instruction::ReturnCallSelf, Instruction::I32Add => { @@ -154,16 +153,6 @@ fn rewrite(instructions: &mut [Instruction], self_func_addr: u32) { instructions[read] = Instruction::Nop; } } - Instruction::LocalGetRef(dst) => { - if read > 0 - && let Instruction::LocalSetRef(src) = instructions[read - 1] - && src == dst - { - instructions[read - 1] = Instruction::LocalTeeRef(src); - instructions[read] = Instruction::Nop; - } - } - Instruction::LocalSet32(dst) => { if read > 0 { match instructions[read - 1] { @@ -243,16 +232,6 @@ fn rewrite(instructions: &mut [Instruction], self_func_addr: u32) { if src == dst { Instruction::Nop } else { Instruction::LocalCopy128(src, dst) }; } } - Instruction::LocalSetRef(dst) => { - if read > 0 - && let Instruction::LocalGetRef(src) = instructions[read - 1] - { - instructions[read - 1] = Instruction::Nop; - instructions[read] = - if src == dst { Instruction::Nop } else { Instruction::LocalCopyRef(src, dst) }; - } - } - Instruction::LocalTee32(dst) => { if read > 0 && let Instruction::LocalGet32(src) = instructions[read - 1] @@ -289,15 +268,6 @@ fn rewrite(instructions: &mut [Instruction], self_func_addr: u32) { instructions[read] = Instruction::Nop; } } - Instruction::LocalTeeRef(dst) => { - if read > 0 - && let Instruction::LocalGetRef(src) = instructions[read - 1] - && src == dst - { - instructions[read] = Instruction::Nop; - } - } - Instruction::Drop32 => { if read > 0 && let Instruction::LocalTee32(local) = instructions[read - 1] @@ -322,14 +292,6 @@ fn rewrite(instructions: &mut [Instruction], self_func_addr: u32) { instructions[read] = Instruction::Nop; } } - Instruction::DropRef => { - if read > 0 - && let Instruction::LocalTeeRef(local) = instructions[read - 1] - { - instructions[read - 1] = Instruction::LocalSetRef(local); - instructions[read] = Instruction::Nop; - } - } _ => {} } } -- cgit v1.3.1