- Add e2e_vm_http_status_404/500 tests to verify HTTP status handling - ResultBox properly returns Ok(Response) for HTTP errors, Err for connection failures - Create dynamic-plugin-flow.md documenting MIR→VM→Registry→Plugin flow - Add vm-stats test files for HTTP 404/500 status codes - Update net-plugin.md with HTTP error handling clarification - Create E2E_TESTS.md documenting all E2E test behaviors - Add mir-26-instruction-diet.md for MIR optimization plans - Add vm-stats-cookbook.md for VM statistics usage guide - Update MIR verifier to properly track self-assignment patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1.6 KiB
1.6 KiB
VM Stats Cookbook
Collect VM instruction stats (JSON) to guide optimization and instruction set diet.
Prerequisites
- Build:
cargo build --release -j32 - Ensure plugins are configured in
nyash.tomlif your program uses them.
Quick Start
# Human-readable
./target/release/nyash --backend vm --vm-stats local_tests/vm_stats_http_ok.nyash
# JSON for tooling
./target/release/nyash --backend vm --vm-stats --vm-stats-json local_tests/vm_stats_http_ok.nyash > vm_stats_ok.json
# Or via helper script
tools/run_vm_stats.sh local_tests/vm_stats_http_ok.nyash vm_stats_ok.json
Sample Programs
local_tests/vm_stats_http_ok.nyash— Server responds "OK" to a client GET.local_tests/vm_stats_http_err.nyash— Client GET to an unreachable port (Result Err path).local_tests/vm_stats_http_404.nyash— Server returns 404/"NF"; transport成功+アプリ層エラーの代表例。local_tests/vm_stats_http_500.nyash— Server returns 500/"ERR"; 同上。local_tests/vm_stats_filebox.nyash— FileBox open/write/copyFrom/read.
Tips
- Enable plugin debugging when needed:
NYASH_DEBUG_PLUGIN=1— Show VM→Plugin TLV header preview.NYASH_NET_LOG=1 NYASH_NET_LOG_FILE=net_plugin.log— Net plugin logs.
- Env alternative to CLI flags:
NYASH_VM_STATS=1andNYASH_VM_STATS_JSON=1.
Next Steps
- Collect stats for normal and error flows (OK/404/500/unreachable, FileBox)。
- Compare hot instructions across scenarios(BoxCall/Const/NewBox の比率、Branch/Jump/Phi の有無)。
- Feed findings into the 26-instruction diet discussion(コア維持・メタ降格・型折りたたみ)。