Skip to main content

dedup_subprograms

Function dedup_subprograms 

Source
pub fn dedup_subprograms(program: &Program) -> Arc<Program>
Expand description

Walk program and replace every Arc<Program> inside opcodes with a canonical Arc keyed by program_signature. Structurally-identical sub-programs end up pointing at the same allocation, reducing memory and enabling downstream caches to hit on the same key.

Returns a new Program with deduplicated sub-programs.