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>
This commit is contained in:
nyash-codex
2025-12-18 17:48:05 +09:00
parent bfac188732
commit 02c4c313e5
19 changed files with 973 additions and 93 deletions

View File

@ -46,6 +46,15 @@ fi
# Use the cargo target dir when set (helps LLVM EXE smokes that build under /tmp).
CARGO_TARGET_DIR_EFFECTIVE="${CARGO_TARGET_DIR:-$PWD/target}"
# Rust builds (especially rmeta/rlib finalization) may fail with EXDEV when the temp dir
# is not compatible with the output directory. Prefer a temp dir under the final output
# folder so rustc can atomically persist artifacts without cross-device rename issues.
#
# NOTE: release/deps may not exist yet on first build, so create it eagerly.
TMPDIR_EFFECTIVE="${TMPDIR:-$CARGO_TARGET_DIR_EFFECTIVE/release/deps}"
mkdir -p "$TMPDIR_EFFECTIVE"
export TMPDIR="$TMPDIR_EFFECTIVE"
BIN_DEFAULT="$CARGO_TARGET_DIR_EFFECTIVE/release/hakorune"
BIN="${NYASH_BIN:-$BIN_DEFAULT}"
@ -58,10 +67,10 @@ if [[ "$LLVM_FEATURE" == "llvm-inkwell-legacy" ]]; then
# Legacy inkwell需要LLVM_SYS_180_PREFIX
_LLVMPREFIX=$(llvm-config-18 --prefix)
LLVM_SYS_181_PREFIX="${_LLVMPREFIX}" LLVM_SYS_180_PREFIX="${_LLVMPREFIX}" \
CARGO_INCREMENTAL=1 cargo build --release -j 24 -p nyash-rust --features "$LLVM_FEATURE" >/dev/null
CARGO_INCREMENTAL=0 cargo build --release -j 24 -p nyash-rust --features "$LLVM_FEATURE" >/dev/null
else
# llvm-harnessデフォルトはLLVM_SYS_180_PREFIX不要
CARGO_INCREMENTAL=1 cargo build --release -j 24 -p nyash-rust --features "$LLVM_FEATURE" >/dev/null
CARGO_INCREMENTAL=0 cargo build --release -j 24 -p nyash-rust --features "$LLVM_FEATURE" >/dev/null
fi
if [[ ! -x "$BIN" ]]; then