@max on the bounded lists: TextRing's slots, the pack's counts and change ring, the net's fact ring, the compass pools, ludic.ui's memo (its 3/4 of MM_CAP), screen pools, answer and pointer rings; ludic.base's intern test holds the table to its cap now that past it is Mem.over

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:48:53 +03:00
parent 54c0feafc2
commit 7d85ea3432
8 changed files with 23 additions and 23 deletions

View file

@ -24,7 +24,7 @@ program TextTest {
sb_add(small, "a line longer than its buffer") sb_add(small, "a line longer than its buffer")
expect_eq(sb_len(small), 16) expect_eq(sb_len(small), 16)
} }
test "the same bytes intern to the one string, made once; past the cap a plain copy" { test "the same bytes intern to the one string, made once, up to the cap (past it is Mem.over, a failure)" {
let sb = sb_new(32) let sb = sb_new(32)
let tb = strs_new(3) let tb = strs_new(3)
sb_add(sb, "08:03") sb_add(sb, "08:03")
@ -37,7 +37,7 @@ program TextTest {
let ap: pointer = a let ap: pointer = a
let bp: pointer = b let bp: pointer = b
expect(ap == bp) expect(ap == bp)
for i in 0 .. 5 { for i in 0 .. 2 {
sb_clear(sb) sb_clear(sb)
sb_int(sb, i) sb_int(sb, i)
expect_eq(sb_intern(sb, tb), string(i)) expect_eq(sb_intern(sb, tb), string(i))

View file

@ -3,7 +3,7 @@
# is made. What a slot hands out is good until the ring comes round to it again - size the ring to # is made. What a slot hands out is good until the ring comes round to it again - size the ring to
# what can be showing at once # what can be showing at once
export property TextRing { export property TextRing {
slots: []pointer = new []pointer @max(64) slots: []pointer = new []pointer
cap: int = 0 cap: int = 0
at: int = 0 at: int = 0
} }

View file

@ -55,8 +55,8 @@ export function compass_gather(compass_st: mut CompassState) -> void {
export function compass_capturing(compass_st: CompassState) -> bool { return compass_st.cmp_capturing } export function compass_capturing(compass_st: CompassState) -> bool { return compass_st.cmp_capturing }
# more marks than any frame has asked for (the tracking view's peak is well under it) # marks made at the start; a frame that takes more grows the pool (declared), up to its @max
const COMPASS_POOL: int = 512 const COMPASS_POOL: int = 512 # made at start; @max(2048) on the pools is the most a frame may take
function cmp_pool__new() -> []CompassMark { function cmp_pool__new() -> []CompassMark {
let xs = new []CompassMark let xs = new []CompassMark
for i in 0 .. COMPASS_POOL { push(xs, new CompassMark) } for i in 0 .. COMPASS_POOL { push(xs, new CompassMark) }

View file

@ -26,11 +26,11 @@ export state CompassState {
cmp_cap: int = 64 cmp_cap: int = 64
cmp_list: []CompassMark = new []CompassMark # this frame's, sorted and culled cmp_list: []CompassMark = new []CompassMark # this frame's, sorted and culled
cmp_back: []CompassMark = new []CompassMark # the list the sort fills, then swapped with cmp_list cmp_back: []CompassMark = new []CompassMark # the list the sort fills, then swapped with cmp_list
cmp_pool: []CompassMark = cmp_pool__new() # a frame's marks, made with the state and reused: Ludic frees nothing @max(2048) cmp_pool: []CompassMark = cmp_pool__new() # a frame's marks, made with the state and reused: Ludic frees nothing
cmp_used: int = 0 cmp_used: int = 0
cmp_capturing: bool = false cmp_capturing: bool = false
cmp_caught: []CompassMark = new []CompassMark # what providers said while someone was listening cmp_caught: []CompassMark = new []CompassMark # what providers said while someone was listening
cmp_cpool: []CompassMark = cmp_pool__new() # the capture's marks, reused from one capture to the next @max(2048) cmp_cpool: []CompassMark = cmp_pool__new() # the capture's marks, reused from one capture to the next
cmp_none: CompassMark = new CompassMark # what compass_at answers past the end cmp_none: CompassMark = new CompassMark # what compass_at answers past the end
cmp_cused: int = 0 cmp_cused: int = 0
cmp_ranges: []float = null cmp_ranges: []float = null

View file

@ -16,9 +16,9 @@ export property ItemChanged {
const IV_POOL: int = 512 const IV_POOL: int = 512
export state InventoryState { export state InventoryState {
iv_keys: []string = null iv_keys: []string = null
iv_counts: []int = null @max(1024) iv_counts: []int = null
iv_changes: Queue<ItemChanged> = iv_changes__new() iv_changes: Queue<ItemChanged> = iv_changes__new()
iv_pool: []ItemChanged = new []ItemChanged # the facts' records, made once and taken in turn @max(512) iv_pool: []ItemChanged = new []ItemChanged # the facts' records, made once and taken in turn
iv_at: int = 0 iv_at: int = 0
} }

View file

@ -51,7 +51,7 @@ export property NetMessage {
export state NetState { export state NetState {
net__cfg: NetConfig = new NetConfig net__cfg: NetConfig = new NetConfig
net__facts: Queue<NetFact> = net__facts__new() net__facts: Queue<NetFact> = net__facts__new()
net__fpool: []NetFact = net__fpool__new() # the facts' records, taken in turn (pool.ludic) @max(64) net__fpool: []NetFact = net__fpool__new() # the facts' records, taken in turn (pool.ludic)
net__fat: int = 0 net__fat: int = 0
net__watch_url: string = "" # the room's address, made once per room net__watch_url: string = "" # the room's address, made once per room
net__seen: []string = new []string # guests already punched for net__seen: []string = new []string # guests already punched for

View file

@ -32,7 +32,7 @@ function ui_default_backend() -> UiBackend {
return UiRenderers[0].make() return UiRenderers[0].make()
} }
export state UiState { export state UiState {
pl_pools: []UiPool = new []UiPool # pool.ludic: each screen's nodes and envs, used again @max(512) pl_pools: []UiPool = new []UiPool # pool.ludic: each screen's nodes and envs, used again
pl_cur: UiPool = null pl_cur: UiPool = null
uv_on: bool = false # pool.ludic: a build is under way, so expressions' Values are pooled uv_on: bool = false # pool.ludic: a build is under way, so expressions' Values are pooled
uv_true: Val = null uv_true: Val = null
@ -43,7 +43,7 @@ export state UiState {
mm_ivals: []Val = null mm_ivals: []Val = null
ev_depth: int = 0 # eval.ludic: a call's arguments, in lists kept one a depth ev_depth: int = 0 # eval.ludic: a call's arguments, in lists kept one a depth
ev_args: []Val = new []Val ev_args: []Val = new []Val
ev_ring: []Val = new []Val # eval.ludic: calls' answers while an action runs, EV_RING of them @max(64) ev_ring: []Val = new []Val # eval.ludic: calls' answers while an action runs, EV_RING of them
ev_ring_at: int = 0 ev_ring_at: int = 0
cv_texts: []string = new []string # units_pieces.ludic: a value's var() pieces, kept cv_texts: []string = new []string # units_pieces.ludic: a value's var() pieces, kept
tx_pieces: [][]string = new [][]string # eval_text.ludic: a text's pieces, a list a depth tx_pieces: [][]string = new [][]string # eval_text.ludic: a text's pieces, a list a depth
@ -52,8 +52,8 @@ export state UiState {
ca_used: int = 0 ca_used: int = 0
ca_args: [][]CaVal = new [][]CaVal ca_args: [][]CaVal = new [][]CaVal
ca_depth: int = 0 ca_depth: int = 0
pe_evs: []UiPointer = pe_evs__new() # pointer_events.ludic: an event's record and its Value, a ring @max(16) pe_evs: []UiPointer = pe_evs__new() # pointer_events.ludic: an event's record and its Value, a ring
pe_vals: []Val = pe_vals__new() @max(16) pe_vals: []Val = pe_vals__new()
pe_at: int = 0 pe_at: int = 0
nth_a: int = 0 # select_nth.ludic: the a and b just read nth_a: int = 0 # select_nth.ludic: the a and b just read
nth_b: int = 0 nth_b: int = 0

View file

@ -5,15 +5,15 @@
const MM_CAP: int = 32768 # slots; at most three quarters are used const MM_CAP: int = 32768 # slots; at most three quarters are used
export property UiMemo { export property UiMemo {
slots: words = null # index + 1 into keys, 0 empty slots: words = null # index + 1 into keys, 0 empty
keys: []string = null # the text a result was made from (or the joined text itself) @max(24576) keys: []string = null # the text a result was made from (or the joined text itself)
tags: []int = null # what kind of result: a separator, or a kind below @max(24576) tags: []int = null # what kind of result: a separator, or a kind below
lists: [][]string = null @max(24576) lists: [][]string = null
grads: []UiGradient = null @max(24576) grads: []UiGradient = null
texts: []string = null # a text worked out from the key: tw, el_url @max(24576) texts: []string = null # a text worked out from the key: tw, el_url
vals: []Val = null # a Value made from it: cs_vars_in's @max(24576) vals: []Val = null # a Value made from it: cs_vars_in's
vtpls: []UiVarTpl = null @max(24576) vtpls: []UiVarTpl = null
n1: []float = null # numbers worked out from the key: a colour and its alpha @max(24576) n1: []float = null # numbers worked out from the key: a colour and its alpha
n2: []float = null @max(24576) n2: []float = null
} }
const MM_WORDS: int = -1 # el_words: spaces, a bracket's own kept const MM_WORDS: int = -1 # el_words: spaces, a bracket's own kept
const MM_GRAD: int = -2 const MM_GRAD: int = -2