nyash-codex
447d4ea246
feat(llvm): Phase 132 - Pattern 1 exit value parity fix + Box-First refactoring
## Phase 132: Exit PHI Value Parity Fix
### Problem
Pattern 1 (Simple While) returned 0 instead of final loop variable value (3)
- VM: RC: 3 ✅ (correct)
- LLVM: Result: 0 ❌ (wrong)
### Root Cause (Two Layers)
1. **JoinIR/Boundary**: Missing exit_bindings → ExitLineReconnector not firing
2. **LLVM Python**: block_end_values snapshot dropping PHI values
### Fix
**JoinIR** (simple_while_minimal.rs):
- Jump(k_exit, [i_param]) passes exit value
**Boundary** (pattern1_minimal.rs):
- Added LoopExitBinding with carrier_name="i", role=LoopState
- Enables ExitLineReconnector to update variable_map
**LLVM** (block_lower.py):
- Use predeclared_ret_phis for reliable PHI filtering
- Protect builder.vmap PHIs from overwrites (SSOT principle)
### Result
- ✅ VM: RC: 3
- ✅ LLVM: Result: 3
- ✅ VM/LLVM parity achieved
## Phase 132-Post: Box-First Refactoring
### Rust Side
**JoinModule::require_function()** (mod.rs):
- Encapsulate function search logic
- 10 lines → 1 line (90% reduction)
- Reusable for Pattern 2-5
### Python Side
**PhiManager Box** (phi_manager.py - new):
- Centralized PHI lifecycle management
- 47 lines → 8 lines (83% reduction)
- SSOT: builder.vmap owns PHIs
- Fail-Fast: No silent overwrites
**Integration**:
- LLVMBuilder: Added phi_manager
- block_lower.py: Delegated to PhiManager
- tagging.py: Register PHIs with manager
### Documentation
**New Files**:
- docs/development/architecture/exit-phi-design.md
- docs/development/current/main/investigations/phase132-llvm-exit-phi-wrong-result.md
- docs/development/current/main/phases/phase-132/
**Updated**:
- docs/development/current/main/10-Now.md
- docs/development/current/main/phase131-3-llvm-lowering-inventory.md
### Design Principles
- Box-First: Logic encapsulated in classes/methods
- SSOT: Single Source of Truth (builder.vmap for PHIs)
- Fail-Fast: Early explicit failures, no fallbacks
- Separation of Concerns: 3-layer architecture
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 03:17:31 +09:00
..
2025-12-14 19:34:02 +09:00
2025-12-15 03:17:31 +09:00
2025-12-03 13:42:05 +09:00
2025-12-15 03:17:31 +09:00
2025-12-14 18:27:24 +09:00
2025-12-14 18:55:05 +09:00
2025-12-15 03:17:31 +09:00
2025-12-13 17:26:15 +09:00
2025-12-14 05:24:31 +09:00
2025-12-14 09:47:23 +09:00
2025-12-05 16:08:56 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 06:02:03 +09:00
2025-12-03 13:59:06 +09:00
2025-12-05 23:33:06 +09:00
2025-12-05 23:33:06 +09:00
2025-12-13 22:21:04 +09:00
2025-12-14 18:27:24 +09:00
2025-12-08 04:14:28 +09:00
2025-12-02 21:52:18 +09:00
2025-12-10 00:01:53 +09:00
2025-12-04 06:02:03 +09:00
2025-12-14 19:34:02 +09:00
2025-12-08 06:14:03 +09:00
2025-12-08 00:09:45 +09:00
2025-12-03 14:33:04 +09:00
2025-12-06 16:22:38 +09:00
2025-12-08 18:36:13 +09:00
2025-12-04 17:47:19 +09:00
2025-12-11 20:54:33 +09:00
2025-12-11 00:33:04 +09:00
2025-12-11 00:33:04 +09:00
2025-12-12 03:15:45 +09:00
2025-12-12 04:06:03 +09:00
2025-12-12 03:31:58 +09:00
2025-12-12 04:40:46 +09:00
2025-12-12 07:13:34 +09:00
2025-12-12 04:50:26 +09:00
2025-12-12 16:40:20 +09:00
2025-12-12 17:12:58 +09:00
2025-12-12 22:15:41 +09:00
2025-12-12 23:02:40 +09:00
2025-12-12 23:02:40 +09:00
2025-12-13 02:22:29 +09:00
2025-12-13 03:47:54 +09:00
2025-12-13 03:41:20 +09:00
2025-12-13 03:41:26 +09:00
2025-12-13 03:23:02 +09:00
2025-12-13 03:41:40 +09:00
2025-12-13 03:41:40 +09:00
2025-12-13 03:41:40 +09:00
2025-12-13 05:34:56 +09:00
2025-12-13 05:34:56 +09:00
2025-12-13 05:35:04 +09:00
2025-12-13 05:35:14 +09:00
2025-12-13 05:35:35 +09:00
2025-12-13 21:32:35 +09:00
2025-12-13 16:20:33 +09:00
2025-12-13 19:01:14 +09:00
2025-12-13 19:01:14 +09:00
2025-12-13 19:01:14 +09:00
2025-12-14 05:24:31 +09:00
2025-12-14 05:55:21 +09:00
2025-12-14 05:27:39 +09:00
2025-12-14 05:24:31 +09:00
2025-12-14 05:24:31 +09:00
2025-12-15 03:17:31 +09:00
2025-12-14 06:25:42 +09:00
2025-12-14 09:19:00 +09:00
2025-12-14 09:19:00 +09:00
2025-12-14 21:28:41 +09:00
2025-12-12 03:15:45 +09:00
2025-12-08 21:26:57 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-12 04:19:06 +09:00
2025-12-12 04:19:06 +09:00
2025-12-11 02:35:31 +09:00
2025-12-12 03:15:45 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 13:13:08 +09:00
2025-12-12 03:15:45 +09:00
2025-12-12 04:19:06 +09:00
2025-12-12 04:19:06 +09:00
2025-12-11 15:08:14 +09:00
2025-12-11 15:08:14 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-12 05:07:01 +09:00
2025-12-12 17:51:53 +09:00
2025-12-12 18:08:00 +09:00
2025-12-12 18:45:08 +09:00
2025-12-12 22:51:21 +09:00
2025-12-12 22:51:21 +09:00
2025-12-12 23:02:40 +09:00
2025-12-13 03:23:02 +09:00
2025-12-13 05:34:56 +09:00
2025-12-13 05:35:04 +09:00
2025-12-13 05:35:35 +09:00
2025-12-13 05:35:35 +09:00
2025-12-05 16:06:39 +09:00
2025-12-06 11:10:38 +09:00
2025-12-12 04:19:06 +09:00
2025-12-10 18:45:04 +09:00
2025-12-10 19:08:18 +09:00
2025-12-10 22:48:45 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 02:35:31 +09:00
2025-12-11 15:08:14 +09:00
2025-11-23 05:53:27 +09:00
2025-12-07 21:02:20 +09:00
2025-12-14 03:36:45 +09:00
2025-12-14 21:28:41 +09:00
2025-12-14 21:28:41 +09:00
2025-12-10 21:53:27 +09:00
2025-12-12 23:11:45 +09:00
2025-12-10 00:29:25 +09:00
2025-12-04 03:58:02 +09:00
2025-12-04 12:40:01 +09:00
2025-11-21 07:00:05 +09:00
2025-11-21 08:03:03 +09:00
2025-11-21 08:03:03 +09:00
2025-12-08 15:17:53 +09:00
2025-11-20 17:10:03 +09:00
2025-11-20 17:10:03 +09:00
2025-11-20 17:10:03 +09:00