Don't create functions for imports, we still call those indirectly.

This commit is contained in:
Nick Lewycky
2019-11-08 14:44:59 -08:00
parent 2957b6abd8
commit ed6ce4b9b4

View File

@ -8228,6 +8228,7 @@ impl ModuleCodeGenerator<LLVMFunctionCodeGenerator, LLVMBackend, CodegenError>
assoc: Map<FuncIndex, SigIndex>, assoc: Map<FuncIndex, SigIndex>,
) -> Result<(), CodegenError> { ) -> Result<(), CodegenError> {
for (index, sig_id) in &assoc { for (index, sig_id) in &assoc {
if index.index() >= self.func_import_count {
let function = self.module.borrow_mut().add_function( let function = self.module.borrow_mut().add_function(
&format!("fn{}", index.index()), &format!("fn{}", index.index()),
self.signatures[*sig_id], self.signatures[*sig_id],
@ -8235,6 +8236,7 @@ impl ModuleCodeGenerator<LLVMFunctionCodeGenerator, LLVMBackend, CodegenError>
); );
self.llvm_functions.borrow_mut().insert(index, function); self.llvm_functions.borrow_mut().insert(index, function);
} }
}
self.function_signatures = Some(Arc::new(assoc)); self.function_signatures = Some(Arc::new(assoc));
Ok(()) Ok(())
} }