diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index c4cf6013..21f42099 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -65,6 +65,17 @@ Phase 21.7 — VM mir_call state & Primary Flip(green) - Canary 拡充(phase2170/*): push×N、alias、per‑recv差分、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 & QuickFix(MVP) +- T0 QuickFix(--fix-dry-run, text-scope) + - HC002 include→using(安全置換)/HC003 using 非引用→引用化/HC016 未使用 alias 行削除/HC014 空スタブ提案。 + - 統一diff(---/+++/@@)で標準出力。既定OFF(dry-run時のみ)。 +- T1 AST Rename(同一ファイル) + - --rename-box /--rename-method を追加。 + - 定義は AST span 行で安全置換、呼出は `.(` を置換。--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 を使用) diff --git a/docs/development/strategies/de-rust-roadmap.md b/docs/development/strategies/de-rust-roadmap.md new file mode 100644 index 00000000..0f44e180 --- /dev/null +++ b/docs/development/strategies/de-rust-roadmap.md @@ -0,0 +1,38 @@ +# De‑Rust Roadmap (Phase 21.9+) + +Purpose: reduce Rust surface (non‑plugin) 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 (1–2 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 (2–4 months) +- Plugin loader thin C wrapper (dlopen/dlsym), unify host ABI. +- Basic boxes (Array/Map/File) small C core (handle‑based), keep Rust shim. +- Resolver/Using: SSOT in Hako; runner uses shared policy. + +### Phase 3 — Long‑haul (3–6 months) +- Python llvmlite → Hako IR builder + C ABI. +- Parser/MIR builder fully Hako‑first; 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 Phase‑0 move as a script (not auto‑run) + 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). + diff --git a/tools/de_rust/archive_rust_llvm_backend.sh b/tools/de_rust/archive_rust_llvm_backend.sh new file mode 100644 index 00000000..785ba658 --- /dev/null +++ b/tools/de_rust/archive_rust_llvm_backend.sh @@ -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] De‑Rust Phase‑0: 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 De‑Rust Phase‑0. +EOF + +echo "[done] Archived to archive/rust-llvm-backend/. Review and commit when ready." +