(
job: PendingFunction<'_>,
options: &ParserOptions,
func_types: &[Arc<FuncType>],
imported_func_count: usize,
imported_memory_count: u32,
)
| 59 | } |
| 60 | |
| 61 | fn process_function_job( |
| 62 | job: PendingFunction<'_>, |
| 63 | options: &ParserOptions, |
| 64 | func_types: &[Arc<FuncType>], |
| 65 | imported_func_count: usize, |
| 66 | imported_memory_count: u32, |
| 67 | ) -> Result<(usize, FunctionCode)> { |
| 68 | let validator = job.func_to_validate.into_validator(FuncValidatorAllocations::default()); |
| 69 | let (code, _, _) = match job.body { |
| 70 | FunctionBodyInput::Borrowed(func) => conversion::convert_module_code(func, validator, Default::default())?, |
| 71 | FunctionBodyInput::Owned(body) => { |
| 72 | let reader = wasmparser::BinaryReader::new(&body.section_bytes[body.body_range], body.body_offset); |
| 73 | let func = wasmparser::FunctionBody::new(reader); |
| 74 | conversion::convert_module_code(func, validator, Default::default())? |
| 75 | } |
| 76 | }; |
| 77 | |
| 78 | let ty = func_types.get(job.ty_idx as usize).expect("No func type for func, this is a bug"); |
| 79 | let code = optimize_function_code( |
| 80 | code, |
| 81 | options, |
| 82 | ValueCounts::from_iter(ty.results()), |
| 83 | (imported_func_count + job.ordinal) as u32, |
| 84 | imported_memory_count, |
| 85 | ); |
| 86 | |
| 87 | Ok((job.ordinal, code)) |
| 88 | } |
| 89 | |
| 90 | pub(crate) fn process_pending( |
| 91 | pending: Vec<PendingFunction<'_>>, |
no test coverage detected