Avoid unnecessary clone() calls.

This commit is contained in:
Dan Gohman
2018-12-12 14:20:36 -08:00
parent 5c2395ee32
commit 26eb8131da

View File

@@ -216,11 +216,10 @@ impl Instance {
if let Some(start_index) = self.module.start_func { if let Some(start_index) = self.module.start_func {
let (callee_address, callee_vmctx) = match self.module.defined_func_index(start_index) { let (callee_address, callee_vmctx) = match self.module.defined_func_index(start_index) {
Some(defined_start_index) => { Some(defined_start_index) => {
let body = self let body = *self
.finished_functions .finished_functions
.get(defined_start_index) .get(defined_start_index)
.expect("start function index is out of bounds") .expect("start function index is out of bounds");
.clone();
(body, self.vmctx_mut() as *mut VMContext) (body, self.vmctx_mut() as *mut VMContext)
} }
None => { None => {
@@ -302,7 +301,7 @@ impl Instance {
} else { } else {
unsafe { self.vmctx.imported_global(*index).from } unsafe { self.vmctx.imported_global(*index).from }
}, },
global: self.module.globals[*index].clone(), global: self.module.globals[*index],
}, },
}) })
} else { } else {