arena (25.3b): LOCAL sites allocate from the frame's scratch; dispatch is not an allocation; @frame by property
Behind ludicc --arena (or 'arena on' in the program's package.ludic): the escape analysis runs and a LOCAL site's allocation raises @lp_want for that one call, so it comes from the frame's arena. Two halves in one mmap reservation (R3D_ARENA_MB each, 256 by default), bump-allocated with a 16-byte size header, flipped at each frame mark: a frame's scratch is good through the next frame, then its half is started again (R3D_ARENA_CHECK=1 fills it with 0xDD first). The heap takes over when no frame is running, off the main thread, or past the half's end; lp_free ignores an arena block and lp_realloc copies one out. R3D_ARENA=0 turns it off at run time; the census reports each half's high-water mark. A program that builds text, a list and a record per frame: 29998 heap blocks made and 18002 freed without it, 8 and 8 with it and 544 bytes of scratch a frame, the same output. A dispatch's 'new' fills the queue's kept record (E_NEW.b), so 25.2 no longer counts it and 25.3 treats its fields as kept. '@frame' is keyed by property and field: a 'run' field is a root only in a property that marks it, and 'tick' stays a System's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8dfcccad41
commit
bef0d6fbca
11 changed files with 80823 additions and 78428 deletions
|
|
@ -1039,7 +1039,18 @@ function emit_call(e: Node) -> Val {
|
|||
return val(rreg, fn2.ty)
|
||||
}
|
||||
|
||||
# 25.3: which expression is being emitted, when it is a LOCAL site - fence_bind asks for scratch
|
||||
# for that expression's own allocation, and never for one of its parts that is not one
|
||||
function emit_expr(e: Node) -> Val {
|
||||
if (e == null) { return val("0", "int") }
|
||||
let saved = g_es_node
|
||||
if e.uns == ES_SCRATCH { g_es_node = e } else { g_es_node = null }
|
||||
let v = emit_expr_raw(e)
|
||||
g_es_node = saved
|
||||
return v
|
||||
}
|
||||
|
||||
function emit_expr_raw(e: Node) -> Val {
|
||||
if (e == null) { return val("0", "int") }
|
||||
if e.kind == E_INT {
|
||||
if e.s != null { return val(e.s, "long") } # a literal past 2^31 - 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue