Prepare to abstract rayon away by minimizing the API we use

This commit is contained in:
Aleksey Kladov
2021-04-26 18:03:22 +03:00
parent 861fe48096
commit 7ad7543f89

View File

@ -81,12 +81,12 @@ impl Compiler for SinglepassCompiler {
let functions = function_body_inputs let functions = function_body_inputs
.iter() .iter()
.collect::<Vec<(LocalFunctionIndex, &FunctionBodyData<'_>)>>() .collect::<Vec<(LocalFunctionIndex, &FunctionBodyData<'_>)>>()
.par_iter() .into_par_iter()
.map(|(i, input)| { .map(|(i, input)| {
let middleware_chain = self let middleware_chain = self
.config .config
.middlewares .middlewares
.generate_function_middleware_chain(*i); .generate_function_middleware_chain(i);
let mut reader = let mut reader =
MiddlewareBinaryReader::new_with_offset(input.data, input.module_offset); MiddlewareBinaryReader::new_with_offset(input.data, input.module_offset);
reader.set_middleware_chain(middleware_chain); reader.set_middleware_chain(middleware_chain);
@ -107,7 +107,7 @@ impl Compiler for SinglepassCompiler {
&vmoffsets, &vmoffsets,
&memory_styles, &memory_styles,
&table_styles, &table_styles,
*i, i,
&locals, &locals,
) )
.map_err(to_compile_error)?; .map_err(to_compile_error)?;
@ -128,8 +128,7 @@ impl Compiler for SinglepassCompiler {
.signatures .signatures
.values() .values()
.collect::<Vec<_>>() .collect::<Vec<_>>()
.par_iter() .into_par_iter()
.cloned()
.map(gen_std_trampoline) .map(gen_std_trampoline)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_iter() .into_iter()
@ -138,7 +137,7 @@ impl Compiler for SinglepassCompiler {
let dynamic_function_trampolines = module let dynamic_function_trampolines = module
.imported_function_types() .imported_function_types()
.collect::<Vec<_>>() .collect::<Vec<_>>()
.par_iter() .into_par_iter()
.map(|func_type| gen_std_dynamic_import_trampoline(&vmoffsets, &func_type)) .map(|func_type| gen_std_dynamic_import_trampoline(&vmoffsets, &func_type))
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_iter() .into_iter()