Files
hakorune/docs/reference/constraints.md
Selfhosting Dev 9b9a91c859 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>
2025-09-24 23:27:59 +09:00

3.2 KiB
Raw Blame History

Nyash Constraints & Temporary Limitations

This is a living index of known constraints. Each entry includes status and references to tests and code. Update this file when a constraint is added or lifted.

Legend

  • Status: Stable | Temporary | Resolved | Experimental
  • Impact: VM / LLVM / PyVM / Macro / Parser

Entries

CF-JOIN-0001 — If-join PHI variables limit

  • Status: Resolved
  • Summary: If-join used to effectively handle at most two samename variable assignments per join when emitting PHI groups.
  • Impact: LLVM harness (PHI wiring)
  • Fix: FinalizePHI wiring + join result observation; normalized to handle N variables.
  • Tests (v2): use tools/smokes/v2/run.sh --profile integration (LLVM PHI invariants covered in integration suite)
  • Notes: Keep IR hygiene smokes minimal in CI; more exhaustive coverage can run locally.

CF-PHI-0002 — Empty PHI sanitize switch

  • Status: Temporary
  • Summary: Textlevel sanitizer drops empty PHI rows before LLVM parse.
  • Impact: LLVM harness only
  • Gate: NYASH_LLVM_SANITIZE_EMPTY_PHI=1
  • Exit criteria: PHI wiring guarantees no empty PHIs across Loop/If/Match; remove sanitize path.
  • Tests (v2): covered by tools/smokes/v2 integration runs; legacy scripts were removed

CF-LOOP-0006 — Nested bare blocks with break/continue in loops

  • Status: Resolved
  • Summary: Previously, a break/continue inside a nested bare block ({ ... }) within a loop could bypass loop-aware lowering in certain cases.
  • Impact: MIR builder (LoopBuilder vs generic block handling)
  • Fix: LoopBuilder now lowers Program nodes by recursing through statements with termination checks; break/continue inside nested blocks route to the loop header/exit uniformly.
  • Tests (v2): covered in tools/smokes/v2 macro cases (legacy paths removed)

CF-MATCH-0003 — Scrutinee single evaluation

  • Status: Stable
  • Summary: Scrutinee is evaluated once and stored in a gensym (e.g., __ny_match_scrutinee_X).
  • Impact: Parser/Normalizer/All backends
  • Tests (v2): goldens remain; execution smokes are under tools/smokes/v2 (legacy paths removed)
  • Notes: Golden comparison may normalize gensym names in the future to reduce brittleness.

EXC-PFX-0004 — Postfix catch/cleanup precedence

  • Status: Stable (Stage3 gate for parser acceptance)
  • Summary: Postfix attaches to the immediately preceding expression (call/chain) and stops further chaining. Normalizes to a single TryCatch.
  • Impact: Parser/Normalizer/All backends
  • Gate: NYASH_PARSER_STAGE3=1 (direct parsing); NYASH_CATCH_NEW=1 (sugar normalization)
  • Tests (v2): see tools/smokes/v2 and src/tests/parser_expr_postfix_catch.rs (legacy paths removed)

MACRO-CAPS-0005 — Macro sandbox capabilities (io/net/env)

  • Status: Stable MVP
  • Summary: Macro child runs in a sandbox. Only minimal boxes and console externs allowed. IO/NET require caps; env access controlled via ctx/env.
  • Impact: PyVM macro child / Macro runner
  • Env: NYASH_MACRO_CAP_{IO,NET,ENV}; NYASH_MACRO_SANDBOX=1
  • Tests: macro goldens/smokes; envtag demo (tools/test/golden/macro/env_tag_string_user_macro_golden.sh)

How to add an entry

  1. Allocate an ID with a prefix domain (CF/EXC/MACRO/RES/…)
  2. Fill status, impact, gates, tests
  3. Reference PR/commit in the change log (optional)