|
@ -9,6 +9,7 @@ use crate::func_environ::{ |
|
|
get_memory32_grow_name, get_memory32_size_name, FuncEnvironment, |
|
|
get_memory32_grow_name, get_memory32_size_name, FuncEnvironment, |
|
|
}; |
|
|
}; |
|
|
use crate::module::Module; |
|
|
use crate::module::Module; |
|
|
|
|
|
use crate::module_environ::FunctionBodyData; |
|
|
use cranelift_codegen::binemit; |
|
|
use cranelift_codegen::binemit; |
|
|
use cranelift_codegen::ir; |
|
|
use cranelift_codegen::ir; |
|
|
use cranelift_codegen::ir::ExternalName; |
|
|
use cranelift_codegen::ir::ExternalName; |
|
@ -112,7 +113,7 @@ fn get_address_transform( |
|
|
/// associated relocations.
|
|
|
/// associated relocations.
|
|
|
pub fn compile_module<'data, 'module>( |
|
|
pub fn compile_module<'data, 'module>( |
|
|
module: &'module Module, |
|
|
module: &'module Module, |
|
|
function_body_inputs: PrimaryMap<DefinedFuncIndex, &'data [u8]>, |
|
|
function_body_inputs: PrimaryMap<DefinedFuncIndex, FunctionBodyData<'data>>, |
|
|
isa: &dyn isa::TargetIsa, |
|
|
isa: &dyn isa::TargetIsa, |
|
|
generate_debug_info: bool, |
|
|
generate_debug_info: bool, |
|
|
) -> Result<(Compilation, Relocations, AddressTransforms), CompileError> { |
|
|
) -> Result<(Compilation, Relocations, AddressTransforms), CompileError> { |
|
@ -122,7 +123,7 @@ pub fn compile_module<'data, 'module>( |
|
|
|
|
|
|
|
|
function_body_inputs |
|
|
function_body_inputs |
|
|
.into_iter() |
|
|
.into_iter() |
|
|
.collect::<Vec<(DefinedFuncIndex, &&'data [u8])>>() |
|
|
.collect::<Vec<(DefinedFuncIndex, &FunctionBodyData<'data>)>>() |
|
|
.par_iter() |
|
|
.par_iter() |
|
|
.map(|(i, input)| { |
|
|
.map(|(i, input)| { |
|
|
let func_index = module.func_index(*i); |
|
|
let func_index = module.func_index(*i); |
|
@ -133,7 +134,8 @@ pub fn compile_module<'data, 'module>( |
|
|
let mut trans = FuncTranslator::new(); |
|
|
let mut trans = FuncTranslator::new(); |
|
|
trans |
|
|
trans |
|
|
.translate( |
|
|
.translate( |
|
|
input, |
|
|
input.data, |
|
|
|
|
|
input.module_offset, |
|
|
&mut context.func, |
|
|
&mut context.func, |
|
|
&mut FuncEnvironment::new(isa.frontend_config(), module), |
|
|
&mut FuncEnvironment::new(isa.frontend_config(), module), |
|
|
) |
|
|
) |
|
|