Files
hakorune/apps/LLVM_TEST_PROGRAMS.md
Moe Charm 11506cee3b Phase 11-12: LLVM backend initial, semantics layer, plugin unification
Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support

New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode

Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values

Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 23:44:34 +09:00

74 lines
2.8 KiB
Markdown
Raw Permalink 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.

# LLVM/AOT Test Programs
このファイルはLLVMバックエンドのテスト用プログラムについて説明します。
これらは主にCIスモークテストで使用されます。
**注意**: これらのテストプログラムは `apps/tests/` ディレクトリに移動されました。
## テストプログラム一覧
### 基本動作テスト
- **ny-llvm-smoke/** - ArrayBox基本操作push/get+ print
- 現在の問題: ArrayBoxプラグインの引数エンコーディング問題で "Invalid arguments"
- 状態: NYASH_LLVM_ARRAY_SMOKE=0でデフォルトスキップ
- **ny-array-llvm-ret/** - ArrayBox戻り値テストprintなし
- 目的: print依存を排除して安定性向上
- 期待値: Result: 3
- **ny-echo-lite/** - 最小echo実装
- 目的: 標準入力/出力の基本動作確認
- 状態: NYASH_LLVM_ECHO_SMOKE=0でデフォルトスキップ
### プラグイン呼び出しテスト
- **ny-map-llvm-smoke/** - MapBoxプラグイン基本テスト
- 目的: by-idプラグイン呼び出しの動作確認
- 期待値: "Map: v=42" および "size=1"
### 可変長引数テストVInvoke
- **ny-vinvoke-smoke/** - 5引数呼び出し文字列出力
- 目的: 可変長引数≥3のtagged vector経路テスト
- 期待値: "VInvokeRc: 42"
- **ny-vinvoke-llvm-ret/** - 5引数呼び出し戻り値
- 目的: 可変長引数の戻り値検証
- 期待値: Result: 42
- **ny-vinvoke-llvm-ret-size/** - 0引数呼び出しsize())✅
- 目的: 固定長引数≤2の経路テスト
- 期待値: Result: 1
## CIスモークテストでの使用
`tools/llvm_smoke.sh`で以下の環境変数により制御:
```bash
# 基本テスト問題があるためデフォルトOFF
NYASH_LLVM_ARRAY_SMOKE=1 # ny-llvm-smoke
NYASH_LLVM_ARRAY_RET_SMOKE=1 # ny-array-llvm-ret
NYASH_LLVM_ECHO_SMOKE=1 # ny-echo-lite
# プラグインテスト(安定)
NYASH_LLVM_MAP_SMOKE=1 # ny-map-llvm-smoke
NYASH_LLVM_VINVOKE_SMOKE=1 # ny-vinvoke-smoke
NYASH_LLVM_VINVOKE_RET_SMOKE=1 # ny-vinvoke-llvm-ret + ny-vinvoke-llvm-ret-size
```
## 既知の問題
1. **ArrayBoxプラグイン**: set/getで "Invalid arguments" エラー
- 原因: プラグイン側の引数デコード問題
- 対策: 戻り値型テストで回避
2. **print文字列連結**: `print("Result: " + v)` での型エラー
- 原因: binop型不一致
- 対策: toString()を使用するか、戻り値型テストで回避
## 実アプリケーションとの違い
これらのテストプログラムは:
- 最小限の機能に絞った単体テスト
- CI自動実行を前提とした設計
- エラー時の切り分けが容易
実際のアプリケーションchip8_nyash、kilo_nyash等とは目的が異なります。