feat(normalization): Phase 142 P1 - LLVM EXE parity for loop normalization
Some checks failed
fast-smoke / fast (push) Has been cancelled

Phase 142-loopstmt P1: LLVM EXE smoke test for statement-level loop normalization

- Added: tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_return_length_min_llvm_exe.sh
- Verification: Exit code 3 parity with VM test
- Status:  PASS (exit code 3, string length computed correctly)

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-19 05:42:11 +09:00
parent 4082abb30c
commit af2a5e27d6
6 changed files with 56 additions and 18 deletions

View File

@ -2,7 +2,6 @@
## Next (planned) ## Next (planned)
- Phase 142-loopstmt P1: LLVM EXE smoke test 追加Phase 130 完了後)
- Phase 141 P2+: Call/MethodCall 対応effects + typing を分離して段階投入) - Phase 141 P2+: Call/MethodCall 対応effects + typing を分離して段階投入)
- Phase 143-loopvocab: StepTree の語彙拡張loop 内 if/break/continue を「新パターン追加」ではなく「語彙追加」で吸収) - Phase 143-loopvocab: StepTree の語彙拡張loop 内 if/break/continue を「新パターン追加」ではなく「語彙追加」で吸収)
- 詳細: `docs/development/current/main/30-Backlog.md` - 詳細: `docs/development/current/main/30-Backlog.md`

View File

@ -8,14 +8,6 @@ Related:
## 直近JoinIR/selfhost ## 直近JoinIR/selfhost
- **Phase 142-loopstmt P1planned: LLVM EXE smoke を追加**
- 前提DONE: Phase 142-loopstmt P0正規化単位を statementloop 1個へ寄せる
- ねらい: VM で固定済みの fixture を LLVM EXE でも parity 固定する。
- 受け入れ条件:
- 既存 fixture をそのまま使う(新パターン追加をしない)
- out-of-scope は `Ok(None)` でフォールバック(既定挙動不変)
- Phase 130 の LLVM EXE gate が前提(未完なら SKIP を維持)
- **Phase 141 P2+planned: Call/MethodCalleffects + typing を分離して段階投入)** - **Phase 141 P2+planned: Call/MethodCalleffects + typing を分離して段階投入)**
- ねらい: pure/impure 境界を壊さずに、impure lowering を段階投入する。 - ねらい: pure/impure 境界を壊さずに、impure lowering を段階投入する。
- 前提DONE: - 前提DONE:

View File

@ -11,7 +11,7 @@
- **Phase 141 P1.5DONE**: known intrinsic registry + available_inputs 3-source merge + diagnostics - **Phase 141 P1.5DONE**: known intrinsic registry + available_inputs 3-source merge + diagnostics
- **Phase 141 P2+planned**: Call/MethodCall 対応effects + typing の段階投入) - **Phase 141 P2+planned**: Call/MethodCall 対応effects + typing の段階投入)
- **Phase 142-loopstmt P0DONE**: 正規化単位を statementloop 1個へ寄せるパターン爆発を止める - **Phase 142-loopstmt P0DONE**: 正規化単位を statementloop 1個へ寄せるパターン爆発を止める
- **Phase 142-loopstmt P1planned**: LLVM EXE smoke同 fixtureを追加 - **Phase 142-loopstmt P1DONE**: LLVM EXE smoke同 fixtureを追加
- **Phase 143-loopvocabplanned**: StepTree の語彙拡張loop 内 if/break/continue を「語彙追加」で吸収) - **Phase 143-loopvocabplanned**: StepTree の語彙拡張loop 内 if/break/continue を「語彙追加」で吸収)
- **Phase 9192**: Selfhost depth2 coverageP5b escape recognition → lowering - **Phase 9192**: Selfhost depth2 coverageP5b escape recognition → lowering
- **Phase 94100**: P5b escape E2E / Trim policy / pinned + accumulatorVM/LLVM EXE parity - **Phase 94100**: P5b escape E2E / Trim policy / pinned + accumulatorVM/LLVM EXE parity

View File

@ -163,7 +163,14 @@ bash tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_retu
**File**: `tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_return_length_min_llvm_exe.sh` **File**: `tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_return_length_min_llvm_exe.sh`
**Status**: ⚠️ TODO in P1 (requires Phase 130 LLVM EXE gate complete) **Status**: ✅ P1 COMPLETE (LLVM EXE parity achieved)
**Command**:
```bash
bash tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_return_length_min_llvm_exe.sh
```
**Result**: ✅ PASS (exit code 3, parity with VM)
--- ---
@ -305,13 +312,11 @@ bash tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_retu
## Next Steps ## Next Steps
### P1: LLVM EXE Smoke Test (TODO) ### P1: LLVM EXE Smoke Test (DONE ✅)
**File**: `tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_return_length_min_llvm_exe.sh` - File: `tools/smokes/v2/profiles/integration/apps/phase142_loop_stmt_only_then_return_length_min_llvm_exe.sh`
- Gate: `llvm_exe_preflight_or_skip` により、Phase 130 の LLVM EXE 前提が満たされない環境では SKIP を維持
**Prerequisites**: Phase 130 LLVM EXE gate complete - Contract: exit code 3 parity with VM
**Expected**: exit code 3 parity with VM
### P2: Code Contract Enforcement (Planned) ### P2: Code Contract Enforcement (Planned)

View File

@ -93,7 +93,7 @@ impl StepTreeNormalizedShadowLowererBox {
// Phase 126: EnvLayout 生成available_inputs を使用) // Phase 126: EnvLayout 生成available_inputs を使用)
let env_layout = EnvLayout::from_contract(&step_tree.contract, available_inputs); let env_layout = EnvLayout::from_contract(&step_tree.contract, available_inputs);
// Phase 131: loop(true) break-once pattern // Phase 131: loop(true) break-once pattern (simpler, higher priority)
if let Some((module, meta)) = LoopTrueBreakOnceBuilderBox::lower(step_tree, &env_layout)? { if let Some((module, meta)) = LoopTrueBreakOnceBuilderBox::lower(step_tree, &env_layout)? {
return Ok(Some((module, meta))); return Ok(Some((module, meta)));
} }

View File

@ -0,0 +1,42 @@
#!/bin/bash
# Phase 142 P0: Loop normalization as single statement (LLVM EXE parity)
#
# Verifies that loop(true) normalization returns consumed=1, allowing
# subsequent statements (return s.length()) to be processed normally.
# Expected: exit code 3 (s="abc" → s.length() → 3)
#
# Dev-only: NYASH_JOINIR_DEV=1 HAKO_JOINIR_STRICT=1
source "$(dirname "$0")/../../../lib/test_runner.sh"
source "$(dirname "$0")/../../../lib/llvm_exe_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
# Preflight check (SKIP gate)
llvm_exe_preflight_or_skip || exit 0
# JoinIR dev mode (Phase 130+ gate)
require_joinir_dev
# Minimal plugins (String + Integer for s.length())
STRINGBOX_SO="$NYASH_ROOT/plugins/nyash-string-plugin/libnyash_string_plugin.so"
INTEGERBOX_SO="$NYASH_ROOT/plugins/nyash-integer-plugin/libnyash_integer_plugin.so"
LLVM_REQUIRED_PLUGINS=(
"StringBox|$STRINGBOX_SO|nyash-string-plugin"
"IntegerBox|$INTEGERBOX_SO|nyash-integer-plugin"
)
LLVM_PLUGIN_BUILD_LOG="/tmp/phase142_loop_stmt_llvm_plugin_build.log"
llvm_exe_ensure_plugins_or_fail || exit 1
# Test configuration
INPUT_HAKO="$NYASH_ROOT/apps/tests/phase142_loop_stmt_only_then_return_length_min.hako"
OUTPUT_EXE="$NYASH_ROOT/tmp/phase142_loop_stmt_only_then_return_length_min_llvm_exe"
# Execute (exit code contract)
EXPECTED_EXIT_CODE=3
LLVM_BUILD_LOG="/tmp/phase142_loop_stmt_llvm_build.log"
if llvm_exe_build_and_run_expect_exit_code; then
test_pass "phase142_loop_stmt_llvm_exe: exit code matches (3)"
else
exit 1
fi