Add a compiler-llvm CompilerFunctionKind for the whole module which can occur with the experimental API for engine-native.

Since it's no longer per-function, rename CompilerFunctionKind to CompilerKind.
This commit is contained in:
Nick Lewycky
2020-08-20 23:28:07 -07:00
parent 91414df670
commit 5d40787856
6 changed files with 29 additions and 35 deletions

View File

@ -1,7 +1,7 @@
use crate::config::LLVM;
use crate::trampoline::FuncTrampoline;
use crate::translator::FuncTranslator;
use crate::CompiledFunctionKind;
use crate::CompiledKind;
use inkwell::context::Context;
use inkwell::memory_buffer::MemoryBuffer;
use inkwell::module::{Linkage, Module};
@ -199,10 +199,7 @@ impl LLVMCompiler {
.write_to_memory_buffer(&merged_module, FileType::Object)
.unwrap();
if let Some(ref callbacks) = self.config.callbacks {
callbacks.obj_memory_buffer(
&CompiledFunctionKind::Local(function_body_inputs.iter().next().unwrap().0),
&memory_buffer,
);
callbacks.obj_memory_buffer(&CompiledKind::Module, &memory_buffer);
}
Ok(memory_buffer.as_slice().to_vec())