escape (fix): a node walked more than once is scratch only if every walk found it LOCAL

A field's default is one expression, walked at every 'new' of its record: marked LOCAL by a frame's
temporary, it stayed marked when a record a pool keeps was made from it, and that record's list came
from the frame's scratch. The marks are now taken off any node one walk found kept.
examples/lang/arena_defaults.ludic is the case (a pool's record made in frame 3, a temporary of the
same type every frame): foundations 1315baf crashes on it poisoned; this prints '497 124747', as the
heap does. In ludic-dev test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 17:17:33 +03:00
parent 1315baf332
commit bad7c4a255
5 changed files with 44624 additions and 44209 deletions

View file

@ -0,0 +1,28 @@
# arena_defaults.ludic - a field's default (`items: []int = new []int`) is one expression, made at every
# `new` of its record: here for a record a pool keeps (made in frame 3, the arena running) and for a
# frame's temporary. It must stay on the heap for both. Built with --arena and poisoned on every
# reset, it prints `497 124747`.
program ArenaDefaults {
property Bag { items: []int = new []int, n: int = 0 }
function temp_sum(f: int) -> int {
let t = new Bag
t.n = f
return t.n
}
function step(held: []Bag, f: int) -> int {
if f == 3 { push(held, new Bag) }
if len(held) > 0 { push(held[0].items, f) }
return temp_sum(f)
}
entry {
let held = new []Bag
var t = 0
for f in 0 .. 500 {
t += step(held, f)
Mem.frame()
}
var sum = 0
for i in 0 .. len(held[0].items) { sum += held[0].items[i] }
print(`{len(held[0].items)} {sum}`)
}
}