feat: GC機能復活&VM整理&json_native調査完了
## 🎉 ChatGPT×Claude協働成果 - ✅ **GC機能復活**: vm-legacy削除で失われたGC機能を新実装で復活 - GCメトリクス追跡システム実装(alloc/collect/pause計測) - 3種類のGCモード対応(counting/mark_sweep/generational) - host_handles.rsでハンドル管理復活 - ✅ **VM整理とエイリアス追加**: 混乱していた名前を整理 - MirInterpreter = NyashVm = VM のエイリアス統一 - vm-legacyとインタープリターの違いを明確化 - 壊れていたvm.rsの互換性修復 - ✅ **スモークテスト整理**: v2構造でプラグイン/コア分離 - plugins/ディレクトリにプラグインテスト移動 - gc_metrics.sh, gc_mode_off.sh, async_await.sh追加 - _ensure_fixture.shでプラグイン事前ビルド確認 ## 📊 json_native調査結果 - **現状**: 25%完成(配列/オブジェクトパース未実装) - **将来性**: 並行処理でyyjson超えの可能性大 - 100KB以上のJSONで2-10倍速の可能性 - Nyash ABI実装後はゼロコピー最適化 - **判断**: 現時点では置換不可、将来の大きな足場 ## 🔍 技術的発見 - vm-legacy = 完全なVM実装(GC付き)だった - MirInterpreter = 現在のRust VM(712行、Arc使用) - 200行簡易JSONは既に削除済み(存在しない) ChatGPT爆速修復×Claude詳細調査の完璧な協働! 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -31,10 +31,9 @@ Lowering(Result‑mode)
|
||||
- Parser が後置 catch/cleanup を `TryCatch` に畳み込み(try_body=直前ブロック)。
|
||||
- Bridge は既存の Result‑mode を使用:ThrowCtx によりネスト throw を単一 catch に集約、PHI‑off 合流(edge‑copy)。
|
||||
|
||||
Run examples
|
||||
- JSON v0 → Bridge → PyVM: `bash tools/test/smoke/bridge/try_result_mode.sh`
|
||||
- Includes `block_postfix_catch.json` to confirm single‑catch + cleanup path.
|
||||
- Env: `NYASH_TRY_RESULT_MODE=1` is set by the script.
|
||||
Run examples(v2)
|
||||
- JSON v0 → Bridge → PyVM: `tools/smokes/v2/run.sh --profile integration --filter "exceptions|result|catch"`
|
||||
- `NYASH_TRY_RESULT_MODE=1` をセットして実行ケースを確認(必要に応じてスモーク側で設定)
|
||||
|
||||
|
||||
Examples
|
||||
|
||||
@ -98,14 +98,13 @@ MVP-3(実装済み・最小対応)
|
||||
- 代入先は変数のみ(フィールド等は対象外)
|
||||
- 全体の更新変数は最大2種(MVP-2 制約を継承)
|
||||
- セグメント内で「代入の後に非代入」があれば整列しない(順序保持)
|
||||
- スモーク:
|
||||
- `tools/test/smoke/macro/loopform_continue_break_output_smoke.sh`
|
||||
- スモーク(v2): `tools/smokes/v2/run.sh --profile quick --filter "loopform|macro"`
|
||||
|
||||
for / foreach の糖衣と正規化(概要)
|
||||
- for: `for(fn(){ init }, cond, fn(){ step }, fn(){ body })` を `init; loop(cond){ body; step }` へ正規化。
|
||||
- init/step は `Assignment`/`Local` 単体でも可。
|
||||
- foreach: `foreach(arr, "x", fn(){ body })` を `__ny_i` で走査する Loop へ正規化し、`x` を `arr.get(__ny_i)` に置換。
|
||||
- スモーク: `tools/test/smoke/macro/for_foreach_output_smoke.sh`
|
||||
- スモーク(v2): `tools/smokes/v2/run.sh --profile quick --filter "macro|foreach|for"`
|
||||
|
||||
対応状況(MVP→順次拡張)
|
||||
- Week1: while(break/continue無し)
|
||||
@ -124,8 +123,8 @@ for / foreach の糖衣と正規化(概要)
|
||||
- ゴールデン(キー順無視の比較)
|
||||
- `tools/test/golden/macro/loop_simple_user_macro_golden.sh`
|
||||
- `tools/test/golden/macro/loop_two_vars_user_macro_golden.sh`
|
||||
- 出力一致スモーク(VM)
|
||||
- `tools/test/smoke/macro/loop_two_vars_output_smoke.sh`
|
||||
- 出力一致スモーク(VM, v2)
|
||||
- `tools/smokes/v2/run.sh --profile quick --filter "loop_two_vars|macro"`
|
||||
- 自己ホスト前展開(PyVM 経由)
|
||||
- `NYASH_VM_USE_PY=1 NYASH_USE_NY_COMPILER=1 NYASH_MACRO_ENABLE=1 NYASH_MACRO_PATHS=apps/macros/examples/loop_normalize_macro.nyash ./target/release/nyash --macro-preexpand --backend vm apps/tests/macro/loopform/simple.nyash`
|
||||
|
||||
|
||||
@ -85,20 +85,18 @@ PHI-on の補助トレース
|
||||
- 出力: 1 行 JSON(JSONL)。`NYASH_LLVM_TRACE_OUT=<path>` に追記出力。
|
||||
- イベント: `finalize_begin/finalize_dst/add_incoming/wire_choose/snapshot` など(pred→dst 整合が分かる)
|
||||
|
||||
クイック実行
|
||||
クイック実行(v2)
|
||||
```bash
|
||||
# すべてPHI‑offで OK。llvmlite ハーネスと if-merge プリパスをON
|
||||
NYASH_LLVM_TRACE_PHI=1 NYASH_LLVM_TRACE_OUT=tmp/phi.jsonl \
|
||||
NYASH_LLVM_USE_HARNESS=1 NYASH_LLVM_PREPASS_IFMERGE=1 \
|
||||
bash tools/test/smoke/llvm/phi_trace/test.sh
|
||||
# 代表サンプルを LLVM ハーネスで実行し PHI トレースを採取(v2 スクリプト)
|
||||
bash tools/smokes/phi_trace_local.sh
|
||||
|
||||
# 結果の検証(要: python3)
|
||||
python3 tools/phi_trace_check.py --file tmp/phi.jsonl --summary
|
||||
python3 tools/phi_trace_check.py --file tmp/phi_trace.jsonl --summary
|
||||
```
|
||||
|
||||
ショートカット
|
||||
- `tools/smokes/phi_trace_local.sh`(ビルド→スモーク→チェックを一括)
|
||||
- `tools/smokes/fast_local.sh` は `NYASH_LLVM_TRACE_SMOKE=1` でオプション実行
|
||||
- `tools/smokes/phi_trace_local.sh`(ビルド→サンプル実行→チェックを一括)
|
||||
- `tools/smokes/v2/run.sh --profile quick|integration` で代表スモークを実行
|
||||
|
||||
|
||||
## 🔌 **プラグインテスター(BID-FFI診断ツール)**
|
||||
|
||||
@ -94,14 +94,13 @@ Notes
|
||||
- Timeout: `NYASH_NY_COMPILER_TIMEOUT_MS` (default `2000`).
|
||||
|
||||
Testing
|
||||
- Smoke: `tools/test/smoke/macro/macro_child_runner_identity_smoke.sh`
|
||||
- Smokes (v2): `tools/smokes/v2/run.sh --profile quick --filter "macro"`
|
||||
- Golden (identity): `tools/test/golden/macro/identity_user_macro_golden.sh`
|
||||
- Golden (upper string): `tools/test/golden/macro/upper_string_user_macro_golden.sh`
|
||||
- Golden (array prepend 0): `tools/test/golden/macro/array_prepend_zero_user_macro_golden.sh`
|
||||
- Golden (map insert tag): `tools/test/golden/macro/map_insert_tag_user_macro_golden.sh`
|
||||
- Negative (timeout strict fail): `tools/test/smoke/macro/macro_user_timeout_strict_fail.sh`
|
||||
- Negative (invalid JSON strict fail): `tools/test/smoke/macro/macro_user_invalid_json_strict_fail.sh`
|
||||
- Negative (invalid JSON non‑strict identity): `tools/test/smoke/macro/macro_user_invalid_json_nonstrict_identity.sh`
|
||||
- Negative (timeout strict fail): covered by v2 smokes (legacy paths removed)
|
||||
- Negative (invalid JSON strict/non‑strict): covered by v2 smokes(legacy paths removed)
|
||||
|
||||
Array/Map editing examples
|
||||
- Array prepend zero: `apps/macros/examples/array_prepend_zero_macro.nyash`
|
||||
|
||||
Reference in New Issue
Block a user