Skip to content

Commit

Permalink
Remove no-longer-necessary param to lower (#196)
Browse files Browse the repository at this point in the history
Some more vestigial remains from #195
  • Loading branch information
alexcrichton authored Apr 19, 2022
1 parent 1f9e602 commit 4341162
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions crates/parser/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
for nth in 0..func.params.len() {
self.emit(&Instruction::GetArg { nth });
}
self.lower_all(&func.params, None);
self.lower_all(&func.params);

if func.is_async {
// We emit custom instructions for async calls since they
Expand Down Expand Up @@ -1096,7 +1096,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {

// ... and at the end we lower everything back into return
// values.
self.lower_all(&func.results, Some(nargs));
self.lower_all(&func.results);

if func.is_async {
let tys = sig.retptr.as_ref().unwrap();
Expand Down Expand Up @@ -1224,14 +1224,14 @@ impl<'a, B: Bindgen> Generator<'a, B> {
/// Assumes that the value for `tys` is already on the stack, and then
/// converts all of those values into their wasm types by lowering each
/// argument in-order.
fn lower_all(&mut self, tys: &[(String, Type)], mut nargs: Option<usize>) {
fn lower_all(&mut self, tys: &[(String, Type)]) {
let operands = self
.stack
.drain(self.stack.len() - tys.len()..)
.collect::<Vec<_>>();
for (operand, (_, ty)) in operands.into_iter().zip(tys) {
self.stack.push(operand);
self.lower(ty, nargs.as_mut());
self.lower(ty);
}
}

Expand Down Expand Up @@ -1297,7 +1297,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
self.bindgen.finish_block(&mut self.operands);
}

fn lower(&mut self, ty: &Type, retptr: Option<&mut usize>) {
fn lower(&mut self, ty: &Type) {
use Instruction::*;

match *ty {
Expand Down Expand Up @@ -1349,7 +1349,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
}
}
Type::Id(id) => match &self.iface.types[id].kind {
TypeDefKind::Type(t) => self.lower(t, retptr),
TypeDefKind::Type(t) => self.lower(t),
TypeDefKind::List(element) => {
// Lowering parameters calling a wasm import means
// we don't need to pass ownership, but we pass
Expand Down Expand Up @@ -1397,7 +1397,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
.collect::<Vec<_>>();
for (field, value) in record.fields.iter().zip(values) {
self.stack.push(value);
self.lower(&field.ty, None);
self.lower(&field.ty);
}
}

Expand All @@ -1416,7 +1416,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
// Using the payload of this block we lower the type to
// raw wasm values.
self.stack.push(payload_name.clone());
self.lower(ty, None);
self.lower(ty);

// Determine the types of all the wasm values we just
// pushed, and record how many. If we pushed too few
Expand Down Expand Up @@ -1635,15 +1635,15 @@ impl<'a, B: Bindgen> Generator<'a, B> {
// which we write into memory, writing the pointer into the low address
// and the length into the high address.
TypeDefKind::List(_) => {
self.lower(ty, None);
self.lower(ty);
self.stack.push(addr.clone());
self.emit(&I32Store { offset: offset + 4 });
self.stack.push(addr);
self.emit(&I32Store { offset });
}

TypeDefKind::Record(r) if r.is_flags() => {
self.lower(ty, None);
self.lower(ty);
match self.iface.flags_repr(r) {
Some(repr) => {
self.stack.push(addr);
Expand Down Expand Up @@ -1720,7 +1720,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
}

fn lower_and_emit(&mut self, ty: &Type, addr: B::Operand, instr: &Instruction) {
self.lower(ty, None);
self.lower(ty);
self.stack.push(addr);
self.emit(instr);
}
Expand Down

0 comments on commit 4341162

Please sign in to comment.