Files
hakorune/tools/test_loopssa_breakfinder_slot.sh
nyash-codex 39f5256c18 📊 Phase 25.1l: Region観測レイヤー骨格 + スコープ契約設計理解
**Region Box統一理論の実装開始**

新規追加:
- src/mir/region/mod.rs: Region/RefSlotKind型定義
- src/mir/region/observer.rs: Region観測レイヤー
- docs/development/roadmap/phases/phase-25.1l/: 設計ドキュメント

主要概念:
- Region Box = Function/Loop/If の統一箱
- RefSlotKind = GC管理用スロット種別(Strong/Weak/Borrowed/NonRef)
- 観測専用(NYASH_REGION_TRACE=1で動作、挙動変更なし)

設計理解の深化:
- ValueId(40)問題 = LoopForm v2スコープ契約違反の症状
- 根本解決 = Region観測で無名一時値のスコープまたぎを検出
- 箱理論3原則: 境界明確化/差し替え可能/段階的移行

関連議論:
- ChatGPT提案: Region統一理論でGC/寿命管理の基盤構築
- SlotRegistry: 変数の単一真実源(SSOT)
- 階層構造: FunctionRegion → LoopRegion → IfRegion

次のステップ:
- Phase 1: Region観測(現在)- 非破壊的追加
- Phase 2: メタデータ出力(MIR JSON拡張)
- Phase 3: GC統合(retain/release挿入)

テスト追加:
- lang/src/compiler/tests/stageb_mini_driver.hako
- tools/test_loopssa_breakfinder_slot.sh

Build:  全警告は既存のもの
Tests: 既存テスト全て緑維持
2025-11-19 02:44:40 +09:00

29 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# test_loopssa_breakfinder_slot.sh — LoopSSA/BreakFinder 「最小失敗 JSON」スロットテスト
#
# 目的:
# - lang/src/compiler/tests/loopssa_breakfinder_slot.hako を直接 VM で実行し、
# Program(JSON v0) スロットに貼り付けた JSON に対する LoopSSA.stabilize_merges
# の挙動を観測するよ。
# - StageB 最小サンプルから抽出した「失敗する JSON v0」をここに貼っておけば、
# StageB 全体を回さずに LoopSSA/BreakFinderBox 周辺だけを再現できる。
#
set -e
NYASH_BIN="${NYASH_BIN:-./target/release/hakorune}"
TEST_FILE="lang/src/compiler/tests/loopssa_breakfinder_slot.hako"
echo "=== LoopSSA BreakFinder Slot JSON Test ==="
echo "Test file: $TEST_FILE"
echo "Binary: $NYASH_BIN"
echo ""
# LoopSSA v2 の EXIT PHI を有効化して実行BreakFinder/PhiInjector 経由)
HAKO_LOOPSSA_EXIT_PHI=1 \
NYASH_DISABLE_PLUGINS=1 NYASH_PARSER_STAGE3=1 \
"$NYASH_BIN" --backend vm "$TEST_FILE" 2>&1
echo ""
echo "=== Test complete ==="