Summary
The move-decompiler's function output ordering is unstable because it depends on Symbol allocation order rather than bytecode definition order.
Sourcifier::print_module iterates module_env.get_functions() which traverses BTreeMap<FunId(Symbol), _>. Since Symbol indices are assigned in allocation order (a global usize counter), any change to the model builder that allocates symbols earlier or later (e.g. adding lemma support) shuffles the decompiler's function output order, causing baseline churn.
Suggested Fix
Use function_idx_to_id: BTreeMap<FunctionDefinitionIndex, FunId> to iterate functions in stable bytecode-definition order. Add a get_functions_in_def_order() method to ModuleEnv and use it in the sourcifier.
Key Files
third_party/move/move-model/src/sourcifier.rs:106 — iterates get_functions()
third_party/move/move-model/src/model.rs:3583 — get_functions() uses BTreeMap values (Symbol order)
third_party/move/move-model/src/model.rs:3151 — function_idx_to_id provides stable ordering
For tracking.
Summary
The move-decompiler's function output ordering is unstable because it depends on
Symbolallocation order rather than bytecode definition order.Sourcifier::print_moduleiteratesmodule_env.get_functions()which traversesBTreeMap<FunId(Symbol), _>. SinceSymbolindices are assigned in allocation order (a globalusizecounter), any change to the model builder that allocates symbols earlier or later (e.g. adding lemma support) shuffles the decompiler's function output order, causing baseline churn.Suggested Fix
Use
function_idx_to_id: BTreeMap<FunctionDefinitionIndex, FunId>to iterate functions in stable bytecode-definition order. Add aget_functions_in_def_order()method toModuleEnvand use it in the sourcifier.Key Files
third_party/move/move-model/src/sourcifier.rs:106— iteratesget_functions()third_party/move/move-model/src/model.rs:3583—get_functions()uses BTreeMap values (Symbol order)third_party/move/move-model/src/model.rs:3151—function_idx_to_idprovides stable orderingFor tracking.