Files
hakorune/CURRENT_TASK.md

50 lines
2.9 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.

# Current Task — Phase 15 SelfHosting (20250917)
Summary
- Default execution is MIR13 (PHIoff). Bridge/Builder do not emit PHIs; llvmlite synthesizes PHIs when needed. MIR14 (PHIon) remains experimental for targeted tests.
- PyVM is the semantic reference engine; llvmlite is used for AOT and parity checks.
What Changed (recent)
- MIR13 default enabled
- `mir_no_phi()` default set to true (can disable via `NYASH_MIR_NO_PHI=0`).
- Curated LLVM runner defaults to PHIoff; `--phi-on` enables MIR14 lane.
- Added doc: `docs/development/mir/MIR13_MODE.md`; README references it.
- JSON v0 Bridge lowering split (nonfunctional)
- Added `src/runner/json_v0_bridge/lowering/{if_else.rs, loop_.rs, try_catch.rs, merge.rs}` and routed calls from `lowering.rs`.
- llvmlite stability for MIR13
- Resolver: forbids crossblock nondominating vmap reuse; for multipred and no declared PHI, synthesizes a localization PHI at block head.
- Finalize remains functionlocal; `block_end_values` snapshots and placeholder wiring still in place.
- Parity runner pragmatics
- `tools/pyvm_vs_llvmlite.sh` compares exit code by default; use `CMP_STRICT=1` for stdout+exit.
Current Status
- Selfhosting Bridge → PyVM smokes: PASS (Stage2 reps: array/string/logic/if/loop).
- Curated LLVM (PHIoff default): PASS.
- Curated LLVM (PHIon experimental): `apps/tests/loop_if_phi.nyash` shows a dominance issue (observed; not blocking, MIR13 recommended).
Next (short plan)
1) JSON v0 lowering: split remaining helpers (peek/ternary/expr) without behavior change.
2) PHIon lane (optional): investigate `loop_if_phi` dominance by tightening finalize ordering and resolver materialization (low priority).
3) Runner refactor (small PRs):
- `selfhost/{child.rs,json.rs}` split; `modes/common/{io,resolve,exec}.rs` split; reduce `runner/mod.rs` surface.
4) Optimizer/Verifier thinhub cleanup (nonfunctional): orchestrator minimalization and pass boundaries clarified.
How to Run
- PyVM reference smokes: `tools/pyvm_stage2_smoke.sh`
- Bridge → PyVM smokes: `tools/selfhost_stage2_bridge_smoke.sh`
- LLVM curated (PHIoff default): `tools/smokes/curated_llvm.sh`
- LLVM PHIon (experimental): `tools/smokes/curated_llvm.sh --phi-on`
- Parity (AOT vs PyVM): `tools/pyvm_vs_llvmlite.sh <file.nyash>` (`CMP_STRICT=1` to enable stdout check)
Key Flags
- `NYASH_MIR_NO_PHI` (default 1): PHIoff when 1 (MIR13). Set `0` for PHIon.
- `NYASH_VERIFY_ALLOW_NO_PHI` (default 1): relax verifier for PHIless MIR.
- `NYASH_LLVM_USE_HARNESS=1`: route AOT through llvmlite harness.
- `NYASH_LLVM_TRACE_PHI=1`: trace PHI resolution/wiring.
Notes / Policies
- Focus is selfhosting stability. JIT/Cranelift is out of scope (safety fixes only).
- PHI generation remains centralized in llvmlite; Bridge/Builder keep PHIoff by default.
- No full tracing GC yet; handles/Arc lifetimes govern object retention. Safepoint/barrier/roots are staging utilities.