Phase 21.6 solidification: chain green (return/binop/loop/call); add Phase 21.7 normalization plan (methodize static boxes). Update CURRENT_TASK.md and docs.

This commit is contained in:
nyash-codex
2025-11-11 22:35:45 +09:00
parent 52b62c5772
commit 9e2fa1e36e
19 changed files with 1309 additions and 35 deletions

View File

@ -6,16 +6,48 @@ Acceptance (all must be green on this host)
- VM: MIR(JSON) for minimal loop returns 10
- nyllvmc(crate) EXE: returns 10
Canaries to run
- bash tools/dev/stageb_loop_json_canary.sh
- bash tools/dev/phase216_chain_canary.sh
- bash tools/dev/phase216_chain_canary_return.sh
- bash tools/dev/phase216_chain_canary_binop.sh
- bash tools/dev/phase216_chain_canary_loop.sh
- bash tools/dev/phase216_chain_canary_call.sh (Phase 21.6 extension)
Guardrails
- No default behavior changes; all aids behind env toggles.
- Logs quiet; tags/dev traces are optin.
- No llvmlite in default chain; crate backend is main line.
Canaries to run
- bash tools/dev/stageb_loop_json_canary.sh
- bash tools/dev/phase216_chain_canary.sh
Rollback
- Parser fallback in parse_loop is conservative; remove after VM/gpos fix lands.
- Keep canaries; they protect against regressions.
## Phase 21.6 Call Support Extension
**Toggles**:
- `HAKO_STAGEB_FUNC_SCAN=1`: Enable function definition scanning in Stage-B
- `HAKO_MIR_BUILDER_FUNCS=1`: Enable function definition lowering in MirBuilder (unused - Rust delegate used)
**Implementation**:
1. Stage-B function scanner extracts `method <name>(params){ body }` definitions
2. Stage-B injects `defs` array into Program(JSON v0)
3. Rust delegate (src/runner/json_v0_bridge/) processes `defs` and generates MIR functions
4. Function names are qualified as `Box.method` (e.g., `Main.add`)
**Current Status**:
- ✅ Stage-B scanning implemented (compiler_stageb.hako)
- ✅ Rust delegate defs processing implemented (ast.rs, lowering.rs)
- ✅ MIR functions generated with correct signatures and bodies
- ⚠️ Call resolution incomplete: calls still use dynamic string lookup ("add") instead of static Main.add reference
**Next Steps for Call Completion**:
- Need to resolve Call("add") → Call(Main.add) at lowering time
- Implement call target resolution in json_v0_bridge/lowering.rs
- Update Call instruction to use function reference instead of string
- Alternative: use MirCall with Callee::Function for local calls
**撤去条件 (Removal Criteria)**:
- After Phase 22 introduces proper local function scoping with Callee typed calls
- Or when unified with broader namespace/using system Phase 15.5+