Store module name on wasmtime_environ::Module (#1309)
* Store module name on `wasmtime_environ::Module` This keeps all name information in one place so we dont' have to keep extra structures around in `wasmtime::Module`. * rustfmt
This commit is contained in:
@@ -128,6 +128,9 @@ pub struct DummyEnvironment {
|
||||
/// Instructs to collect debug data during translation.
|
||||
debug_info: bool,
|
||||
|
||||
/// Name of the module from the wasm file.
|
||||
pub module_name: Option<String>,
|
||||
|
||||
/// Function names.
|
||||
function_names: SecondaryMap<FuncIndex, String>,
|
||||
}
|
||||
@@ -141,6 +144,7 @@ impl DummyEnvironment {
|
||||
func_bytecode_sizes: Vec::new(),
|
||||
return_mode,
|
||||
debug_info,
|
||||
module_name: None,
|
||||
function_names: SecondaryMap::new(),
|
||||
}
|
||||
}
|
||||
@@ -726,6 +730,11 @@ impl<'data> ModuleEnvironment<'data> for DummyEnvironment {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn declare_module_name(&mut self, name: &'data str) -> WasmResult<()> {
|
||||
self.module_name = Some(String::from(name));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn declare_func_name(&mut self, func_index: FuncIndex, name: &'data str) -> WasmResult<()> {
|
||||
self.function_names[func_index] = String::from(name);
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user