Add support for dynamic trampolines in compiler-llvm.

This commit is contained in:
Nick Lewycky
2020-05-29 16:56:41 -07:00
parent eaff807bc3
commit 45e80dec7b
2 changed files with 213 additions and 8 deletions

View File

@ -128,9 +128,19 @@ impl Compiler for LLVMCompiler {
fn compile_dynamic_function_trampolines(
&self,
_module: &ModuleInfo,
module: &ModuleInfo,
) -> Result<PrimaryMap<FunctionIndex, FunctionBody>, CompileError> {
Ok(PrimaryMap::new())
// unimplemented!("Dynamic function trampolines not yet implemented");
Ok(module
.functions
.values()
.take(module.num_imported_funcs)
.collect::<Vec<_>>()
.par_iter()
.map_init(FuncTrampoline::new, |func_trampoline, sig_index| {
func_trampoline.dynamic_trampoline(&module.signatures[**sig_index], self.config())
})
.collect::<Result<Vec<_>, CompileError>>()?
.into_iter()
.collect::<PrimaryMap<FunctionIndex, FunctionBody>>())
}
}