mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-24 17:29:26 +00:00
Dynamic function support for singlepass.
This commit is contained in:
@ -2,7 +2,10 @@
|
||||
// Allow unused imports while developing.
|
||||
#![allow(unused_imports, dead_code)]
|
||||
|
||||
use crate::codegen_x64::{gen_import_call_trampoline, gen_std_trampoline, CodegenError, FuncGen};
|
||||
use crate::codegen_x64::{
|
||||
gen_import_call_trampoline, gen_std_dynamic_import_trampoline, gen_std_trampoline,
|
||||
CodegenError, FuncGen,
|
||||
};
|
||||
use crate::config::SinglepassConfig;
|
||||
use rayon::prelude::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterator};
|
||||
use wasm_common::entity::{EntityRef, PrimaryMap};
|
||||
@ -64,11 +67,7 @@ impl Compiler for SinglepassCompiler {
|
||||
.collect::<Vec<_>>()
|
||||
.into_par_iter()
|
||||
.map(|i| {
|
||||
gen_import_call_trampoline(
|
||||
&vmoffsets,
|
||||
i,
|
||||
module.signatures[module.functions[i]].clone(),
|
||||
)
|
||||
gen_import_call_trampoline(&vmoffsets, i, &module.signatures[module.functions[i]])
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
@ -131,10 +130,21 @@ impl Compiler for SinglepassCompiler {
|
||||
|
||||
fn compile_dynamic_function_trampolines(
|
||||
&self,
|
||||
_module: &ModuleInfo,
|
||||
module: &ModuleInfo,
|
||||
) -> Result<PrimaryMap<FunctionIndex, FunctionBody>, CompileError> {
|
||||
Ok(PrimaryMap::new())
|
||||
// unimplemented!("Dynamic funciton trampolines not yet implemented");
|
||||
let vmoffsets = VMOffsets::new(8, module);
|
||||
Ok(module
|
||||
.functions
|
||||
.values()
|
||||
.take(module.num_imported_funcs)
|
||||
.collect::<Vec<_>>()
|
||||
.par_iter()
|
||||
.map(|&&sig_index| {
|
||||
gen_std_dynamic_import_trampoline(&vmoffsets, &module.signatures[sig_index])
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
.collect::<PrimaryMap<FunctionIndex, FunctionBody>>())
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user