Files
hakorune/docs/development/current/CURRENT_TASK.md
Moe Charm 2949648e71 fix: MIR builder me resolution for static box methods
- Fixed me ValueId inconsistency in static box methods
- Previously, each me reference generated a new const __me__ ValueId
- Now caches the first me ValueId in variable_map for reuse
- This ensures RefSet and RefGet operate on the same object
- ArrayBox get/set/push now working correctly in VM mode
- Test results: 1, 42, 3 (as expected)

🔧 Technical Details:
- build_me_expression() now stores fallback ValueId in variable_map
- Subsequent me references reuse the same ValueId
- VM BoxCall debug logs confirm ArrayBox methods dispatch correctly

Co-Authored-By: ChatGPT5
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 21:13:02 +09:00

114 lines
6.0 KiB
Markdown
Raw 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.

# 🎯 CURRENT TASK - 2025年8月23日刷新
## ✅ 直近の完了
1. ドキュメント再編成の完了(構造刷新)
2. VM×プラグインのE2E整備FileBox/Net
- FileBox: open/write/read, copyFrom(handle)VM
- Net: GET/POSTVM、404/500Ok(Response)、unreachableErr(ErrorBox)
3. VM命令カウンタ時間計測のCLI化`--vm-stats`, `--vm-stats-json`とJSON出力対応
- サンプル/スクリプト整備tools/run_vm_stats.sh、local_tests/vm_stats_*.nyash
4. MIR if-merge 修正retがphi dstを返す Verifier強化mergeでのphi未使用検知、支配関係チェック導入
5. VMの健全化分岐・比較・Result
- Compare: Void/BoolのEq/Ne定義順序比較はTypeError
- Branch条件: `BoxRef(BoolBox)→bool``BoxRef(VoidBox)→false``Integer≠0→true`
- ResultBox: 新旧両実装への動的ディスパッチ統一isOk/getValue/getError
6. VMビルトイン強化Array/Map/Socket
- ArrayBox/MapBox: 代表メソッドをVM統合ディスパッチで実装push/get/set/size等
- SocketBox: `acceptTimeout(ms)`void/ `recvTimeout(ms)`(空文字)を追加
- E2E追加: `socket_timeout_server.nyash` / `socket_timeout_client.nyash`
7. E2E拡張Net/Socket
- HTTP: 大ボディ取得クライアント `local_tests/http_big_body_client.nyash`
- Socket: 反復タイムアウト検証 `local_tests/socket_repeated_timeouts.nyash`
- インタープリタ: SocketBoxの `acceptTimeout/recvTimeout` を結線
8. VM/MIRの健全化Builder/VM
- Compare拡張: Float/Int-Float混在をサポートEq/Ne/Lt/Le/Gt/Ge
- TypeOp(Check)最小意味論実装Integer/Float/Bool/String/Void/Box名
- ArrayGet/ArraySetVM本実装ArrayBox.get/setへ橋渡し
- Array/Mapをidentity扱いclone_or_shareがshareを選択
- BoxCallにArrayBox fast-pathBoxRefからget/set直呼び
- me参照の安定化fallback時に一度だけConstを発行しvariable_mapに保持
- デバッグ: `NYASH_VM_DEBUG_BOXCALL=1` でBoxCallの受け手/引数/経路/結果型を標準エラーに出力
9. ドキュメント追加・更新
- MIR→VMマッピング分岐条件の動的変換、Void/Bool比較
- VM READMESocketBoxタイムアウト/E2E導線・HTTP Result整理
- 26命令ダイエット: PoCフラグと進捗追記TypeOp/WeakRef/Barrier
10. CI: plugins E2E ジョブLinuxを追加
## 🚧 次にやること(再開方針)
1) 命令セットダイエットのPoC実装短期
- 現状: VMに `TypeOp/WeakRef/Barrier` 実行経路等価とPrinter対応。Builderに補助APIを追加済未置換
- 次: Builder内の該当箇所を補助APIに置換flag onで新命令を吐くoffで従来どおり
- 旗: `mir_typeop_poc`TypeCheck/Cast→TypeOp`mir_refbarrier_unify_poc`Weak*/Barrier→統合
- 成果物: スナップショットflag on/off vm-statsのキー確認TypeOp/WeakRef/Barrier
2) VM×プラグインのE2E拡張短期
- HTTP: 遅延応答・大ボディの計測、到達不能時のERR安定化の再検証代表は追加済
- Socket: 反復タイムアウトの追加ケース(代表は追加済)
- 成果物: 必要に応じてE2E追補と `VM_README.md` のTips更新
3) ResultBox単一路線への統合中期
-`NyashResultBox`へ統合、旧`ResultBox`は薄いラッパーとして段階移行
- 成果物: 実装整理・移行メモ・影響調査
4) Array系の本実装必要時・中期
- VMの `ArrayGet/ArraySet` 実装済み。BoxCall fast-pathの整合性と回帰テストを充実
5) BoxCall高速化性能段階
- vm-statsでホットなBoxCallの高速化命令セット統合より効果大の可能性
## ▶ 実行コマンド例
計測実行:
```bash
tools/run_vm_stats.sh local_tests/vm_stats_http_ok.nyash vm_stats_ok.json
tools/run_vm_stats.sh local_tests/vm_stats_http_err.nyash vm_stats_err.json
tools/run_vm_stats.sh local_tests/vm_stats_http_404.nyash vm_stats_404.json
tools/run_vm_stats.sh local_tests/vm_stats_http_500.nyash vm_stats_500.json
```
VM×プラグインE2E:
```bash
cargo test -q --features plugins e2e_interpreter_plugin_filebox_close_void
cargo test -q --features plugins e2e_vm_plugin_filebox_close_void
```
MIRダンプ/検証:
```bash
nyash --dump-mir --mir-verbose examples/plugin_box_sample.nyash
nyash --verify examples/plugin_box_sample.nyash
```
## 🔭 26命令ターゲット合意ドラフト
- コア: Const / Copy / Load / Store / BinOp / UnaryOp / Compare / Jump / Branch / Phi / Return / Call / BoxCall / NewBox / ArrayGet / ArraySet / RefNew / RefGet / RefSet / Await / Print / ExternCall(最小) / TypeOp(=TypeCheck/Cast統合) / WeakRef(=WeakNew/WeakLoad統合) / Barrier(=Read/Write統合)
- メタ降格: Debug / Nop / Safepointビルドモードで制御
---
最終更新: 2025年8月23日VM強化・E2E拡張・me参照安定化・TypeOp/WeakRef/Barrier PoC完了次段はBuilder置換とスナップショット
## 🔁 再起動後の再開手順(ショート)
```bash
# 1) ビルド
cargo build --release -j32
# 2) plugins E2ELinux
cargo test --features plugins -q -- --nocapture
# 3) VM Stats 代表値の再取得(任意)
tools/run_vm_stats.sh local_tests/vm_stats_http_ok.nyash vm_stats_ok.json
tools/run_vm_stats.sh local_tests/vm_stats_http_err.nyash vm_stats_err.json
# 4) SocketBox タイムアウト確認(任意)
./target/release/nyash local_tests/socket_timeout_server.nyash
./target/release/nyash local_tests/socket_timeout_client.nyash
# 5) 反復タイムアウト確認(任意)
./target/release/nyash local_tests/socket_repeated_timeouts.nyash
# 6) HTTP 大ボディ確認(任意)
./target/release/nyash local_tests/http_big_body_client.nyash
# 7) VM BoxCall デバッグ(任意)
NYASH_VM_DEBUG_BOXCALL=1 ./target/release/nyash --backend vm local_tests/test_vm_array_getset.nyash
```