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:
@@ -1,8 +1,8 @@
|
||||
use crate::module::Names;
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use wasmtime_environ::entity::EntityRef;
|
||||
use wasmtime_environ::wasm::FuncIndex;
|
||||
use wasmtime_environ::Module;
|
||||
use wasmtime_jit::CompiledModule;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@@ -39,7 +39,7 @@ pub struct GlobalFrameInfoRegistration {
|
||||
struct ModuleFrameInfo {
|
||||
start: usize,
|
||||
functions: BTreeMap<usize, (usize, FuncIndex)>,
|
||||
names: Arc<Names>,
|
||||
module: Arc<Module>,
|
||||
}
|
||||
|
||||
impl GlobalFrameInfo {
|
||||
@@ -49,11 +49,7 @@ impl GlobalFrameInfo {
|
||||
/// compiled functions within `module`. If the `module` has no functions
|
||||
/// then `None` will be returned. Otherwise the returned object, when
|
||||
/// dropped, will be used to unregister all name information from this map.
|
||||
pub fn register(
|
||||
&self,
|
||||
names: &Arc<Names>,
|
||||
module: &CompiledModule,
|
||||
) -> Option<GlobalFrameInfoRegistration> {
|
||||
pub fn register(&self, module: &CompiledModule) -> Option<GlobalFrameInfoRegistration> {
|
||||
let mut min = usize::max_value();
|
||||
let mut max = 0;
|
||||
let mut functions = BTreeMap::new();
|
||||
@@ -92,7 +88,7 @@ impl GlobalFrameInfo {
|
||||
ModuleFrameInfo {
|
||||
start: min,
|
||||
functions,
|
||||
names: names.clone(),
|
||||
module: module.module().clone(),
|
||||
},
|
||||
);
|
||||
assert!(prev.is_none());
|
||||
@@ -114,9 +110,9 @@ impl GlobalFrameInfo {
|
||||
return None;
|
||||
}
|
||||
Some(FrameInfo {
|
||||
module_name: info.names.module_name.clone(),
|
||||
module_name: info.module.name.clone(),
|
||||
func_index: func_index.index() as u32,
|
||||
func_name: info.names.module.func_names.get(func_index).cloned(),
|
||||
func_name: info.module.func_names.get(func_index).cloned(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user