iter raw-buf.6 kernel-stub-retirement (DONE 5/5): retire the stub, raw_buf is the sole base extension (refs #7)
Closes the raw-buf milestone. raw_buf (shipped raw-buf.1-.5; the
owned-drop resolution landed under bug #42/#43) has subsumed every
ratification role kernel_stub held -- Term::New end-to-end, the
param-in reject, kernel-tier auto-import, the monomorphic intrinsic
path, and the type-scoped polymorphic intrinsic mechanism (RawBuf's
four ops). The stub is now redundant; this iteration removes it.
Pure removal (-636/+49 across 22 files, 7 deleted):
- Rust surface: drop `mod kernel_stub` + `STUB_AIL` re-export
(ailang-kernel), `parse_kernel_stub` + its workspace injection
(ailang-surface), the `answer` + two `StubT_peek__{Int,Float}`
INTERCEPTS entries + their three emit fns (ailang-codegen). The
(intrinsic) markers leave with the deleted source, so the
marker<->entry bijection holds in lockstep.
- Source + tests: delete crates/ailang-kernel/src/kernel_stub/,
kernel_stub_module_round_trips, the two stub-consumer e2e tests,
and mono_scoped_symbol.rs (its scope-qualified-mono mechanism is
now pinned by RawBuf's ops + the intercepts bijection).
- Fixtures: delete kernel_answer.ail, new_stubt_smoke.ail,
peek_mono_pin_smoke.ail, and fieldtest kem_3_stub_consumer.ail
(referenced the deleted StubT; documented a since-fixed bug).
- Pins: re-baseline both workspace-count content-pins 5 -> 4
(workspace_pin.rs + the e2e.rs twin) and regenerate all five IR
snapshots (400 stub-IR lines removed; no user IR changed -- the
stub auto-injected into every build).
- Ledger: design/INDEX.md + design/models/0007 to present-state
(raw_buf is the live ratifier; raw-buf milestone shipped, series
pending), plus architecture-comment sweep across workspace.rs,
mono.rs, check/codegen lib.rs, workspace_kernel.rs.
Scope decisions (orchestrator, pre-plan): the self-contained inline
serde_json check-layer fixtures in ailang-check/src/lib.rs keep their
incidental StubT/kernel_stub sample names (they construct what they
reference; not stub-ratification) -- the one permitted residual.
kem_4 fieldtest kept (uses a user NumBox ADT, comment-only edit).
hash.rs `name: "answer"` left (generic serde doc example).
Plan-gap caught at implement: the planner's verbatim edit list
under-enumerated four honesty sites; one (mono.rs:562) carried a
literal `StubT_peek__Int` -- a hard-gate symbol the verbatim list
missed, which would have failed Task 4's removal gate. Filled
(comment-only, no behaviour). Confirms the planner self-review
filter-completeness risk; the implement gate caught it.
Verification: full workspace suite green (0 failed); hard symbol gate
(STUB_AIL|parse_kernel_stub|emit_answer|emit_stubt_peek|StubT_peek__)
zero matches across crates/ examples/ design/; soft gate residual only
the kept inline fixtures; kernel crate is lib.rs + raw_buf/ only.
Regression: compile_check 24/24 stable (exit 0; uniform downward
check_ms within tol -- stub no longer parsed per compile), cross_lang
25/25, check 34/34 stable (exit 0; an earlier exit-1 on
rc_over_bump was machine-load ratio noise -- denominator bump_s got
faster, rc_s also improved -- confirmed green on re-run, not
baselined).
This commit is contained in:
@@ -164,27 +164,6 @@ pub(crate) static INTERCEPTS: &[Intercept] = &[
|
||||
wants_alwaysinline: true,
|
||||
emit: emit_ne_int,
|
||||
},
|
||||
Intercept {
|
||||
name: "answer",
|
||||
expected_params: &[],
|
||||
expected_ret: "i64",
|
||||
wants_alwaysinline: false,
|
||||
emit: emit_answer,
|
||||
},
|
||||
Intercept {
|
||||
name: "StubT_peek__Int",
|
||||
expected_params: &["ptr"], // borrow (con StubT Int) lowers to ptr
|
||||
expected_ret: "i64",
|
||||
wants_alwaysinline: false,
|
||||
emit: emit_stubt_peek_int,
|
||||
},
|
||||
Intercept {
|
||||
name: "StubT_peek__Float",
|
||||
expected_params: &["ptr"],
|
||||
expected_ret: "double",
|
||||
wants_alwaysinline: false,
|
||||
emit: emit_stubt_peek_float,
|
||||
},
|
||||
// raw-buf.4: the 12 scope-qualified RawBuf ops. Symbols are
|
||||
// `RawBuf_{new,get,set,size}__{Int,Float,Bool}` (raw-buf.3
|
||||
// scope-qualified mono mangling). Slab layout:
|
||||
@@ -552,44 +531,6 @@ pub(crate) fn emit_ne_int(emitter: &mut Emitter<'_>) -> Result<()> {
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
/// Ratifier intrinsic for intrinsic-bodies.1: `answer : () -> Int`
|
||||
/// returns the constant 42. Exercises the Term::Intrinsic → registry
|
||||
/// route end-to-end. May be retired once a real kernel-tier intrinsic
|
||||
/// (raw-buf) lands.
|
||||
pub(crate) fn emit_answer(emitter: &mut Emitter<'_>) -> Result<()> {
|
||||
emitter.body.push_str(" ret i64 42\n");
|
||||
emitter.body.push_str("}\n\n");
|
||||
emitter.block_terminated = true;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// raw-buf.3 ratifier emit. NOTE: never instantiated to codegen this
|
||||
/// iteration (no Term::New to build a StubT; unit-test-ratified only).
|
||||
/// The load offset/correctness is exercised end-to-end only by
|
||||
/// raw-buf.4's RawBuf path; here the entry exists to satisfy the
|
||||
/// bijection. Retires with the stub in raw-buf.5.
|
||||
pub(crate) fn emit_stubt_peek_int(emitter: &mut Emitter<'_>) -> Result<()> {
|
||||
let n = emitter.locals.len();
|
||||
let s = emitter.locals[n - 1].1.clone();
|
||||
let v = emitter.fresh_ssa();
|
||||
emitter.body.push_str(&format!(" {v} = load i64, ptr {s}\n"));
|
||||
emitter.body.push_str(&format!(" ret i64 {v}\n"));
|
||||
emitter.body.push_str("}\n\n");
|
||||
emitter.block_terminated = true;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn emit_stubt_peek_float(emitter: &mut Emitter<'_>) -> Result<()> {
|
||||
let n = emitter.locals.len();
|
||||
let s = emitter.locals[n - 1].1.clone();
|
||||
let v = emitter.fresh_ssa();
|
||||
emitter.body.push_str(&format!(" {v} = load double, ptr {s}\n"));
|
||||
emitter.body.push_str(&format!(" ret double {v}\n"));
|
||||
emitter.body.push_str("}\n\n");
|
||||
emitter.block_terminated = true;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// raw-buf.4: RawBuf op emits over an `@ailang_rc_alloc` slab.
|
||||
// Slab layout `[ size:i64 @0 ][ elem_0 @8 ][ elem_1 @8+w ]…`. The
|
||||
@@ -808,13 +749,12 @@ mod tests {
|
||||
&["lt__Int", "le__Int", "gt__Int", "ge__Int", "ne__Int"];
|
||||
|
||||
/// Collect the mangled name of every `(intrinsic)` marker reachable
|
||||
/// in the kernel-tier source modules (prelude + kernel_stub — the
|
||||
/// in the kernel-tier source modules (prelude + raw_buf — the
|
||||
/// only modules where an intrinsic body is legal today).
|
||||
fn workspace_intrinsic_markers() -> BTreeSet<String> {
|
||||
let mut markers = BTreeSet::new();
|
||||
for module in [
|
||||
ailang_surface::parse_prelude(),
|
||||
ailang_surface::parse_kernel_stub(),
|
||||
ailang_surface::parse_raw_buf(),
|
||||
] {
|
||||
for def in &module.defs {
|
||||
@@ -848,7 +788,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
// Top-level intrinsic fn: name is already the symbol
|
||||
// (float_eq, answer, ...).
|
||||
// (float_eq, ...).
|
||||
Def::Fn(f) if matches!(f.body, Term::Intrinsic) => {
|
||||
markers.insert(f.name.clone());
|
||||
}
|
||||
|
||||
@@ -1109,9 +1109,11 @@ impl<'a> Emitter<'a> {
|
||||
// drop instead: a single rc-dec on the slab pointer
|
||||
// (primitive elements carry no recursive drops).
|
||||
// This distinguishes RawBuf (intrinsic `new`) from
|
||||
// StubT (real-body `new` → generic ADT drop), where
|
||||
// a param_in heuristic would misclassify StubT
|
||||
// (also param_in). A matching flat partial-drop is
|
||||
// an ordinary param_in user ADT (real-body `new` →
|
||||
// generic ADT drop), where a param_in heuristic
|
||||
// would misclassify the user ADT (also param_in).
|
||||
// The intrinsic-`new` test is the load-bearing
|
||||
// signal, not param_in. A matching flat partial-drop is
|
||||
// emitted for symbol-resolution parity with the
|
||||
// generic path (no carve-out site can actually
|
||||
// target it — the sole field is a primitive).
|
||||
|
||||
Reference in New Issue
Block a user