phase-21.9: add De‑Rust roadmap + phase plan; stage archive script for Rust LLVM backend (no move yet)

This commit is contained in:
nyash-codex
2025-11-09 00:57:10 +09:00
parent 2bbd4b60f7
commit 024a4fecb7
3 changed files with 79 additions and 0 deletions

View File

@ -65,6 +65,17 @@ Phase 21.7 — VM mir_call state & Primary Flipgreen
- Canary 拡充phase2170/*: push×N、alias、perrecv差分、flow跨ぎ。Map dup-key 非増分・value_state set→get も緑化。
- 実行: bash tools/smokes/v2/profiles/quick/core/phase2170/run_all.sh → 全PASS。
Phase 21.8 — Hako Check: Refactor & QuickFixMVP
- T0 QuickFix--fix-dry-run, text-scope
- HC002 include→using安全置換HC003 using 非引用→引用化HC016 未使用 alias 行削除HC014 空スタブ提案。
- 統一diff---/+++/@@で標準出力。既定OFFdry-run時のみ
- T1 AST Rename同一ファイル
- --rename-box <Old> <New>--rename-method <Box> <Old> <New> を追加。
- 定義は AST span 行で安全置換、呼出は `<Box>.<Method>(` を置換。--fix-dry-run で diff 出力。
- T2 Plan 出力
- --fix-plan で refactor_plan.json と sed 雛形apply_scriptを出力手動レビュー想定
- 既定挙動は不変。適用は別フェーズwrite-capable providerで検討。
Remaining (21.4)
1) Hako Parser MVP 実装tokenizer/parser_core/ast_emit/cli【微修整】
2) Analyzer AST 入力の安定化(必要時のみ AST を使用)

View File

@ -0,0 +1,38 @@
# DeRust Roadmap (Phase 21.9+)
Purpose: reduce Rust surface (nonplugin) while keeping correctness and reversibility. Make Hakorune (Hako) the primary host for parsing/building/executing; keep Rust for kernel/ABI/thin wrappers.
## Phases
### Phase 0 — Archive (low risk)
- Target: Rust LLVM backend (src/backend/llvm) — deprecated in favor of Python llvmlite.
- Action: move to `archive/rust-llvm-backend/` with a clear RESTORE.md.
- Acceptance: `cargo build --release` (default features) remains green; quick smokes green.
- Revert: `git mv archive/rust-llvm-backend/llvm src/backend/`.
### Phase 1 — Quick Wins (12 months)
- hv1_inline → Hako parity (already functionally covered; keep as perf path).
- MIR interpreter parity check; route Primary to Hako VM.
- TLV codec → C shim (FFI) with thin Rust wrapper.
- LLVM wrapper → Hako/C harness (Python stays primary until Hako IR is ready).
### Phase 2 — Core Thinning (24 months)
- Plugin loader thin C wrapper (dlopen/dlsym), unify host ABI.
- Basic boxes (Array/Map/File) small C core (handlebased), keep Rust shim.
- Resolver/Using: SSOT in Hako; runner uses shared policy.
### Phase 3 — Longhaul (36 months)
- Python llvmlite → Hako IR builder + C ABI.
- Parser/MIR builder fully Hakofirst; Rust becomes fallback.
- NyKernel minimal C runtime (BoxCall dispatcher + collections + file).
## Principles
- Guard everything by env/features; defaults unchanged.
- Keep changes reversible (small diffs, RESTORE docs, fallbacks).
- Test gates: quick smokes + representative hv1/hakovm parity.
## Today (suggested)
1) Stage Phase0 move as a script (not autorun) + RESTORE.md.
2) Add phase docs (docs/private/roadmap/phases/phase-21.9/PLAN.md).
3) Keep CI/dev instructions intact (no build break when features=none).

View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
SRC_DIR="$ROOT/src/backend/llvm"
DST_DIR="$ROOT/archive/rust-llvm-backend/llvm"
RESTORE_MD="$ROOT/archive/rust-llvm-backend/RESTORE.md"
echo "[info] DeRust Phase0: archive Rust LLVM backend"
if [ ! -d "$SRC_DIR" ]; then
echo "[warn] src/backend/llvm not found; nothing to do" >&2
exit 0
fi
mkdir -p "$(dirname "$DST_DIR")"
git mv "$SRC_DIR" "$DST_DIR"
cat > "$RESTORE_MD" <<'EOF'
# RESTORE — Rust LLVM backend
To restore the archived backend back to the original location:
git mv archive/rust-llvm-backend/llvm src/backend/
Rationale: Python llvmlite is the primary LLVM path. The Rust backend was deprecated and archived as part of the DeRust Phase0.
EOF
echo "[done] Archived to archive/rust-llvm-backend/. Review and commit when ready."