frame allocs (25.2): @frame on a step list's field, @alloc_ok on a statement, and on an exported function

A field declared '@frame run: fn(...)' makes every function stored in it a frame root, as a System's
tick is. @alloc_ok("why") before a statement takes that statement out of frame_allocs and makes what
it allocates declared at run time; a function holding one keeps the fence's scope depth and puts it
back at its return, so a return inside the statement cannot leave the scope open. @alloc_ok above
'export function' was lost - export parses the declaration one call down - and is now carried to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 15:56:32 +03:00
parent b35409254e
commit 1e2a6bab5b
7 changed files with 75754 additions and 74774 deletions

View file

@ -356,6 +356,24 @@ function emit_emit(st: Node) -> Val {
}
function emit_stmt(st: Node) -> void {
if fr_aok_stmt(st) { # 25.1: @alloc_ok("why") on this statement: its allocations are declared
emit(" %decl.s")
emit(itoa(ll_t))
emit(" = atomicrmw add ptr @lp_fdecl, i32 1 monotonic\n")
ll_t += 1
emit_stmt_body(st)
if not g_term {
emit(" %decl.e")
emit(itoa(ll_t))
emit(" = atomicrmw sub ptr @lp_fdecl, i32 1 monotonic\n")
ll_t += 1
}
return
}
emit_stmt_body(st)
}
function emit_stmt_body(st: Node) -> void {
g_err_file = st.file; g_err_line = st.line # so a lowering error names its statement
emit_cov_hit(st.line) # --coverage: bump this line's hit counter (no-op otherwise)
if st.kind == S_LET {