Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Pass declare_signature's argument by value.
Browse files Browse the repository at this point in the history
`parse_type_section` doesn't need the value after passing it, and this
allows callees to avoid cloning if they need their own copy.
  • Loading branch information
sunfishcode committed Jan 7, 2019
1 parent 0001afa commit 8a24539
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/wasm/src/environ/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ impl<'data> ModuleEnvironment<'data> for DummyEnvironment {
self.info.config
}

fn declare_signature(&mut self, sig: &ir::Signature) {
self.info.signatures.push(sig.clone());
fn declare_signature(&mut self, sig: ir::Signature) {
self.info.signatures.push(sig);
}

fn declare_func_import(
Expand Down
2 changes: 1 addition & 1 deletion lib/wasm/src/environ/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub trait ModuleEnvironment<'data> {
fn reserve_signatures(&mut self, _num: u32) {}

/// Declares a function signature to the environment.
fn declare_signature(&mut self, sig: &ir::Signature);
fn declare_signature(&mut self, sig: ir::Signature);

/// Provides the number of imports up front. By default this does nothing, but
/// implementations can use this to preallocate memory if desired.
Expand Down
2 changes: 1 addition & 1 deletion lib/wasm/src/sections_translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn parse_type_section(
.expect("only numeric types are supported in function signatures");
AbiParam::new(cret_arg)
}));
environ.declare_signature(&sig);
environ.declare_signature(sig);
}
ref s => panic!("unsupported type: {:?}", s),
}
Expand Down

0 comments on commit 8a24539

Please sign in to comment.