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