(
mut instructions: Vec<Instruction>,
function_data: &mut WasmFunctionData,
options: &ParserOptions,
function_results: ValueCounts,
self_func_addr: u32,
imported_memory_count:
| 9 | } |
| 10 | |
| 11 | pub(crate) fn optimize_instructions( |
| 12 | mut instructions: Vec<Instruction>, |
| 13 | function_data: &mut WasmFunctionData, |
| 14 | options: &ParserOptions, |
| 15 | function_results: ValueCounts, |
| 16 | self_func_addr: u32, |
| 17 | imported_memory_count: u32, |
| 18 | ) -> OptimizeResult { |
| 19 | let uses_local_memory = if options.optimize_rewrite() { |
| 20 | rewrite(&mut instructions, function_results, self_func_addr, imported_memory_count) |
| 21 | } else { |
| 22 | instructions.iter().any(|instr| instr.memory_addr().is_some_and(|mem| mem >= imported_memory_count)) |
| 23 | }; |
| 24 | |
| 25 | if options.optimize_remove_nop() { |
| 26 | remove_nop(&mut instructions, function_data); |
| 27 | } |
| 28 | OptimizeResult { instructions, uses_local_memory } |
| 29 | } |
| 30 | |
| 31 | fn rewrite( |
| 32 | instrs: &mut [Instruction], |
no test coverage detected