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>
50 lines
1.8 KiB
Rust
50 lines
1.8 KiB
Rust
//! Phase 121: StepTree → Normalized shadow lowering (dev-only)
|
|
//!
|
|
//! ## Purpose
|
|
//!
|
|
//! Establish minimal route from StepTree (structure SSOT) to Normalized form,
|
|
//! verifying parity with existing router for if-only patterns.
|
|
//!
|
|
//! ## Scope
|
|
//!
|
|
//! - **if-only**: Support if statements without loops
|
|
//! - **loop rejection**: Reject loops via capability guard
|
|
//!
|
|
//! ## Design Rules
|
|
//!
|
|
//! **Input SSOT**:
|
|
//! - `StepTree` + `StepTreeContract` (no facts re-analysis)
|
|
//! - Lowering decisions based only on contract information
|
|
//!
|
|
//! **Output**:
|
|
//! - `JoinModule` (Normalized dialect)
|
|
//! - Or "Normalized-equivalent intermediate" expressed in existing JoinIR types
|
|
//!
|
|
//! **Execution conditions**:
|
|
//! - dev-only: Only runs when `joinir_dev_enabled()` returns true
|
|
//! - strict: Only fail-fast on mismatch when `joinir_strict_enabled()` returns true
|
|
//!
|
|
//! **Prohibitions**:
|
|
//! - No fallback: Shadow conversion failure logs reason in dev-only, fail-fast in strict
|
|
//! - No direct env reads (must go through `src/config/env/*`)
|
|
//! - No hardcoding (no branching on fixture names or variable names)
|
|
|
|
pub mod builder;
|
|
pub mod contracts;
|
|
pub mod normalized_verifier;
|
|
pub mod env_layout;
|
|
pub mod if_as_last_join_k;
|
|
pub mod loop_true_break_once; // Phase 131: loop(true) break-once
|
|
pub mod post_if_post_k; // Phase 129-C: post-if with post_k continuation
|
|
pub mod legacy;
|
|
pub mod dev_pipeline;
|
|
pub mod parity_contract;
|
|
pub mod available_inputs_collector; // Phase 126: available_inputs SSOT
|
|
pub mod exit_reconnector; // Phase 131 P1.5: Direct variable_map reconnection (Option B)
|
|
|
|
pub use builder::StepTreeNormalizedShadowLowererBox;
|
|
pub use contracts::{CapabilityCheckResult, UnsupportedCapability};
|
|
pub use parity_contract::{MismatchKind, ShadowParityResult};
|
|
pub use env_layout::EnvLayout;
|
|
pub use exit_reconnector::ExitReconnectorBox; // Phase 131 P1.5
|