feat: Add VM statistics and fix compilation errors for plugin tests

- Add VM instruction statistics (--vm-stats, --vm-stats-json)
- Fix missing fields in ast.rs test code (public_fields, private_fields)
- Add CliConfig fields for VM statistics
- Enable TLV debug logging in plugin_loader_v2
- Successfully test FileBox handle passing and HTTP plugin creation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-23 04:51:24 +09:00
parent dd09e81018
commit 63749b683e
12 changed files with 360 additions and 7 deletions

46
docs/tools/cli-options.md Normal file
View File

@ -0,0 +1,46 @@
# Nyash CLI Options Quick Reference
最終更新: 2025-08-23
## 基本
- `file`: 実行するNyashファイル位置引数
- `--backend {interpreter|vm|llvm}`: 実行バックエンド選択(既定: interpreter
- `--debug-fuel {N|unlimited}`: パーサーのデバッグ燃料(無限ループ対策)
## MIR関連
- `--dump-mir`: MIRを出力実行はしない
- `--verify`: MIR検証を実施
- `--mir-verbose`: 詳細MIR出力統計など
## VM関連
- `--vm-stats`: VM命令統計を有効化`NYASH_VM_STATS=1`
- `--vm-stats-json`: VM統計をJSONで出力`NYASH_VM_STATS_JSON=1`
## WASM/AOT
- `--compile-wasm`: WATを出力
- `--compile-native` / `--aot`: AOT実行ファイル出力要wasm-backend
- `--output, -o FILE`: 出力先を指定
## ベンチマーク
- `--benchmark`: バックエンド比較ベンチを実行
- `--iterations N`: ベンチ実行回数(既定: 10
## 使用例
```bash
# インタープリターで実行
nyash program.nyash
# VMで実行 + 統計をJSON出力
nyash --backend vm --vm-stats --vm-stats-json program.nyash
# MIRを出力
nyash --dump-mir --mir-verbose program.nyash
# ベンチマーク
nyash --benchmark --iterations 100
```
詳細は `docs/reference/architecture/execution-backends.md` も参照してください。
## 参考: `nyash --help` スナップショット
- docs/tools/nyash-help.md

33
docs/tools/nyash-help.md Normal file
View File

@ -0,0 +1,33 @@
# `nyash --help` Snapshot
Captured: 2025-08-23
Source: Built-in clap help from the `nyash` binary
```
🦀 Nyash Programming Language - Everything is Box in Rust! 🦀
Usage: nyash [OPTIONS] [FILE]
Arguments:
[FILE] Nyash file to execute
Options:
--debug-fuel <ITERATIONS> Set parser debug fuel limit (default: 100000, 'unlimited' for no limit) [default: 100000]
--dump-mir Dump MIR (Mid-level Intermediate Representation) instead of executing
--verify Verify MIR integrity and exit
--mir-verbose Show verbose MIR output with statistics
--backend <BACKEND> Choose execution backend: 'interpreter' (default), 'vm', or 'llvm' [default: interpreter]
--compile-wasm Compile to WebAssembly (WAT format) instead of executing
--compile-native Compile to native AOT executable using wasmtime precompilation
--aot Short form of --compile-native
-o, --output <FILE> Output file (for WASM compilation or AOT executable)
--benchmark Run performance benchmarks across all backends
--iterations <COUNT> Number of iterations for benchmarks (default: 10) [default: 10]
--vm-stats Enable VM instruction statistics (equivalent to NYASH_VM_STATS=1)
--vm-stats-json Output VM statistics in JSON format
-h, --help Print help
-V, --version Print version
```
関連: CLIオプション早見表は `docs/tools/cli-options.md`