Wasm: sort and deduplicate on each round of live function tracing

This commit is contained in:
Brian Carroll 2022-01-12 19:33:38 +00:00
parent 9dabc2db15
commit 6b204d11a2
2 changed files with 5 additions and 1 deletions

View file

@ -96,7 +96,8 @@ pub fn build_module_help<'a>(
let initial_module = WasmModule::preload(env.arena, preload_bytes);
// Adjust Wasm function indices to account for functions from the object file
let fn_index_offset: u32 = initial_module.import.function_count + initial_module.code.preloaded_count;
let fn_index_offset: u32 =
initial_module.import.function_count + initial_module.code.preloaded_count;
// Get a map of name to index for the preloaded functions
// Assumes the preloaded object file has all symbols exported, as per `zig build-lib -dymamic`

View file

@ -140,6 +140,9 @@ pub fn trace_function_deps<'a, Indices: IntoIterator<Item = u32>>(
if next_trace.is_empty() {
break;
}
next_trace.sort_unstable();
next_trace.dedup();
current_trace.clone_from(&next_trace);
next_trace.clear();
}