Files
hakorune/docs/private/roadmap/phases/phase-20.30/PLAN.md

58 lines
3.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.

# Phase20.30 — Execution Plan (AOT BringUp)
Milestones
1) AOT toolchain path (harnessfirst)
- Choose nyllvmc harness for IR/object emission (no new Rust semantics).
- Contract: JSON v0 in, single main function out; numeric return maps to rc.
2) Runtime static lib (minimal)
- Provide `libhakorune_runtime.a` (C) with: console.{log|warn|error}, time.now_ms, mem.{alloc|free|name}, String helpers, Array minimal (size/get/set/pop), Map stub or pluginonly guard.
- Document headers and ABI entrypoints; keep symbols stable.
3) Link step + wrapper
- Script `tools/hakorune/aot_build.sh` (dev) to: emit JSON → nyllvmc → link runtime → produce EXE.
- Env toggles: HAKO_AOT_RUNTIME_PATH, HAKO_AOT_LD_FLAGS (dev only).
4) Canaries
- AOT return/binop/if build+run; rc parityreturn/binop=7, if=1
- Negative: extern-missingビルド失敗 or 実行非0 を PASS とする), div by zeroビルド失敗 or 実行非0 を PASS とする)
5) Docs + CLI glue (optional)
- Document AOT workflow and constraints; add `--aot` thin CLI delegator that shells out to script (dev only) without adding Rust semantics.
Success criteria
- Endtoend: hakorunefrozen builds hakorunenew (hello AOT) and tiny programs run.
- Rust freeze honored (no new runtime semantics implemented in Rust).
---
# RustFreeze + Hako Engine BringUp (P0/P1)
Objective
- 減速無しで「脱Rust」を段階導入。既存のRust実行層は凍結し、Hakorune側エンジンCore/VMを優先経路として増強する。
Scope今回
- P02週間: エンジン選択トグルと GateC の既定化(ドキュメント)
- Runner に `--engine {rust|hakorune}` / `HAKO_VM_ENGINE=hakorune` を追加既定OFF
- quick/integration-core の optin カナリアで Hako エンジンを観測FailFast 厳守)。
- GateC(JSON→Core) を quick で第一候補として“明文化”。README/Smokes に記載。
- P13〜4週間: JSON 処理の Hako 側への薄移管
- 既存の `lang/src/vm/core/json_v0_reader.hako` を GateB/C 境界で共通 reader として再利用。
- 最小 emitterconst/ret/binopを Hako 側に追加し、Rust emit と optin で並行運用。
- SSOT生成は現行 `tools/hakorune/gen_ssot.sh` を継続失敗時は現行fallback
- P1'(並行 1週間: I/O Bridge の最小CABI
- print/read_all など最小APIのみconsole/time/fsはゲートで制御
- Gate: `HAKO_KNI_{TIME|FS}=1` が無い場合は FailFast。
Acceptance
- quick/integration-core が両エンジンrust/hakoruneで optin 緑。
- GateC 直行の file/pipe × plugins ON/OFF が対称(既存カナリアで担保)。
- AOT 代表return/binop/ifを自走で生成・実行可能既存 canary で担保)。
Notes
- plugin 依存ケースは preflightトグルSMOKES_ENABLE_PLUGINS_CANARY=1で厳密にゲートする。
- 実行意味論の追加は Hako 側のみ。Rust は「橋・ローダ・FailFast」以外は凍結し、差分最小を維持する。