arena: a LOCAL mark is honoured only while emitting a function the escape analysis walked

A default's node is emitted wherever its record is made, some of it in code the analysis never walks
(a scene's body, a test's); a mark from a walk elsewhere took effect there unchecked. The emitter now
asks for scratch only inside a function or @On body the analysis walked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 17:18:55 +03:00
parent bad7c4a255
commit 5e80db327d
3 changed files with 48402 additions and 48305 deletions

View file

@ -51,10 +51,13 @@ function fence_reset() -> void {
push(g_site_owner, 0)
}
# the function the next sites belong to (emit_fn, emit_system_fn)
# the function the next sites belong to (emit_fn, emit_system_fn); a LOCAL mark is honoured only
# while emitting a function the escape analysis walked (a default's node is also emitted elsewhere)
var g_es_walked: bool = false
function fence_enter(name: pointer) -> void {
g_cur_fn_name = name
g_site_fnc = null
g_es_walked = g_es_done and (es_fn(name) >= 0 or str_starts(name, "@On("))
}
function fence_owner_index(own: pointer) -> int {
@ -107,7 +110,7 @@ function fence_bind(rest: pointer) -> bool {
else if str_starts(rest, "call ptr @lp_str_slice(") { emit_site("substring") }
else if str_starts(rest, "call ptr @lp_text_") { emit_site("Text"); alloc = false }
else { alloc = false }
if alloc and g_arena and g_es_node != null {
if alloc and g_arena and g_es_walked and g_es_node != null {
emit(" store i8 1, ptr @lp_want\n")
return true
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff