escape (25.3a): which allocations never outlive their frame - the analysis, behind --escape-report; @alloc_ok on generics

emit_escape.ludic: every value is in a class, joined by flow edges (a let, an assignment, an argument
into its parameter, a result into the call) and store edges (a field, an element, a push). HEAP (a
parameter, a state, a global, what an unknown call hands back) flows forward; ESC (stored into
something HEAP, into a global, into an event's fields or named values, handed to an unknown callee)
flows backward, and from an ESC or HEAP target along a store. A load is its base's class. A site that
is neither ESC nor in a function reaching Mem.frame is LOCAL (Node.uns = ES_SCRATCH). ludicc
--escape-report prints each site and the totals; nothing is emitted differently yet - the arena that
allocates the LOCAL sites is next.

@alloc_ok on a generic now covers its instances (kept_push$NetFact is under kept_push's), and a
statement's @alloc_ok is carried on the node (Node.uns), so a generic's clone keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:05:07 +03:00
parent 1e2a6bab5b
commit 8ca18725b6
7 changed files with 84334 additions and 74306 deletions

View file

@ -174,6 +174,7 @@ entry {
else if a == "--natives-out" { ai += 1; if ai < arg_count() { natives_out = arg(ai) } }
else if a == "--link" { ai += 1; if ai < arg_count() { push(links, arg(ai)) } }
else if a == "-o" { ai += 1; if ai < arg_count() { out = arg(ai) } }
else if a == "--escape-report" { g_es_report = true } # 25.3: the escape analysis alone, reported
else if fence_flag(a) { } # 25.1: --fence=, --fence-warm=, --fence-census=
else if a[0] == '-' {
# an unknown flag is ignored (with a note) rather than mistaken for the input file
@ -229,6 +230,7 @@ entry {
if g_migrate { mg_collect() } # 0.S2: the vars that move (migrate.ludic)
ix_start() # the lookups by name, as tables (emit_core.ludic)
check_program() # L4: the types agree before anything is emitted
if g_es_report { escape_report() } # 25.3: which allocations never outlive their frame
if g_migrate { mg_finish() }
# --check: every check a build makes - the emitter refuses things too (a bind to a function that is
# gone, an unknown name) - and nothing written