Restructure VMContext to eliminate a level of indirection.

This commit is contained in:
Dan Gohman
2019-01-03 11:02:37 -08:00
parent ff6776fe10
commit 3270369a69
10 changed files with 774 additions and 621 deletions

View File

@@ -45,7 +45,7 @@ extern "C" fn spectest_print_f64_f64(x: f64, y: f64) {
/// Return an instance implementing the "spectest" interface used in the
/// spec testsuite.
pub fn instantiate_spectest() -> Result<Box<Instance>, InstantiationError> {
pub fn instantiate_spectest() -> Result<Instance, InstantiationError> {
let call_conv = isa::CallConv::triple_default(&HOST);
let pointer_type = types::Type::triple_pointer_type(&HOST);
let mut module = Module::new();

View File

@@ -111,7 +111,7 @@ impl WastContext {
}
}
fn instantiate(&mut self, module: ModuleBinary) -> Result<Box<Instance>, SetupError> {
fn instantiate(&mut self, module: ModuleBinary) -> Result<Instance, SetupError> {
let data = module.into_vec();
self.validate(&data).map_err(SetupError::Validate)?;