diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 63da4cf3..cc1efb23 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -1,8 +1,13 @@ # Self Current Task — Now (main) -## Current Focus: Phase 284 P0 (design-first) / Post Phase 286 +## Current Focus: Phase 285 P0 (docs-only) -Phase 286 で JoinIR line の主要 pattern(1–9)が Plan/Frag SSOT に吸収できた。次は “出口語彙” をさらに SSOT に寄せるため、Phase 284(Return as ExitKind SSOT)へ進む。 +Box lifecycle / weakref / finalization / GC の “実装が仕様” を止めるため、まず docs-only で SSOT と差分運用(VM/LLVM)を固定する。 + +**2025-12-26: Phase 284 P2 完了** ✅ +- return を含む loop(Pattern5)を VM で smoke 固定 +- LLVM harness は理由付き SKIP(ビルドに LLVM feature なし) +- quick smoke 154/154 PASS 維持 設計相談(将来の正規化): - `docs/development/current/main/investigations/phase-286-plan-normalization-consult.md` @@ -23,7 +28,8 @@ Phase 286 で JoinIR line の主要 pattern(1–9)が Plan/Frag SSOT に吸 - quick smoke 154/154 PASS 維持、Pattern1/4 PoC 両方 PASS **次のステップ**: -1. **Phase 284(design-first)**: Return as ExitKind SSOT(pattern に散らさない) +1. **Phase 285 P0(docs-only)**: lifecycle/weak/finalization/GC の SSOT 固定 + - 手順書: `docs/development/current/main/phases/phase-285/P0-INSTRUCTIONS.md` 2. **future design(separate phase)**: Plan 生成の正規化をどう進めるか(相談パケット) - `docs/development/current/main/investigations/phase-286-plan-normalization-consult.md` 3. (optional, post self-host)REPL = script engine 構想(docs-only) diff --git a/docs/development/current/main/phases/phase-284/P2-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-284/P2-INSTRUCTIONS.md new file mode 100644 index 00000000..bc70b883 --- /dev/null +++ b/docs/development/current/main/phases/phase-284/P2-INSTRUCTIONS.md @@ -0,0 +1,59 @@ +# Phase 284 P2: "return in loop" smoke 固定(手順書) + +## 目的 + +- return を含む loop を **VM と LLVM harness** の両方で同一結果にする +- integration smoke で意味論を固定し、退行を防止 +- quick gate (154/154 PASS) は絶対に壊さない + +## 対象 fixture(既存再利用優先) + +| Fixture | Pattern | 期待値 | 備考 | +|---------|---------|--------|------| +| `apps/tests/phase286_pattern5_return_min.hako` | Pattern5 (infinite + early return) | exit 7 | 既存(Phase 286 P3.2 で作成)| + +**新規 fixture は追加しない**(既存で十分) + +## smoke スクリプト + +### VM 版 +- ファイル: `tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_vm.sh` +- 実行: `./target/release/hakorune --backend vm ` +- 判定: exit code または stdout で固定 + +### LLVM 版 +- ファイル: `tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_llvm.sh` +- 実行: `NYASH_LLVM_USE_HARNESS=1 ./target/release/hakorune --backend llvm ` +- SKIP ポリシー: LLVM feature がビルドに含まれていない場合は `test_skip` で理由付き SKIP + +```bash +# SKIP 流儀(v2 smoke 既存パターン準拠) +if ! "$NYASH_BIN" --version 2>/dev/null | grep -q "features.*llvm"; then + test_skip "LLVM backend not available in this build"; exit 0 +fi +``` + +## 受け入れ条件 + +- [ ] `tools/smokes/v2/run.sh --profile quick` → 154/154 PASS +- [ ] `phase284_p2_return_in_loop_vm.sh` → PASS (exit 7) +- [ ] `phase284_p2_return_in_loop_llvm.sh` → PASS (exit 7) または理由付き SKIP + +## 検証コマンド + +```bash +# quick gate(必須) +./tools/smokes/v2/run.sh --profile quick + +# integration 単発 +bash tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_vm.sh +bash tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_llvm.sh + +# integration 全体(フィルタ付き) +./tools/smokes/v2/run.sh --profile integration --filter "*phase284*" +``` + +## 完了後 + +1. `docs/development/current/main/phases/phase-284/README.md` の P2 を `✅ COMPLETE` に更新 +2. `docs/development/current/main/10-Now.md` の Current Focus を次タスクに更新 diff --git a/docs/development/current/main/phases/phase-284/README.md b/docs/development/current/main/phases/phase-284/README.md index 2dc52778..63b4477e 100644 --- a/docs/development/current/main/phases/phase-284/README.md +++ b/docs/development/current/main/phases/phase-284/README.md @@ -94,10 +94,28 @@ Phase 284 の完了条件は「`return` を含むケースが close-but-unsuppor - Block remapping: Duplicate logic → SSOT function - Future reusability: Pattern5 can now reuse return_jump_emitter -### P2+(未実装) +### P2(smoke 固定) ✅ COMPLETE (2025-12-26) -- `return` を含む loop body を、Plan line でも ExitKind::Return に落とす。 -- VM/LLVM の両方で、`return` を含む fixture を smoke 化して SSOT を固定する。 +**目的**: return を含む loop を VM/LLVM 両方で同一結果にし、integration smoke で固定。 + +**対象 fixture(既存再利用優先)**: +- `apps/tests/phase286_pattern5_return_min.hako` (exit 7) - Return-in-infinite-loop + +**smoke スクリプト**: +- `tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_vm.sh` (VM) +- `tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_llvm.sh` (LLVM harness) + +**受け入れ条件**: +- integration(VM)PASS +- integration(LLVM harness)PASS(または理由付き段階完了) +- quick 154/154 PASS 維持 + +**詳細手順**: `P2-INSTRUCTIONS.md` + +### P3+(将来) + +- 他の return パターン(Pattern8 等)の smoke 追加 +- LLVM AOT 経路での return 検証 ## Acceptance diff --git a/tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_llvm.sh b/tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_llvm.sh new file mode 100644 index 00000000..a148507c --- /dev/null +++ b/tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_llvm.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Phase 284 P2: "return in loop" LLVM harness smoke test +# Purpose: Verify return-in-loop works correctly in LLVM backend (VM/LLVM parity) +# Uses existing Phase 286 Pattern5 fixture for reuse +# +# Expected: exit code 7 or "RC: 7" output (same as VM) +# SKIP: If LLVM backend not available in build + +source "$(dirname "$0")/../../../lib/test_runner.sh" +export SMOKES_USE_PYVM=0 +require_env || exit 2 + +# LLVM feature check (v2 smoke SKIP convention) +if ! "$NYASH_BIN" --version 2>/dev/null | grep -q "features.*llvm"; then + test_skip "phase284_p2_return_in_loop_llvm: LLVM backend not available in this build" + exit 0 +fi + +INPUT="$NYASH_ROOT/apps/tests/phase286_pattern5_return_min.hako" +RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-30} + +set +e +OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_LLVM_USE_HARNESS=1 NYASH_DISABLE_PLUGINS=1 "$NYASH_BIN" --backend llvm "$INPUT" 2>&1) +EXIT_CODE=$? +set -e + +if [ "$EXIT_CODE" -eq 124 ]; then + test_fail "phase284_p2_return_in_loop_llvm: timed out (>${RUN_TIMEOUT_SECS}s)" + exit 1 +fi + +# Expected: exit code 7 or "RC: 7" in output (same as VM) +if [ "$EXIT_CODE" -eq 7 ] || echo "$OUTPUT" | grep -qE "(^7$|RC: 7$)"; then + test_pass "phase284_p2_return_in_loop_llvm: return-in-loop succeeded (exit/output: 7)" + exit 0 +else + echo "[FAIL] Unexpected result (expected: 7, same as VM)" + echo "[INFO] Exit code: $EXIT_CODE" + echo "[INFO] Output:" + echo "$OUTPUT" | head -n 30 || true + test_fail "phase284_p2_return_in_loop_llvm: VM/LLVM parity failed" + exit 1 +fi diff --git a/tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_vm.sh b/tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_vm.sh new file mode 100644 index 00000000..554c74f8 --- /dev/null +++ b/tools/smokes/v2/profiles/integration/apps/phase284_p2_return_in_loop_vm.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Phase 284 P2: "return in loop" VM smoke test +# Purpose: Verify return-in-loop works correctly in VM backend +# Uses existing Phase 286 Pattern5 fixture for reuse +# +# Expected: exit code 7 or "RC: 7" output + +source "$(dirname "$0")/../../../lib/test_runner.sh" +export SMOKES_USE_PYVM=0 +require_env || exit 2 + +INPUT="$NYASH_ROOT/apps/tests/phase286_pattern5_return_min.hako" +RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10} + +set +e +OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 "$NYASH_BIN" --backend vm "$INPUT" 2>&1) +EXIT_CODE=$? +set -e + +if [ "$EXIT_CODE" -eq 124 ]; then + test_fail "phase284_p2_return_in_loop_vm: timed out (>${RUN_TIMEOUT_SECS}s)" + exit 1 +fi + +# Expected: exit code 7 or "RC: 7" in output +if [ "$EXIT_CODE" -eq 7 ] || echo "$OUTPUT" | grep -qE "(^7$|RC: 7$)"; then + test_pass "phase284_p2_return_in_loop_vm: return-in-loop succeeded (exit/output: 7)" + exit 0 +else + echo "[FAIL] Unexpected result (expected: 7)" + echo "[INFO] Exit code: $EXIT_CODE" + echo "[INFO] Output:" + echo "$OUTPUT" | head -n 20 || true + test_fail "phase284_p2_return_in_loop_vm: Unexpected result" + exit 1 +fi