Move start_index out of TranslationResult and into the WasmRuntime.

This makes it more consistent with how all the rest of the content of
a wasm module is handled. And, now TranslationResult just has a Vec
of translated functions, which will make it easier to refactor further.
This commit is contained in:
Dan Gohman
2017-10-09 08:37:04 -07:00
parent ef5ad630c8
commit e74bc06380
4 changed files with 39 additions and 29 deletions

View File

@@ -22,6 +22,9 @@ pub struct DummyRuntime {
// Compilation setting flags.
flags: settings::Flags,
// The start function.
start_func: Option<FunctionIndex>,
}
impl DummyRuntime {
@@ -38,6 +41,7 @@ impl DummyRuntime {
func_types: Vec::new(),
imported_funcs: Vec::new(),
flags,
start_func: None,
}
}
}
@@ -177,6 +181,11 @@ impl WasmRuntime for DummyRuntime {
Ok(())
}
fn declare_start_func(&mut self, func_index: FunctionIndex) {
debug_assert!(self.start_func.is_none());
self.start_func = Some(func_index);
}
fn begin_translation(&mut self) {
// We do nothing
}