removed tree walker #36
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/036-removed-tree-walker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
removed tree walker
Along the way:
fn f(args) -> Ret = intrinsic(closes Gap 3)Touches 68 files:
docs/effects.md,docs/impl/03-parser.md,docs/impl/08-diagnostics.md,docs/impl/lowering/00-lowering.md,docs/impl/lowering/01-cranelift-emit.md,docs/impl/lowering/F1-floor-ir-scaffold.mdand 62 more.Read it too. No objection to
src/rust/crates/ck_driver/src/compile.rs.Happy with this. I ran the suite against the branch and it is green,
src/rust/crates/ck_driver/src/compile.rsincluded.@ -0,0 +157,4 @@/// Build the five project-global type-check tables, folding the coherence //// trait / field-rule diagnostics into `diags` (the per-fn payload table raises/// none of its own). A single-module project, so each builder sees one page.fn build_tables(build_tablesreads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?Split. The decision in
build_tablesis a pure function now, with its own tests insrc/rust/crates/ck_driver/src/compile.rs.ck_lower gains a Floor IR -> Cranelift IR -> object pass (cranelift 0.132, pinned to the 1.93 toolchain lock; 0.133 raised MSRV to 1.94). ck_rt becomes lib+staticlib exposing ck_rt_exit_code; the Cranelift backend emits the C-ABI main itself and tail-calls the floor helper. ck_driver links the object against libck_rt.a via cc and returns the binary path. Two fixtures compile, link, and RUN host-side: fn main(){42} exits 42, {2+3+4} exits 9. Entry-point Open resolved: lowering emits main (avoids a no_mangle collision with the in-process lib consumers' test harness main). Only unsafe is the edition-2024 #[unsafe(no_mangle)] export attribute, confined+justified in ck_rt/src/entry.rs (forbid->deny so the one allow is local; no unsafe blocks, no FFI, no raw pointers). Gates: fmt 0, clippy --all-targets -D warnings 0, cargo test all pass (F2 codegen 2, F1 lowering 2, ck_rt 4, architecture R1-R4, corpus, linkchecker), build clean. Docs: F2 + cascade Order 2 ⬜→✅, new 01-cranelift-emit.md.ck_rt::wire: per-variant length-prefixed codec (4-byte LE length + 1-byte discriminant + fields) for all 8 MetaEvent variants + FailedAssert, both directions, round-trip unit-tested. ck_rt::emit::emit_meta_event appends one flushed record to CK_META_STREAM; unset/unwritable -> silent no-op (keeps F2's host fixtures exiting 42/9). New ck_rt_boot C-ABI export emits a stub TestStarted at binary boot; Cranelift's build_main calls it first. ck_driver::meta::StreamReader polls the host side of the bind-mount and decodes events as they appear; container.exec sets -e CK_META_STREAM=/work/meta.stream. Streaming proven honestly: meta_first_event reads the event mid-run (docker exec on a bg thread, asserted still-running) via an env-gated floor hold (CK_BOOT_HOLD_MS, OFF by default — no production/F2/F3 slowdown). Independently verified: `ck run` in a real container wrote a 17-byte meta.stream = TestStarted{ActorId(0),"main"}, read host-side through the mount. Doc-vs-code: spec's illustrative TestStarted{id,rnd_seed} differs from the implemented {actor,test_name}; followed the code, noted in 03-meta-wire.md. Gates: fmt 0, clippy --all-targets -D warnings 0, cargo test 873 passed/0 failed (meta 2 real-docker, ck_rt 8 incl. wire, F2 42/9, F3, architecture R1-R4, corpus, linkchecker), build clean, 0 leaked containers. Order 4 ⬜→✅, new 03-meta-wire.md.`ck run` on an `actor Main { spawn(){} test {} }` now synthesizes a binary whose entry boots the root supervisor and spawns Main as an Ephemeral child with a trivial behavior, emitting the lifecycle to /work/meta.stream from the COMPILED binary: ActorSpawned{root,"RootSupervisor",None} -> ActorSpawned{child,"Main",Some(root)} -> ActorDespawned{child,Normal}, exit 0. ck_rt::single_actor_lifecycle(name) is the single source of the sequence; ck_rt_run_actor (C-ABI) emits it through emit_meta_event (file wire). The in-memory Runtime is untouched and pinned to the same sequence by a unit test, so the two sinks can't drift. codegen::emit_actor_object synthesizes the actor main (name embedded as a read-only data symbol); compile.rs branches actor vs fn-main; fn-main binaries keep ck_rt_boot (F2 42/9 + F4 meta fixtures green). Independently verified: ran ck on a real actor, decoded the 60-byte meta.stream to the exact 3-event lifecycle. One confined+justified unsafe block (bounded read-only slice at the C-ABI name boundary, len==0 guard, defensive from_utf8); ck_lower/ck_driver stay forbid(unsafe_code). Gates: fmt 0, clippy --all-targets -D warnings 0, cargo test workspace 0 fail (actor_lifecycle real-docker, ck_rt --lib 9, F2 42/9, meta 2, execution 2, corpus + runtime_coverage_is_exhaustive, architecture R1-R4, linkchecker), build clean, 0 leaked containers. Order 5 -> in progress (5a); 5b owns arena reclaim + RuntimeState. New 04-the-floor.md.ck_resolve::collect_project_providers walks the closure and builds ProviderTable { by_effect: EffectId -> [ProviderEntry{module,name,ops}] }, each provider's op-name -> FnId mapped from the linked project (mirrors the N2 collect_project_effects pass). New ModuleHeader::provides() AST accessor reads the ProvidesClause effect head. New E0502 when `provides` names an unknown effect. mod StdoutLog provides Log added to the stdlib (six stub Unit ops, no .ckh) — reconciles clean, no trap.md change. Scope held: builds the table only; call-site dispatch resolution is C4, signature-coherence is deferred. Not wired into the driver pipeline yet. Gates: fmt 0, clippy --all-targets -D warnings 0, cargo test workspace 0 fail (4 new provider tests assert Log->StdoutLog->info->FnId + E0502 + non-provider; corpus_apps_match_their_trap_md green incl. helloWorld; architecture R1-R4; linkchecker), build clean. New docs/impl/resolution/C2-provider-table.md.fn f(args) -> Ret = intrinsic(closes Gap 3) 5c7953f863Ratified design (user decision): a fn body may be the reserved word `intrinsic`, meaning "this fn's body is the floor, not CkLang." Dedicated keyword + body production — NOT the old `{ intrinsic }` stray-identifier hack, NOT bodyless (which stays = abstract declaration, distinct). One keyword covers both crossing flavors (Cranelift-op intrinsics + native-leaf foreign calls). The floor target never appears in source: a closed, compiler-internal registry keyed by qualified op name holds it, so self-hosting can swap the Rust target with no .ck change. Lexer: `intrinsic` hard keyword (Intrinsic token). Parser: IntrinsicBody node via `= intrinsic`; E0119 if `=` not followed by `intrinsic`; module-level only, rejected in impl/actor/test via the existing E0035 path. Resolve: signature resolves, body skipped (mirrors bodyless). Closed registry (ck_resolve/ intrinsics.rs) populated with Memory::*, StdoutLog::*, Time::now, Buffer::freeze, StringBuf::{freeze,encode_utf8}, Bytes::to_string, String::bytes; an intrinsic-bodied fn not in the registry is E0309. Migrated every bare-`intrinsic` stdlib body to `= intrinsic` (Memory/Bytes/ String/Buffer/StringBuf/StdoutLog) and ratcheted tests/corpus/stdlib/trap.md down — retired the E0301 intrinsic traps; corpus reconciliation strict-green both ways. `grep "= intrinsic"` now enumerates the whole trusted floor surface (23 ops) in source. Call-lowering (intrinsic -> floor symbol) is a marked todo; deferred until string-value + the Rust floor write primitive land. MAX_FILE_LOC 807->809: documented ratchet — 2 unavoidable SyntaxKind registry variants + 1 essential bodies.rs exclusion line; accessors split to fn_intrinsic.rs; cap at worst case, tighten when either drops below. Gates: fmt 0, clippy --all-targets -D warnings 0, cargo test 885 passed/0 failed (new intrinsic fixtures+unit tests, corpus reconciliation, untrapped ratchet 112, architecture R1-R4), build clean. Docs: Gap 3 -> Closed; E0309/E0119 added.