Files
hakorune/docs/development/current/main/10-Now.md
nyash-codex 889492b617 docs(joinir): Phase 80 Tasks 80-0/80-A - Status verification + design doc
Task 80-0: Current status verification
-  970/970 lib tests PASS (production stable)
-  Core VM smoke tests PASS (json_pp_vm)
-  Phase 79 E2E tests broken (AST API mismatch, out-of-scope)
-  Pre-existing json_lint_vm failure (Pattern2 verifier, out-of-scope)
- **Conclusion**: Phase 80 has ZERO blockers

Task 80-A: SSOT design doc created
- New: docs/development/current/main/phase80-bindingid-p3p4-plan.md (336 lines)
- Pattern3/4 BindingId wiring strategy
- Implementation order: 80-B (P3) → 80-C (P4) → 80-D (E2E)
- Code examples and success metrics
- Fallback detection mechanism (existing log tags)

Design principles (consistent with Phase 74-79):
- Dev-only code (feature-gated)
- Dual-path maintained (BindingId priority + name fallback)
- Structural detection only (NO by-name branching)
- Fail-Fast error handling
- Zero production impact

Updated docs:
- 01-JoinIR-Selfhost-INDEX.md: Phase 79 Activation status
- 10-Now.md: Phase 80 tasks 80-0/80-A complete
- 20-Decisions.md: BindingId migration complete status
- joinir-architecture-overview.md: Phase 79/80 sections

Next: Task 80-B (Pattern3 BindingId registration)
2025-12-13 17:26:15 +09:00

4.8 KiB
Raw Blame History

Self Current Task — Now (main)

20251206現状サマリ

JoinIR / Loop / If ライン

  • LoopBuilder は Phase 186187 で完全削除済み。JoinIR が唯一の loop lowering 経路
  • LoopPattern 系は Pattern14 まで実装・本線化済み:
    • Pattern1: Simple While
    • Pattern2: Loop with Break
    • Pattern3: Loop with IfElse PHIbreak/continue なし)
    • Pattern4: Loop with Continuemulticarrier 対応)
  • Exit/Carrier/Boundary ラインは次の箱で SSOT 化:
    • CarrierInfo / ExitMeta / ExitBindingBuilder
    • JoinInlineBoundary + LoopExitBinding
  • If lowering は IfSelectLowerer/IfMergeLowerer を中心に整理済み。Select/PHI の扱いも Phase 189 系で橋渡し済み。
  • 残課題JoinIR ライン):
    • JoinIR→MIR merge の一般化(複雑な Select/PHI パターンの統合)
    • JsonParserBox など実アプリ側での長期運用テスト

Scope / BindingIddev-only の段階移行ライン)

  • MIR builder 側で lexical scope / shadowing を実在化し、言語仕様の “local はブロック境界で分離” を SSOT に揃えた。
    • JoinIR lowering 側は name-based から BindingId-based へ段階移行中:
    • ScopeManager.lookup_with_binding() / ConditionEnv.binding_id_map を導入し、shadowing を壊さずに解決できる足場を作った。
    • promoted carriersDigitPos/Trimについては BindingId(original) → BindingId(promoted) → ValueId(join) の鎖を dev-only で整備中。
    • 参照:
      • docs/development/current/main/phase73-scope-manager-design.md
      • docs/development/current/main/phase78-bindingid-promoted-carriers.md
      • docs/development/current/main/phase80-bindingid-p3p4-plan.md

JsonParser / Selfhost depth2 ライン

  • selfhost_build.sh --json で Program JSON v0 emit は安定。
    .hako 側から env 経由で JSON を読む最小ループ(program_read_min.hako)は動作確認済み。
  • JsonParserBox / BundleResolver のループ 21 本のうち:
    • 18 本は Pattern14 で JoinIR 対応済みPhase 162165
    • _trim を含む一部の複合ループは、ValueId 境界や Box 登録など残課題あり。
  • BoolExprLowerer / condition_to_joinir で OR/AND/NOT 付き条件式の lowering は実装完了Phase 168169
  • 残課題JsonParser/selfhost depth2
    • JoinIR→MIR ValueId boundary の完全一般化(条件用 ValueId を含める)
    • JsonParserBox の using / Box 登録Rust VM 側での認識)
    • Program JSON v0 を JsonParserBox 経由でフル解析する line の仕上げ

Ring0 / Runtime / CoreServices ライン

  • Ring0Context + Ring0Registry で OS API 抽象化レイヤ完成:
    • MemApi / IoApi / TimeApi / LogApi / FsApi / ThreadApi
    • RuntimeProfile(Default / NoFs) で条件付き必須を制御。
  • CoreServicesring1coreとして次を実装済み
    • StringService / IntegerService / BoolService
    • ArrayService / MapService / ConsoleService
    • PluginHost 統合 + UnifiedBoxRegistry からの自動初期化
  • FileBox / FileHandleBox ライン:
    • Ring0FsFileIo 経由で read / write / append / metadata 完全対応
    • Default プロファイルでは必須、NoFs プロファイルでは disabled。
  • Logging ライン:
    • ConsoleServiceuserfacing
    • Ring0.loginternal/dev
    • println!test 専用) の 3 層が logging_policy.md で整理済み。JoinIR/Loop trace も同ドキュメントに集約。

20250908旧スナップショット参考

  • LLVM 側 P0 完了BitOps/Array/Echo/Map 緑。VInvoke(byname/byid vector) は戻り値マッピングの暫定課題を確認中Decisions 参照)。
  • selfhosting-dev の作業を main に順次取り込み。VM/MIR 基盤は main で先に整える方針。

直近タスク(当時)

  1. continue/break の loweringBuilder 修正のみで表現)
    • ループ文脈スタック {head, exit} を導入。
    • continue に遭遇 → headまたは latchへ br を emit し終端。
    • break に遭遇 → exit へ br を emit し終端。
    • postterminated 後に emit しない制御を徹底。
  2. ループ CFG の厳密化
    • 単一 exit ブロックの徹底。
    • Phi はヘッダでキャリー変数を合流SSA/支配関係が崩れない形)。
  3. 検証とスモーク
    • Verifier 緑dominance/SSA
    • VM のループ代表(単純/ネスト/早期継続・脱出)。
    • LLVM/Cranelift EXE に綺麗に降りるbr/phi ベースで問題なし)。

代表コマンド(例)

  • ビルド: cargo build --release
  • LLVM smoke: LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) NYASH_LLVM_BITOPS_SMOKE=1 ./tools/llvm_smoke.sh release
  • VInvoke 調査: NYASH_LLVM_VINVOKE_TRACE=1 NYASH_LLVM_VINVOKE_SMOKE=1 ./tools/llvm_smoke.sh release