Commit Graph

5 Commits

Author SHA1 Message Date
f42fcd33b4 refactor(joinir,smokes): Task 2,3,4 - instruction_rewriter boxification + OutputContract unification
Task 2: instruction_rewriter 分箱化
- Extract k_exit special case logic into TailCallLoweringPolicyBox
- Separate detect/collect/transform concerns into dedicated policy box
- Rewriter becomes pure transformation engine
- Added 5 unit tests for exit edge normalization
- New file: src/mir/builder/control_flow/joinir/merge/tail_call_lowering_policy.rs (212 lines)

Changes:
- instruction_rewriter.rs: Delegate k_exit detection to policy box (-50 lines)
- merge_result.rs: Add MirMergeResult struct for intermediate results
- Single responsibility principle: each box handles one concern

Task 3 & 4: smokes runner 改善
- Unify exit_code and numeric output verification into check_output_contract()
- Add require_joinir_dev() helper for dev-only fixture setup
- Reduce boilerplate in phase131_loop_true_break_once_*.sh scripts
- Consistent error message format across verification types

Changes:
- tools/smokes/v2/lib/llvm_exe_runner.sh: Add OutputContract interface (+90 lines)
- tools/smokes/v2/lib/test_runner.sh: Add require_joinir_dev() helper
- Phase 131 smoke scripts: Use new helpers (cleaner, less repetition)
- Build script: Improve TMPDIR configuration for EXDEV mitigation

Benefits:
- Single responsibility: policy box handles one concern
- Code reuse: OutputContract eliminates duplication
- Clarity: Smoke scripts are more concise and readable
- Maintainability: Easier to add new verification types

Test Results:
- Policy box unit tests: 5 PASS
- Smoke tests: 2/2 PASS
- No regression in existing functionality

Related: Phase 131 refactoring for improved code organization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-18 18:28:50 +09:00
02c4c313e5 feat(control_tree): Phase 131 P1.5-P2 DirectValue exit reconnection
Implement DirectValue mode for Normalized shadow exit handling:

**P1.5 Changes**:
- Add ExitReconnectMode::DirectValue (skip exit PHI generation)
- Carry remapped_exit_values through merge result
- Update host variable_map directly with exit values
- Fix loop(true) { x = 1; break }; return x to return 1 correctly

**P2 Changes**:
- Normalize k_exit continuation entry/exit edges
- Rewrite TailCall(k_exit) → Jump(exit_block) for proper merge
- Add verify_all_terminator_targets_exist contract check
- Extend ExitLineReconnector to handle DirectValue mode

**Infrastructure**:
- tools/build_llvm.sh: Force TMPDIR under target/ (EXDEV mitigation)
- llvm_exe_runner.sh: Add exit_code verification support
- Phase 131 smokes: Update for dev-only + exit code validation

**Contracts**:
- PHI-free: Normalized path uses continuations only
- Exit values reconnect via remapped ValueIds
- Existing patterns unaffected (既定挙動不変)

Related: Phase 131 loop(true) break-once Normalized support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-18 17:48:05 +09:00
46a623fd75 fix(llvm): make LLVM EXE smokes use workspace target and reliable build_llvm 2025-12-18 09:22:11 +09:00
4a109eb6b9 test(smokes): make LLVM EXE runner skip when object emit unavailable 2025-12-18 09:13:23 +09:00
e935b2324b test(smokes): dedupe LLVM EXE scripts via llvm_exe_runner 2025-12-17 21:24:59 +09:00