fix(joinir): Use BTreeMap for MirModule.functions deterministic iteration
HashMap iteration order is non-deterministic due to HashDoS protection. This caused merge_joinir_mir_blocks to sometimes process functions in wrong order, leading to incorrect block remapping. Changed: - MirModule.functions: HashMap → BTreeMap - MirInterpreter.functions: HashMap → BTreeMap - IfLoweringDryRunner.scan_module: HashMap → BTreeMap parameter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
use super::{BasicBlock, BasicBlockId, EffectMask, MirInstruction, MirType, ValueId};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
use std::fmt;
|
||||
|
||||
/// Function signature for MIR functions
|
||||
@ -381,8 +381,8 @@ pub struct MirModule {
|
||||
/// Module name
|
||||
pub name: String,
|
||||
|
||||
/// Functions in this module
|
||||
pub functions: HashMap<String, MirFunction>,
|
||||
/// Functions in this module (BTreeMap for deterministic iteration order)
|
||||
pub functions: BTreeMap<String, MirFunction>,
|
||||
|
||||
/// Global constants/statics
|
||||
pub globals: HashMap<String, super::ConstValue>,
|
||||
@ -416,7 +416,7 @@ impl MirModule {
|
||||
pub fn new(name: String) -> Self {
|
||||
Self {
|
||||
name,
|
||||
functions: HashMap::new(),
|
||||
functions: BTreeMap::new(),
|
||||
globals: HashMap::new(),
|
||||
metadata: ModuleMetadata::default(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user