diff --git a/lib/compiler-llvm/src/compiler.rs b/lib/compiler-llvm/src/compiler.rs index 9033359c5..d01fa299c 100644 --- a/lib/compiler-llvm/src/compiler.rs +++ b/lib/compiler-llvm/src/compiler.rs @@ -73,13 +73,13 @@ impl SymbolRegistry for ShortNames { } impl LLVMCompiler { - fn compile_native_object<'data, 'module>( + fn _compile_native_object<'data, 'module>( &self, target: &Target, compile_info: &'module CompileModuleInfo, module_translation: &ModuleTranslationState, function_body_inputs: PrimaryMap>, - namer: &dyn CompilationNamer, + symbol_registry: &dyn SymbolRegistry, ) -> Result, CompileError> { let target_machine = self.config().target_machine(target); let ctx = Context::create(); @@ -98,10 +98,6 @@ impl LLVMCompiler { FuncTranslator::new(target_machine) }, |func_translator, (i, input)| { - let mut namer = CachingInvertibleCompilationNamer { - cache: HashMap::new(), - namer, - }; let module = func_translator.translate_to_module( &compile_info.module, module_translation, @@ -110,7 +106,7 @@ impl LLVMCompiler { self.config(), &compile_info.memory_styles, &compile_info.table_styles, - &mut namer, + symbol_registry, )?; Ok(module.write_bitcode_to_memory().as_slice().to_vec()) }, diff --git a/lib/compiler-llvm/src/translator/code.rs b/lib/compiler-llvm/src/translator/code.rs index 63612d1f2..212d71f93 100644 --- a/lib/compiler-llvm/src/translator/code.rs +++ b/lib/compiler-llvm/src/translator/code.rs @@ -75,8 +75,8 @@ impl FuncTranslator { config: &LLVM, memory_styles: &PrimaryMap, _table_styles: &PrimaryMap, - symbol_registry: &mut dyn SymbolRegistry, - ) -> Result { + symbol_registry: &dyn SymbolRegistry, + ) -> Result { // The function type, used for the callbacks. let function = CompiledFunctionKind::Local(*local_func_index); let func_index = wasm_module.func_index(*local_func_index); @@ -269,6 +269,7 @@ impl FuncTranslator { if let Some(ref callbacks) = config.callbacks { callbacks.postopt_ir(&function, &module); } + Ok(module) } @@ -281,7 +282,7 @@ impl FuncTranslator { config: &LLVM, memory_styles: &PrimaryMap, table_styles: &PrimaryMap, - namer: &mut dyn crate::compiler::InvertibleCompilationNamer, + symbol_registry: &dyn SymbolRegistry, ) -> Result { let module = self.translate_to_module( wasm_module, @@ -291,7 +292,7 @@ impl FuncTranslator { config, memory_styles, table_styles, - namer, + symbol_registry, )?; let function = CompiledFunctionKind::Local(*local_func_index); let target_machine = &self.target_machine; @@ -1309,7 +1310,7 @@ pub struct LLVMFunctionCodeGenerator<'ctx, 'a> { module: &'a Module<'ctx>, module_translation: &'a ModuleTranslationState, wasm_module: &'a ModuleInfo, - symbol_registry: &'a mut dyn SymbolRegistry, + symbol_registry: &'a dyn SymbolRegistry, } impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> { diff --git a/lib/object/src/module.rs b/lib/object/src/module.rs index 56a6741f1..0f3704d60 100644 --- a/lib/object/src/module.rs +++ b/lib/object/src/module.rs @@ -24,7 +24,7 @@ pub enum Symbol { } /// This trait facilitates symbol name lookups in a native object file. -pub trait SymbolRegistry { +pub trait SymbolRegistry: Send + Sync { /// Given a `Symbol` it returns the name for that symbol in the object file fn symbol_to_name(&self, symbol: Symbol) -> String;