af6f95cd4b
Phase 33 NORM canon test: enforce normalized dev route for P1/P2/JP mini
2025-12-11 20:54:33 +09:00
59a985b7fa
joinir: clean pattern visibility and refactor pattern2 pipeline
2025-12-11 19:11:26 +09:00
eb00d97fdb
feat(joinir): Phase 246-EX Part 2 - Exit PHI & step scheduling fixes
...
Phase 246-EX Part 2 completes the _atoi JoinIR integration:
Key fixes:
- Exit PHI connection: ExitLineReconnector now correctly uses exit PHI dsts
- Jump args preservation: BasicBlock.jump_args field stores JoinIR exit values
- instruction_rewriter: Reads jump_args, remaps JoinIR→HOST values by carrier order
- step_schedule.rs: New module for body-local init step ordering
Files changed:
- reconnector.rs: Exit PHI connection improvements
- instruction_rewriter.rs: Jump args reading & carrier value mapping
- loop_with_break_minimal.rs: Refactored step scheduling
- step_schedule.rs: NEW - Step ordering logic extracted
Tests: 931/931 PASS (no regression)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 17:16:10 +09:00
e356524b0a
feat(joinir): Phase 246-EX Part 1 - FromHost carrier infrastructure
...
Extends Phase 247-EX dual-value architecture for _atoi NumberAccumulation
support. Implements FromHost carrier handling throughout JoinIR pipeline.
## Problem Analysis
_atoi requires `result = result * 10 + digit_pos` where:
- digit_pos is promoted to dual carriers: is_digit_pos (bool) + digit_value (int)
- digit_value is used in NumberAccumulation but NOT updated itself
- Existing infrastructure filtered out carriers without updates
## Implementation
### 1. Carrier Filtering (pattern2_with_break.rs:507-514)
**Added FromHost retention**:
```rust
carrier_updates.contains_key(&carrier.name)
|| carrier.role == CarrierRole::ConditionOnly
|| carrier.init == CarrierInit::FromHost // Phase 247-EX
```
**Effect**: Keeps digit_value carrier despite no update expression
### 2. Carrier Update Passthrough (loop_with_break_minimal.rs:411-426)
**Added FromHost passthrough**:
- FromHost carriers without updates pass through from env
- Similar to Phase 227 ConditionOnly handling
- Logged as `[loop/carrier_update] Phase 247-EX: FromHost carrier passthrough`
### 3. Exit Bindings Collection (meta_collector.rs:156-172)
**Added FromHost exit_bindings inclusion**:
```rust
Some((CarrierRole::LoopState, CarrierInit::FromHost)) => {
// Include in exit_bindings for latch incoming
// Not for exit PHI or variable_map
}
```
**Effect**: digit_value gets latch incoming for header PHI
## Test Results
- **Before**: 931 tests PASS
- **After**: 931 tests PASS (0 regressions)
## Verification
**Phase 247-EX UpdateEnv working**:
```
[update_env/phase247ex] Resolved promoted 'digit_pos' → 'digit_value' (integer carrier): ValueId(111)
```
**NumberAccumulation MIR generated**:
```
%39 = %14 Mul %38 ← result * 10
%40 = %39 Add %9 ← tmp + digit_value
```
## Status
- ✅ Pattern2 classification
- ✅ NumberAccumulation detection
- ✅ dual-value carrier resolution
- ✅ FromHost carrier handling
- ⚠️ RC:0 issue (runtime value problem, Part 2)
## Related
- Phase 247-EX: DigitPos dual-value architecture (commit 8900a3cc )
- Phase 227: ConditionOnly carrier handling
- Phase 228-8: ConditionOnly exit_bindings
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-11 15:28:36 +09:00
8900a3cc44
feat(joinir): Phase 247-EX - DigitPos dual-value architecture
...
Extends DigitPos promotion to generate TWO carriers for Pattern A/B support:
- Boolean carrier (is_digit_pos) for break conditions
- Integer carrier (digit_value) for NumberAccumulation
## Implementation
1. **DigitPosPromoter** (loop_body_digitpos_promoter.rs)
- Generates dual carriers: is_<var> (bool) + <base>_value (int)
- Smart naming: "digit_pos" → "digit" (removes "_pos" suffix)
2. **UpdateEnv** (update_env.rs)
- Context-aware promoted variable resolution
- Priority: <base>_value (int) → is_<var> (bool) → standard
- Pass promoted_loopbodylocals from CarrierInfo
3. **Integration** (loop_with_break_minimal.rs)
- UpdateEnv constructor updated to pass promoted list
## Test Results
- **Before**: 925 tests PASS
- **After**: 931 tests PASS (+6 new tests, 0 failures)
## New Tests
- test_promoted_variable_resolution_digit_pos - Full dual-value
- test_promoted_variable_resolution_fallback_to_bool - Fallback
- test_promoted_variable_not_a_carrier - Error handling
## Impact
| Pattern | Before | After |
|---------|--------|-------|
| _parse_number | ✅ Works (bool only) | ✅ Works (bool used, int unused) |
| _atoi | ❌ Failed (missing int) | ✅ READY (int carrier available!) |
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-11 15:08:14 +09:00
d4597dacfa
feat(joinir): Phase 245C - Function parameter capture + test fix
...
Extend CapturedEnv to include function parameters used in loop conditions,
enabling ExprLowerer to resolve variables like `s` in `loop(p < s.length())`.
Phase 245C changes:
- function_scope_capture.rs: Add collect_names_in_loop_parts() helper
- function_scope_capture.rs: Extend analyze_captured_vars_v2() with param capture logic
- function_scope_capture.rs: Add 4 new comprehensive tests
Test fix:
- expr_lowerer/ast_support.rs: Accept all MethodCall nodes for syntax support
(validation happens during lowering in MethodCallLowerer)
Problem solved: "Variable not found: s" errors in loop conditions
Test results: 924/924 PASS (+13 from baseline 911)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 13:13:08 +09:00
00ecddbbc9
Add pattern router tests and tidy pattern4 lowering
2025-12-11 04:22:08 +09:00
d4f90976da
refactor(joinir): Phase 244 - ConditionLoweringBox trait unification
...
Unify condition lowering logic across Pattern 2/4 with trait-based API.
New infrastructure:
- condition_lowering_box.rs: ConditionLoweringBox trait + ConditionContext (293 lines)
- ExprLowerer implements ConditionLoweringBox trait (+51 lines)
Pattern migrations:
- Pattern 2 (loop_with_break_minimal.rs): Use trait API
- Pattern 4 (loop_with_continue_minimal.rs): Use trait API
Benefits:
- Unified condition lowering interface
- Extensible for future lowering strategies
- Clean API boundary between patterns and lowering logic
- Zero code duplication
Test results: 911/911 PASS (+2 new tests)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-11 02:35:31 +09:00
2dfe363365
refactor(joinir): Phase 242-EX-A - Delete legacy Pattern3 lowerer
...
Remove hardcoded Pattern3 PoC implementation (loop_with_if_phi_minimal.rs)
and enhance if-sum mode to handle complex conditions like `i % 2 == 1`.
Key changes:
- condition_pattern.rs: Accept BinaryOp in comparison operands (+58 lines)
- loop_with_if_phi_if_sum.rs: Dynamic complex condition lowering (+147 lines)
- pattern3_with_if_phi.rs: Remove lower_pattern3_legacy() (-130 lines)
- loop_with_if_phi_minimal.rs: Delete entire file (-437 lines)
- loop_patterns/with_if_phi.rs: Update stub (-45 lines)
- mod.rs: Remove module reference (-4 lines)
Net reduction: -664 lines of hardcoded PoC code
Test results: 909/909 PASS (legacy mode completely removed)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 01:27:08 +09:00
811dfebf98
fix(joinir): Phase 241-EX - Remove hardcoded 'sum' check from Pattern3
...
Remove legacy hardcoded 'sum' carrier validation that was blocking
array_filter patterns with different accumulator names (e.g., 'out').
Before: Pattern3 required carrier named 'sum' to exist
After: Pattern3 uses carrier_info generically (any carrier name works)
Test results:
- phase49_joinir_array_filter_smoke: PASS ✅
- phase49_joinir_array_filter_fallback: PASS ✅
- phase49_joinir_array_filter_ab_comparison: PASS ✅
- Full suite: 909/909 PASS, 0 FAIL
Also: Archive old roadmap documentation (67k lines moved to docs/archive/)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 00:48:42 +09:00
a7dbc15878
feat(joinir): Phase 240-EX - Pattern2 header condition ExprLowerer integration
...
Implementation:
- Add make_pattern2_scope_manager() helper for DRY
- Header conditions use ExprLowerer for supported patterns
- Legacy fallback for unsupported patterns
- Fail-Fast on supported patterns that fail
Tests:
- 4 new tests (all pass)
- test_expr_lowerer_supports_simple_header_condition_i_less_literal
- test_expr_lowerer_supports_header_condition_var_less_var
- test_expr_lowerer_header_condition_generates_expected_instructions
- test_pattern2_header_condition_via_exprlowerer
Also: Archive old phase documentation (34k lines removed)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 00:33:04 +09:00
448bf3d8c5
docs(joinir): Phase 232-239 documentation and ExprLowerer refinements
...
Documentation:
- Move completion reports to docs/archive/reports/
- Add phase232-238 design/inventory documents
- Update joinir-architecture-overview.md
- Add doc-status-policy.md
Code refinements:
- ExprLowerer: condition catalog improvements
- ScopeManager: boundary clarifications
- CarrierInfo: cleanup
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 00:21:29 +09:00
13a676d406
feat(joinir): Phase 231 - ExprLowerer/ScopeManager pilot implementation
...
Pilot implementation of unified expression lowering for Pattern2 break conditions:
New files:
- scope_manager.rs (280 lines) - ScopeManager trait + Pattern2ScopeManager
- expr_lowerer.rs (455 lines) - ExprLowerer with Condition context support
Features:
- Unified variable lookup across ConditionEnv/LoopBodyLocalEnv/CapturedEnv/CarrierInfo
- Pre-validation of condition AST before lowering
- Fail-safe design with fallback to legacy path
- 8 new unit tests (all pass)
Integration:
- Pattern2 break condition uses ExprLowerer for pre-validation
- Existing proven lowering path preserved
- Zero impact on existing functionality (890/897 tests pass)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 22:48:45 +09:00
b07329b37f
feat(joinir): Phase 224-E - DigitPos condition normalization
...
Add DigitPosConditionNormalizer to transform integer comparison to boolean:
- `digit_pos < 0` → `!is_digit_pos`
This eliminates the type error caused by comparing Bool carrier with Integer:
- Before: Bool(is_digit_pos) < Integer(0) → Type error
- After: !is_digit_pos → Boolean expression, no type mismatch
Implementation:
- New Box: digitpos_condition_normalizer.rs (173 lines)
- Pattern2 integration: normalize after promotion success
- 5 unit tests (all pass)
- E2E test passes (type error eliminated)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 22:10:28 +09:00
38e810d071
refactor(joinir): Phase 229 - Remove redundant ConditionAlias
...
Replace static alias mapping with dynamic condition variable resolution using:
- promoted_loopbodylocals as source of truth
- Naming conventions: is_<var> or is_<var>_match
- Pattern-aware inference during lowering
Benefits:
- Simpler data structure (6 fields → 5)
- Single source of truth
- Self-documenting with explicit naming conventions
- Fewer maintenance points
Net: -25 lines (60 additions, 85 deletions)
Tests: 877/884 PASS (no regressions)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 21:53:27 +09:00
717a50ceeb
feat(joinir): Phase 228-8 - ConditionOnly carrier latch incoming support
...
- ExitMetaCollector includes ConditionOnly carriers in exit_bindings (for latch)
- ExitLineReconnector skips ConditionOnly in variable_map updates
- Pattern 2/3/4 pass carrier_info to ExitMetaCollector
- Resolves "has no latch incoming set" error
Role separation:
- Header PHI: entry + latch for both LoopState and ConditionOnly
- Exit PHI: LoopState only (ConditionOnly excluded)
- variable_map: LoopState only (ConditionOnly skipped)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 21:30:03 +09:00
192620f842
feat(joinir): Phase 228 - CarrierInit for ConditionOnly header PHI initialization
...
- Add CarrierInit enum (FromHost/BoolConst) for explicit initialization policy
- LoopHeaderPhiBuilder generates Const instruction for BoolConst carriers
- merge/mod.rs uses carrier_info to include ALL carriers in header PHI
- Pattern 2/4 pass carrier_info to boundary builder
- ConditionOnly carriers (is_digit_pos) now included in header PHI
Remaining: latch incoming for ConditionOnly carriers (Phase 228-8)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 21:10:28 +09:00
478cc0012e
feat(joinir): Phase 227 - CarrierRole separation (LoopState vs ConditionOnly)
...
- Add CarrierRole enum to distinguish state carriers from condition-only carriers
- ConditionOnly carriers (is_digit_pos) skip exit PHI but keep header PHI
- Update all test struct literals with role field
- 877/884 tests PASS (7 pre-existing failures unrelated)
Remaining: ValueId(0) undefined - header PHI initialization for ConditionOnly
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 20:07:30 +09:00
d28e54ba06
feat(joinir): Phase 226 - Cascading LoopBodyLocal resolution
...
- Add LoopBodyLocalEnv to argument resolution in MethodCallLowerer
- Implement cascading lookup: LoopBodyLocalEnv → ConditionEnv
- Enable ch → digit_pos dependency chain in init expressions
- Resolves "Variable 'ch' not bound in ConditionEnv" error
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 19:29:03 +09:00
0243de871f
feat(joinir): Phase 225 - MethodCall init meta-driven lowering
...
- Remove hardcoded method whitelist from loop_body_local_init.rs
- Remove hardcoded box name matching
- Delegate to MethodCallLowerer for all MethodCall handling
- CoreMethodId metadata is now SSOT for init method validation
- substring now works in body-local init (-82 net lines)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 19:08:18 +09:00
4e00edcea5
feat(joinir): Phase 224-D - ConditionAlias for promoted variable resolution
...
- Add ConditionAlias type to CarrierInfo (old_name → carrier_name)
- Record aliases in DigitPosPromoter and TrimPatternInfo
- Resolve aliases in Pattern2 ConditionEnv building
- digit_pos now correctly resolves to is_digit_pos carrier
Fixes "Variable 'digit_pos' not bound in ConditionEnv" error.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 18:45:04 +09:00
8e3b55ddec
feat(joinir): Phase 224-C - MethodCallLowerer with argument support
...
- Add StringIndexOf to CoreMethodId (arity=1, return IntegerBox)
- Extend MethodCallLowerer to handle methods with arguments
- Add arity checking against CoreMethodId metadata
- Recursive argument lowering via lower_value_expression
- 8 unit tests PASS (indexOf, substring, arity mismatch)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 18:19:14 +09:00
250555bfc0
feat(joinir): Phase 224-B - MethodCallLowerer + CoreMethodId extension
...
- Extend CoreMethodId with is_pure(), allowed_in_condition(), allowed_in_init()
- New MethodCallLowerer box for metadata-driven MethodCall lowering
- Integrate MethodCall handling in condition_lowerer
- P0: Zero-argument methods (length) supported
- Design principle: NO method name hardcoding, CoreMethodId metadata only
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 17:59:24 +09:00
4cddca1cae
feat(joinir): Phase 224-cont - Promoted variable tracking for lowerer
...
- Add promoted_loopbodylocals field to CarrierInfo
- Record promoted variables in Pattern2 promotion handler
- Filter promoted variables in lowerer LoopBodyLocal check
- digit_pos → is_digit_pos promotion now continues to lowering
Closes Phase 224 lowerer integration gap.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 16:30:53 +09:00
00d1ec7cc5
feat(joinir): Phase 224 - DigitPosPromoter for A-4 pattern (core complete)
...
- New DigitPosPromoter Box for cascading indexOf pattern detection
- Two-tier promotion strategy: A-3 Trim → A-4 DigitPos fallback
- Unit tests 6/6 PASS (comparison operators, cascading dependency)
- Promotion verified: digit_pos → is_digit_pos carrier
⚠️ Lowerer integration gap: lower_loop_with_break_minimal doesn't
recognize promoted variables yet (Phase 224-continuation)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 16:21:01 +09:00
b5661c1915
feat(joinir): Phase 223.5 - LoopBodyCondPromoter Pattern2 integration
...
- Integrate LoopBodyCondPromoter into Pattern2 (break condition analysis)
- Add Pattern2 error message functions to error_messages.rs
- Create A-4 minimal test (phase2235_p2_digit_pos_min.hako)
- Unified promotion structure for Pattern2/Pattern4
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 16:20:44 +09:00
9b3d2bf001
refactor(joinir): Phase 223 cleanup - impl consolidation & comment cleanup
...
Improves code organization and readability after Phase 223-3 implementation.
## Task R-1: impl Block Consolidation
**loop_body_cond_promoter.rs**:
- Merged 2 separate impl blocks into single unified impl
- Added section headers for better organization:
- Public API (extract_continue_condition, try_promote_for_condition)
- Private Helpers (contains_continue)
- Improved logical flow and discoverability
## Task R-2: Phase Comment Cleanup
**pattern4_with_continue.rs**:
- Simplified Phase 223-3 comments (removed redundant phase numbers)
- Added concise section header explaining LoopBodyLocal promotion
- Clarified inline comments for better understanding
- Maintained implementation intent while reducing noise
## Impact
- No functional changes
- All tests PASS (5 cond_promoter tests, 8 pattern4 tests)
- Better code organization for future maintenance
- Cleaner git history for Phase 223
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-10 15:07:08 +09:00
89a769198a
feat(joinir): Phase 223-3 - LoopBodyCondPromoter implementation
...
Implements LoopBodyLocal condition promotion for Pattern4/continue patterns.
Previously, loops with LoopBodyLocal in conditions would Fail-Fast.
Now, safe Trim/skip_whitespace patterns (Category A-3) are promoted and lowering continues.
## Implementation
- **LoopBodyCondPromoter Box** (loop_body_cond_promoter.rs)
- extract_continue_condition(): Extract if-condition from continue branches
- try_promote_for_condition(): Thin wrapper delegating to LoopBodyCarrierPromoter
- ConditionPromotionRequest/Result API for Pattern2/4 integration
- **Pattern4 Integration** (pattern4_with_continue.rs)
- Analyze both header condition + continue condition
- On promotion success: merge carrier_info → continue lowering
- On promotion failure: Fail-Fast with clear error message
- **Unit Tests** (5 tests, all PASS)
- test_cond_promoter_skip_whitespace_pattern
- test_cond_promoter_break_condition
- test_cond_promoter_non_substring_pattern
- test_cond_promoter_no_scope_shape
- test_cond_promoter_no_body_locals
- **E2E Test** (phase223_p4_skip_whitespace_min.hako)
- Category A-3 pattern: local ch = s.substring(...); if ch == " " { continue }
- Verifies promotion succeeds and Pattern4 lowering proceeds
## Documentation
- joinir-architecture-overview.md: Updated LoopBodyCondPromoter section (Phase 223-3 完了)
- CURRENT_TASK.md: Added Phase 223-3 completion summary
- PHASE_223_SUMMARY.md: Phase overview and status tracking
- phase223-loopbodylocal-condition-*.md: Design docs and inventory
## Achievement
- **Before**: LoopBodyLocal in condition → Fail-Fast
- **Now**: Trim/skip_whitespace patterns promoted → Pattern4 lowering continues
- **Remaining**: Phase 172+ JoinIR Trim lowering for complete RC correctness
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-10 15:00:20 +09:00
9dbf053781
refactor(joinir): Phase 222.5-E - Merge/Boundary HashMap → BTreeMap
...
Convert 10 medium-priority locations to BTreeMap for determinism:
Merge System (6 locations):
- instruction_rewriter.rs: value_to_func_name, function_params,
function_entry_map, local_block_map
- value_collector.rs: value_to_func_name, function_params,
function_entry_map
ID Remapper (2 locations):
- joinir_id_remapper.rs: block_map, value_map
Boundary Injector (2 locations):
- joinir_inline_boundary_injector.rs: value_map (param & return)
Impact:
- Changed files: 4
- Changed lines: +36, -24 (net +12)
- Tests: 849/856 PASS (no regression)
- Determinism: Merge/Boundary processing now deterministic
Combined with Phase 222.5-D (13 high-priority locations),
JoinIR pipeline now uses BTreeMap uniformly across all
critical paths (Pattern/Merge/Boundary/ValueId allocation).
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-10 14:09:18 +09:00
948cc68889
refactor(joinir): Phase 222.5 - Modularization & Determinism
...
Phase 222.5-B: ConditionEnv API Unification
- Remove deprecated build_loop_param_only() (v1)
- Unify build_with_captures() to use JoinValueSpace (v2 API)
- Code reduction: -17 lines
- Tests: 5/5 PASS
Phase 222.5-C: exit_binding.rs Modularization
- Split into 4 modules following Phase 33 pattern:
- exit_binding_validator.rs (171 lines)
- exit_binding_constructor.rs (165 lines)
- exit_binding_applicator.rs (163 lines)
- exit_binding.rs orchestrator (364 lines, -71 reduction)
- Single responsibility per module
- Tests: 16/16 PASS
Phase 222.5-D: HashMap → BTreeMap for Determinism
- Convert 13 critical locations to BTreeMap:
- exit_binding (3), carrier_info (2), pattern_pipeline (1)
- loop_update_analyzer (2), loop_with_break/continue (2)
- pattern4_carrier_analyzer (1), condition_env (2)
- Deterministic iteration guaranteed in JoinIR pipeline
- Inventory document: phase222-5-d-hashmap-inventory.md
- Tests: 849/856 PASS (7 pre-existing failures)
- Determinism verified: 3-run consistency test PASS
Overall Impact:
- Code quality: Single responsibility, function-based design
- Determinism: JoinIR pipeline now uses BTreeMap uniformly
- Tests: All Phase 222.5 tests passing
- Documentation: Complete inventory & implementation plan
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-10 13:59:23 +09:00
bcdad203f0
feat(joinir): Phase 222-3 if-sum normalization integration
...
Phase 222: If Condition Normalization - Part 3
Goal: Integrate normalization into if-sum pattern detection and lowering
Changes:
1. pattern_pipeline.rs (is_if_sum_pattern):
- Updated to use analyze_condition_pattern() + normalize_comparison()
- Added two-step validation:
(a) Pattern must be SimpleComparison
(b) Condition must be normalizable
- Replaced is_simple_comparison() with Phase 222 API
2. loop_with_if_phi_if_sum.rs (extract_loop_condition):
- Added Phase 222 normalization
- Normalize condition to canonical form (var on left)
- Support both literal and variable on right-hand side
- Added mir::CompareOp → join_ir::CompareOp conversion
- Handles:
* Phase 219: var CmpOp literal (e.g., i > 0)
* Phase 222: literal CmpOp var (e.g., 0 < i) → normalized
* Phase 222: var CmpOp var (e.g., i > j)
Status: Integration complete, ready for E2E testing
Next: Phase 222-4 - verify regression tests and add new test cases
2025-12-10 09:23:44 +09:00
f0536fa330
feat(joinir): Phase 222-2 ConditionPatternBox normalization implementation
...
Phase 222: If Condition Normalization - Part 2
Goal: Support '0 < i', 'i > j' patterns in addition to 'i > 0'
Changes:
1. condition_pattern.rs (+160 lines):
- Added ConditionValue enum (Variable | Literal)
- Added NormalizedCondition struct (left_var, op, right)
- Added flip_compare_op() for operator reversal
- Added binary_op_to_compare_op() converter
- Added normalize_comparison() main normalization function
- Extended analyze_condition_pattern() to accept 3 cases:
* Phase 219: var CmpOp literal (e.g., i > 0)
* Phase 222: literal CmpOp var (e.g., 0 < i) → normalized
* Phase 222: var CmpOp var (e.g., i > j)
- Added 9 unit tests (all passing)
2. loop_update_summary.rs (cleanup):
- Commented out obsolete test_typical_index_names
- Function is_typical_index_name() was removed in earlier phase
Test results:
- 7 normalization tests: PASS ✅
- 2 pattern analysis tests: PASS ✅
Next: Phase 222-3 - integrate normalization into is_if_sum_pattern()
Status: Ready for integration
2025-12-10 09:18:21 +09:00
33e80637dd
refactor(joinir): Phase 221-R ExprResultResolver Box extraction
...
Extracted 64 lines of expr_result handling from merge/mod.rs into
dedicated ExprResultResolver Box following Phase 33 modularization.
- New module: expr_result_resolver.rs (185 lines, 4 unit tests)
- merge/mod.rs: -37 lines (net reduction)
- Single responsibility: expr_result resolution only
- Improved testability and maintainability
Phase 221-R completes the box-first refactoring of Phase 221's
expr_result routing implementation, aligning with Phase 33
modularization patterns (ExitMetaCollector, ExitLineReconnector).
Test results:
✅ phase212_if_sum_min.hako: RC=2
✅ loop_if_phi.hako: sum=9 (legacy mode)
✅ loop_min_while.hako: correct output
2025-12-10 04:23:34 +09:00
9913cdc786
feat(joinir): Phase 220-D loop condition variable support complete
...
Modified extract_loop_condition() to use ConditionEnv for variable lookup:
- Now returns ValueId instead of i64 for loop limit
- Uses lower_value_expression() for both literals and variables
- Integrated ConditionEnvBuilder in Pattern 3 if-sum path
This enables realistic loop patterns like `loop(i < len)` in if-sum.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 04:10:05 +09:00
d0d2a30c56
fix(joinir): Phase 219 regression fix - ConditionPatternBox
...
Introduced ConditionPatternBox to detect if condition complexity:
- Simple comparisons (var CmpOp literal): use AST-based if-sum lowerer
- Complex conditions (BinaryOp, etc.): fallback to legacy P3 lowerer
This fixes loop_if_phi.hako which was broken by Phase 219's
is_if_sum_pattern() changes.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 03:54:17 +09:00
8f7c6c5637
feat(joinir): Phase 221 ExprResult routing in merge pipeline
...
- Add expr_result handling in merge_joinir_mir_blocks
- When expr_result matches a carrier, return carrier PHI dst
- Enables expr-position loops to properly return accumulator values
Note: Phase 219 regression (loop_if_phi.hako) to be fixed in next commit
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 03:47:23 +09:00
757ba6b877
fix(joinir): Phase 220-C condition variable remap and self-copy skip
...
- Pre-populate remap with condition_bindings (join_value → host_value)
- Skip self-copy param bindings to avoid `%6 = copy %6`
- ConditionEnv remap verified: ValueId(101) → ValueId(6) correctly
Note: RC=0 issue remains - ExprResult routing to be investigated in Phase 221
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 03:20:09 +09:00
2fc2cf74d1
feat(joinir): Phase 220-B ConditionEnv integration for if-sum lowerer
...
Integrates ConditionEnv infrastructure into if-sum lowerer to support
variable conditions like `loop(i < len)`.
## Implementation (Following Pattern 2)
### ConditionEnv Construction
- Added early construction via ConditionEnvBuilder::build_for_break_condition_v2()
- Extracts condition variables from loop condition AST
- Creates ConditionBindings for HOST↔JoinIR ValueId mapping
### Variable Support
- Created ValueOrLiteral enum (Literal(i64) | Variable(String, ValueId))
- Added extract_value_or_variable() with ConditionEnv lookup
- Updated extract_loop_condition() and extract_if_condition()
### JoinIR Generation Updates
- Condition-only variables as loop_step function parameters
- Proper parameter passing in recursive calls
- Condition ValueIds in JoinIR param region (100+)
### Boundary Builder Wiring
- Pass condition_bindings to JoinInlineBoundaryBuilder
- Updated call site in pattern3_with_if_phi.rs
- Added variable_map, loop_var_name, loop_var_id parameters
## Build Status
✅ Compilation successful (0 errors, 3 warnings)
## Test Status
⏳ Tests not yet passing - remap issue identified:
- HOST: len = ValueId(6)
- JoinIR: len = ValueId(101)
- After Merge: len = ValueId(10) ❌
Root cause: JoinIRConversionPipeline remap needs investigation
## Files Modified
- src/mir/join_ir/lowering/loop_with_if_phi_if_sum.rs (+80 lines)
- ConditionEnv construction
- Variable support in conditions
- Updated function signatures
- src/mir/builder/control_flow/joinir/patterns/pattern3_with_if_phi.rs (+10 lines)
- Pass builder/loop_var to lowerer
- Wire condition_bindings
## Design Principles
1. Reuse Existing Boxes (ConditionEnv/ConditionBinding)
2. Follow Pattern 2 Structure (proven blueprint)
3. Fail-Fast (variable not in ConditionEnv → error)
4. ParamRole::Condition Routing (separate from carriers)
## Next Steps: Phase 220-C
Fix remap issue in JoinIRConversionPipeline to properly use
condition_bindings.host_value during merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-10 02:54:56 +09:00
e6e306c020
fix(joinir): Phase 219 Phantom Carrier Bug fix complete
...
Fixes phantom carrier detection that blocked AST-based if-sum lowerer.
## Problem
Name-based heuristic in loop_update_summary.rs created phantom "count"
carrier even when variable didn't exist, causing:
1. counter_count() = 2 (i + phantom "count") instead of 1
2. is_simple_if_sum_pattern() = false
3. AST-based lowerer never activates (falls back to legacy)
4. Result: RC=0 instead of expected values
## Solution
Assignment-based carrier detection:
### New API (recommended)
```rust
pub fn analyze_loop_updates_from_ast(
loop_body_ast: &[ASTNode]
) -> LoopUpdateSummary
```
- Extracts only variables with actual assignments in loop body
- Classifies by RHS structure (not name)
- Eliminates phantom carriers completely
### Changes
1. **Added**: `extract_assigned_variables()` - AST walker for assignments
2. **Added**: `find_assignment_rhs()` - RHS expression extraction
3. **Added**: `classify_update_kind_from_rhs()` - Structure-based classification
4. **Added**: `is_likely_loop_index()` - Name heuristic for disambiguation
5. **Deprecated**: `analyze_loop_updates()` - Legacy name-based API (3 call sites remain)
### Verification
Before:
```
variable_map = {i, sum, defs, len}
→ Phantom "count" detected
→ counter_count() = 2
→ is_simple_if_sum_pattern() = false
```
After:
```
assigned_vars = {i, sum} // Only assigned!
→ No phantom carriers
→ counter_count() = 1
→ accumulation_count() = 1
→ is_simple_if_sum_pattern() = true ✅
```
## Files Modified
**Core Fix**:
- src/mir/join_ir/lowering/loop_update_summary.rs (+116 lines)
- New assignment-based API
- Phantom carrier elimination
**Integration**:
- src/mir/builder/control_flow/joinir/patterns/pattern_pipeline.rs (+3 lines)
- Updated is_if_sum_pattern() to use new API
## Test Results
- ✅ Phantom carrier bug fixed
- ✅ AST lowerer activates correctly
- ⚠️ 3 deprecation warnings (expected, legacy call sites)
- ⏳ phase212/218 still RC=0 (blocked by condition variable support)
## Design Principles
1. **No Phantom Carriers**: Only variables with actual assignments
2. **Assignment-Based Detection**: LHS from AST assignments only
3. **Structure-Based Classification**: RHS patterns + name disambiguation
## Next Steps
Phase 220: Condition variable extraction and wiring to enable
phase212/218 tests to pass with correct RC values.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-10 02:30:14 +09:00
e2508f9f08
feat(joinir): Phase 215-2 ExprResult exit contract for Pattern 3
...
Implements Phase 215 Task 215-2: Wire expr_result exit line through
ExitMeta → JoinInlineBoundary → ExitLine → MIR return for Pattern 3.
## Changes
### Fix 1: JoinIR Lowerer (loop_with_if_phi_if_sum.rs:312)
- Changed `carrier_only()` → `with_expr_result(sum_final, exit_meta)`
- Marks sum final value as expr_result for propagation
### Fix 2: Boundary Builder (pattern3_with_if_phi.rs:176-191)
- Added `.with_expr_result(Some(expr_id))` to JoinInlineBoundaryBuilder
- Passes expr_result to boundary for ExitLineReconnector
### Fix 3: Final Return (pattern3_with_if_phi.rs:195-219)
- Changed from always returning Void to conditional return:
- Expr-position loops: Return merge_result ValueId
- Statement-position loops: Return Void
- Matches Pattern 2 behavior
## Test Results
Primary target:
- phase212_if_sum_min.hako: RC=2 achieved ✅
Regression tests:
- loop_if_phi.hako: RC=2 (existing behavior maintained) ✅
- Pattern 1/2/3 tests: All PASS ✅
## Architecture
Pattern 3 now follows the same ExprResult Exit Contract as Pattern 2:
1. JoinIR lowerer creates expr_result with `with_expr_result()`
2. Boundary builder passes expr_result with `.with_expr_result()`
3. Conversion pipeline returns merge result containing exit PHI ValueId
4. Pattern dispatcher conditionally returns expr_result or Void
This enables:
- Expr-position loops: Loop result propagates to caller
- Statement-position loops: Loop updates variable_map only (returns Void)
- Unified contract: Patterns 2 and 3 follow same expr_result flow
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-10 01:40:18 +09:00
272d99f3de
feat(joinir): Phase 214 Pattern 3 join_inputs dynamic generation
...
Fix RC=0 bug by implementing dynamic join_inputs generation based on
actual exit_bindings rather than hardcoded 3 inputs.
Root Cause:
- Pattern 3 if-sum mode used hardcoded join_inputs = [0, 1, 2]
- Actual carrier count varies (2 for i+sum, 3 for i+sum+count)
- PHI dst mapping failed due to input count mismatch
Solution:
- Generate join_inputs based on exit_bindings.len()
- total_inputs = 1 (loop_var) + exit_bindings.len()
- Apply to both if-sum and legacy modes
- Add fail-fast validation assertion
Test Results:
- loop_if_phi.hako: sum=9 ✓ (correct calculation)
- MIR structure: bb4 (header PHI) ← bb13 (loop back) ✓
- Build: 0 errors, 0 warnings ✓
Note: RC still 0 - investigate return value handling in Phase 215+
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 01:12:03 +09:00
338d1aecf1
feat(joinir): Phase 213 AST-based if-sum lowerer for Pattern 3
...
Implement dual-mode architecture for Pattern 3 (Loop with If-Else PHI):
- Add is_simple_if_sum_pattern() detection helper
- Detects 1 CounterLike + 1-2 AccumulationLike carrier patterns
- Unit tests for various carrier compositions
- Add dual-mode dispatch in Pattern3 lowerer
- ctx.is_if_sum_pattern() branches to AST-based vs legacy PoC
- Legacy mode preserved for backward compatibility
- Create loop_with_if_phi_if_sum.rs (~420 lines)
- AST extraction: loop condition, if condition, updates
- JoinIR generation: main, loop_step, k_exit structure
- Helper functions: extract_loop_condition, extract_if_condition, etc.
- Extend PatternPipelineContext for Pattern 3
- is_if_sum_pattern() detection using LoopUpdateSummary
- extract_if_statement() helper for body analysis
Note: E2E RC=2 not yet achieved due to pre-existing Pattern 3
pipeline issue (loop back branch targets wrong block). This
affects both if-sum and legacy modes. Fix planned for Phase 214.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 00:54:46 +09:00
8394018694
refactor(joinir): Pattern 3 ExitMeta化 - Hardcoded ValueIds削除
...
Refactoring 5.1: Pattern 3 を Pattern 4 と同じ ExitMeta ベースアーキテクチャに統一化
Changes:
1. loop_with_if_phi_minimal.rs
- 署名: Option<JoinModule> → Result<(JoinModule, JoinFragmentMeta), String>
- ExitMeta 動的生成ロジック追加(sum, count)
- インポート追加: carrier_info::{ExitMeta, JoinFragmentMeta}
2. pattern3_with_if_phi.rs
- Hardcoded 定数削除(PATTERN3_K_EXIT_*_ID 2個削除)
- Manual exit binding 42行 → ExitMetaCollector 4行に置き換え
- インポート追加: ExitMetaCollector
3. loop_patterns/with_if_phi.rs
- Result型変更に対応(.ok()? で変換)
Benefits:
- Pattern 3/4 アーキテクチャ統一化 ✅
- 19行純削減(+55 -74行、3ファイル合計) ✅
- Hardcoded ValueIds 完全撤廃 ✅
- Phase 213 AST-based generalization の基盤強化 ✅
Tests: All tests passing, loop_if_phi.hako outputs "sum=9" correctly
2025-12-10 00:29:25 +09:00
d7805e5974
feat(joinir): Phase 213-2 Step 2-2 & 2-3 Data structure extensions
...
Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization.
Changes:
1. PatternPipelineContext:
- Added loop_condition: Option<ASTNode>
- Added loop_body: Option<Vec<ASTNode>>
- Added loop_update_summary: Option<LoopUpdateSummary>
- Updated build_pattern_context() for Pattern 3
2. CarrierUpdateInfo:
- Added then_expr: Option<ASTNode>
- Added else_expr: Option<ASTNode>
- Updated analyze_loop_updates() with None defaults
Status: Phase 213-2 Steps 2-2 & 2-3 complete
Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
2025-12-10 00:01:53 +09:00
aeb6282c2d
feat(joinir): Phase 212.5 Structural if detection for Pattern 3 routing
...
Phase 212.5 で発見した「ループ内 if が Pattern 1 に誤ルーティング」問題を修正。
構造ベース if 検出により、単一キャリアの if-update パターンも Pattern 3 へ正しくルーティング可能に。
## Changes
### 1. AST Feature Extractor (ast_feature_extractor.rs)
- **Added**: `detect_if_in_body()` function
- Detects ANY if statement in loop body (not just if-else)
- Enables structural if detection vs carrier-count heuristic
- **Modified**: `extract_features()`
- Uses `detect_if_in_body()` for `has_if` detection
- Removes dependency on carrier count for if detection
### 2. Loop Pattern Classification (loop_pattern_detection/mod.rs)
- **Modified**: `classify()` function
- Pattern 3: `carrier_count > 1` → `has_if && carrier_count >= 1`
- Pattern 1: `!has_if_else_phi` → `!has_if`
- Now routes single-carrier if-update patterns to Pattern 3
## Verification
Test case: `apps/tests/phase212_if_sum_min.hako`
### Before (Phase 212):
- ❌ Routed to Pattern 1 (wrong)
- ❌ if statement disappeared in MIR
- ❌ Carriers: only `i` (sum missing)
### After (Phase 212.5):
- ✅ Routed to Pattern 3 (correct!)
- ✅ MIR contains PHI nodes: `%31 = phi [%25, bb9], [%29, bb10]`
- ✅ Carriers: `i`, `sum`, `count` detected
Pattern routing log:
```
[joinir/pattern3] Generated JoinIR for Loop with If-Else PHI
[joinir/pattern3] Carriers: i (counter), sum (accumulator), count (counter)
```
## Known Limitation
Pattern 3 lowerer (`lower_loop_with_if_phi_pattern`) is currently a
test-only hardcoded implementation:
- Loop condition: `i <= 5` (hardcoded)
- If condition: `i % 2 == 1` (hardcoded)
- Update logic: `sum + i` (hardcoded)
This is why `phase212_if_sum_min.hako` produces RC=0 instead of RC=2.
Pattern routing is complete; AST-based lowerer generalization is Phase 213.
## Documentation
- `docs/development/current/main/phase212-5-implementation-complete.md`
- Complete implementation report with verification details
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 23:35:57 +09:00
4c323b709e
feat(refactor): Phase 205-A - Improve carrier_update_emitter test structure
...
- Reorganized test module with cleaner import structure
- Added explicit imports for test dependencies (UpdateRhs, BinOpKind, ValueId)
- Verified all 12 carrier_update tests pass with new structure
- Preparation for further refactoring (mir_json_emit duplication remains for Phase 205-B)
Phase 205 Progress:
✅ Task 205-1: Analyzed 7 major files (mir_json_emit, strip, carrier_update_emitter, etc.)
✅ Task 205-2: Reorganized carrier_update_emitter tests (12/12 PASS)
⏳ Task 205-A-1: mir_json_emit function unification deferred (requires trait-based generics)
⏳ Task 205-B: Additional refactorings (strip.rs, function_scope_capture, etc.)
Test Results: 12/12 carrier_update tests passing
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-09 20:10:52 +09:00
76a36333c2
feat(joinir): Phase 204 PHI Contract Verifier complete
...
Phase 204-3/5/6/7: PHI inputs verification, integration, testing, docs
Implementation:
- verify_phi_inputs_defined(): Conservative sanity checks (ValueId < 100000)
- Integration: All verifiers in verify_joinir_contracts()
- Testing: 821 tests PASS, no regressions
Task Status:
- ✅ 204-1: Design document (phase204-phi-contract-verifier.md)
- ✅ 204-2: PHI dst overwrite detection
- ✅ 204-3: PHI inputs sanity checks
- ⚠️ 204-4: JoinValueSpace region verification (deferred to Phase 205+)
- Rationale: Requires LoopHeaderPhiInfo extension (4+ files)
- Alternative: Conservative threshold checks in verify_phi_inputs_defined()
- ✅ 204-5: Integration (verify_joinir_contracts)
- ✅ 204-6: Tests (821 PASS)
- ✅ 204-7: Documentation (phase204 doc + CURRENT_TASK.md)
Verification Coverage:
- ✅ PHI exists (Phase 200-3)
- ✅ PHI dst match (Phase 200-3)
- ✅ PHI dst not overwritten (Phase 204-2) ✨
- ✅ PHI inputs sanity (Phase 204-3) ✨
- ⚠️ PHI inputs DFA (Phase 205+)
- ⚠️ ValueId regions (Phase 205+)
Design Principles:
- Debug-only (#[cfg(debug_assertions)])
- Fail-Fast (panic on violation)
- Zero cost in release builds
Files Modified:
- src/mir/builder/control_flow/joinir/merge/mod.rs (+115 lines)
- src/mir/builder/control_flow/joinir/merge/exit_line/reconnector.rs (1 line)
- docs/development/current/main/phase204-phi-contract-verifier.md (updated)
- CURRENT_TASK.md (Phase 204 complete)
Success Criteria: 4/5 met (1 deferred with rationale)
2025-12-09 19:57:32 +09:00
0175e62d9e
feat(joinir): Phase 204-2 PHI dst overwrite detection
...
Task 204-2: Implement verify_no_phi_dst_overwrite()
- Added PHI dst overwrite detection in merge/mod.rs
- Helper get_instruction_dst() extracts dst from MirInstruction
- Integrated into verify_joinir_contracts()
- Fixed pre-existing bugs:
- entry_block_remapped → entry_block (line 592)
- HashMap → BTreeMap in reconnector.rs (line 174)
- All instructions covered with wildcard pattern
Design:
- Debug-only (#[cfg(debug_assertions)])
- Fail-Fast panic on violation
- Checks PHI dst not overwritten by later instructions in header block
Status: Build SUCCESS (Task 204-2 complete)
Next: Task 204-3 (PHI inputs verification)
2025-12-09 19:53:33 +09:00
de9fe3bf85
chore(joinir): Phase 203-A remove dead code after JoinValueSpace unification
...
Remove obsolete v1 API and unused imports after Phase 201-202 JoinValueSpace unification.
Changes:
- Remove v1 API build_for_break_condition() (70 lines)
- Converted 3 unit tests to v2 API (build_for_break_condition_v2)
- Updated module documentation to reflect v2 as standard
- Remove 2 unused imports (JoinValueSpace, ValueId)
- inline_boundary_builder.rs: Remove unused JoinValueSpace import
- loop_with_if_phi_minimal.rs: Remove unused ValueId import
- Document stub function (lower_loop_with_break_to_joinir)
- Add Phase 203-A documentation clarifying stub status
- Explain why stub exists and migration options
- Kept stub as it's called by router (line 148 in loop_pattern_router.rs)
Stats:
- 4 files changed
- 75 net lines removed (117 deletions, 42 insertions)
- All tests passing (821 passed)
- Build clean with no errors
Related:
- Phase 201: JoinValueSpace unified ValueId allocation
- Phase 202: Pattern 2 conversion to v2 API
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 19:33:38 +09:00
ae741d97b4
feat(joinir): Phase 202-C Pattern 4 uses JoinValueSpace, unify dual counters
...
# Summary
Pattern 4 (Continue) now uses JoinValueSpace for unified ValueId allocation,
eliminating the dual counter system that was prone to ValueId collisions.
# Changes
- loop_with_continue_minimal.rs: Replace value_counter + join_value_counter with JoinValueSpace
- Param region (100+): ConditionEnv variables
- Local region (1000+): All intermediate values (Const, BinOp, etc.)
- Eliminated manual counter management (value_counter = 0u32, join_value_counter++)
- pattern4_with_continue.rs: Create JoinValueSpace and pass to lowerer
- Added Phase 202-C documentation explaining the unification
# Test Results
✅ cargo test --release --lib continue: 11 passed (3 ignored)
✅ E2E apps/tests/loop_continue_pattern4.hako → 25 (single carrier)
✅ E2E apps/tests/loop_continue_multi_carrier.hako → 100, 10 (multi carrier)
# Benefits
- No ValueId collision risk (disjoint regions)
- Consistent with Pattern 2 architecture (Phase 201)
- Simplified allocation logic (no manual counter tracking)
- Better maintainability (single source of truth)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 19:20:46 +09:00