Commit Graph

1 Commits

Author SHA1 Message Date
a554109b8e refactor(phase27.13): Introduce ValueId range management system
Introduce centralized ValueId range allocation to prevent ID conflicts
between lowering modules.

Changes:
1. New file: src/mir/join_ir/lowering/value_id_ranges.rs
   - Base address constants for each lowering module
   - Helper functions: entry(offset), loop_step(offset)
   - Range validation test: test_value_id_ranges_no_overlap

2. Range allocation (resolved conflict):
   - min_loop:              1000-2999 (entry: 1000+, loop: 2000+)
   - skip_ws:               3000-4999 (entry: 3000+, loop: 4000+)
   - funcscanner_trim:      5000-6999 (entry: 5000+, loop: 6000+)
   - stage1_using_resolver: 7000-8999 (entry: 7000+, loop: 8000+) ← CHANGED

3. Updated stage1_using_resolver.rs to use value_id_ranges helpers
   - ValueId(5000) → vid::entry(0)  // 7000
   - ValueId(6000) → vid::loop_step(0)  // 8000

4. Updated lowering/mod.rs to include value_id_ranges module

Results:
-  Build success (warnings only, no errors)
-  Tests: 2/2 existing tests pass (type_sanity, empty_module_returns_none)
-  value_id_ranges test pass (range overlap validation)
-  ValueId conflict resolved (trim vs stage1_using_resolver)

Benefits:
- Centralized range management prevents conflicts
- Type-safe: const fn for compile-time calculation
- Self-documenting: comments clarify ranges
- Easy extension: future lowerings can use 9000+, 11000+, etc.
2025-11-24 03:58:30 +09:00