diff --git a/src/compile/mod.rs b/src/compile/mod.rs index d861e9da..afc886ac 100644 --- a/src/compile/mod.rs +++ b/src/compile/mod.rs @@ -1619,10 +1619,7 @@ code: BindingKind::Func(f) if self.inlinable(f.instrs(&self.asm)) => { if call { // Inline instructions - self.push_instr(Instr::PushSig(f.signature())); - let instrs = EcoVec::from(f.instrs(&self.asm)); - self.push_all_instrs(instrs); - self.push_instr(Instr::PopSig); + self.push_all_instrs(EcoVec::from(f.instrs(&self.asm))); } else { self.push_instr(Instr::PushFunc(f)); } diff --git a/src/compile/modifier.rs b/src/compile/modifier.rs index 12e5d327..10b67973 100644 --- a/src/compile/modifier.rs +++ b/src/compile/modifier.rs @@ -599,9 +599,7 @@ impl Compiler { instrs.extend(a_instrs); let sig = Signature::new(a_sig.args.max(b_sig.args), a_sig.outputs + b_sig.outputs); if call { - self.push_instr(Instr::PushSig(sig)); self.push_all_instrs(instrs); - self.push_instr(Instr::PopSig); } else { let func = self.make_function(modified.modifier.span.clone().into(), sig, instrs); @@ -627,9 +625,7 @@ impl Compiler { instrs.extend(a_instrs); let sig = Signature::new(a_sig.args + b_sig.args, a_sig.outputs + b_sig.outputs); if call { - self.push_instr(Instr::PushSig(sig)); self.push_all_instrs(instrs); - self.push_instr(Instr::PopSig); } else { let func = self.make_function( FunctionId::Anonymous(modified.modifier.span.clone()), @@ -682,25 +678,9 @@ impl Compiler { } if let Some((f_before, f_after)) = under_instrs(&f_instrs, g_sig, self) { - let before_sig = self.sig_of(&f_before, &f_span)?; - let after_sig = self.sig_of(&f_after, &f_span)?; - let mut instrs = if call { - eco_vec![Instr::PushSig(before_sig)] - } else { - EcoVec::new() - }; - instrs.extend(f_before); - if call { - instrs.push(Instr::PopSig); - } + let mut instrs = f_before; instrs.extend(g_instrs); - if call { - instrs.push(Instr::PushSig(after_sig)); - } instrs.extend(f_after); - if call { - instrs.push(Instr::PopSig); - } if call { self.push_all_instrs(instrs); } else { @@ -837,9 +817,7 @@ impl Compiler { } let sig = Signature::new(sig.args * 2, sig.outputs * 2); if call { - self.push_instr(Instr::PushSig(sig)); self.push_all_instrs(instrs); - self.push_instr(Instr::PopSig); } else { let func = self.make_function(modified.modifier.span.clone().into(), sig, instrs); diff --git a/src/optimize.rs b/src/optimize.rs index f67deb38..ec4e0553 100644 --- a/src/optimize.rs +++ b/src/optimize.rs @@ -2,7 +2,7 @@ use std::fmt; use ecow::EcoVec; -use crate::{check::instrs_all_signatures, Assembly, ImplPrimitive, Instr, Primitive}; +use crate::{Assembly, ImplPrimitive, Instr, Primitive}; pub(crate) fn optimize_instrs_mut( instrs: &mut EcoVec, @@ -276,19 +276,6 @@ pub(crate) fn optimize_instrs_mut( instrs.pop(); } } - // Redundant identity - (ins, Instr::Prim(Identity, span)) if !ins.is_empty() => { - for i in (0..ins.len()).rev() { - let Ok((sig, temp_sigs)) = instrs_all_signatures(&ins[i..]) else { - continue; - }; - if temp_sigs.iter().all(|&sig| sig == (0, 0)) && sig.outputs >= 1 { - println!("{:?}", &ins[i..]); - return; - } - } - instrs.push(Instr::Prim(Identity, span)); - } (_, instr) => instrs.push(instr), } } diff --git a/src/value.rs b/src/value.rs index 651af33f..2b93b9b8 100644 --- a/src/value.rs +++ b/src/value.rs @@ -274,6 +274,7 @@ impl Value { Self::Box(_) => env.box_scalar_fill().map(Into::into), } } + #[allow(dead_code)] pub(crate) fn fill_row(&self, env: &Uiua) -> Result { if self.rank() == 0 { return self.fill_scalar(env);