From 7d85ea3432adf855e20e452ad537ce66aaa682b5 Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Mon, 28 Sep 2026 16:48:53 +0300 Subject: [PATCH] @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 --- packages/ludic.base/tests/text_test.ludic | 4 ++-- packages/ludic.base/text_ring.ludic | 2 +- packages/ludic.compass/gather.ludic | 4 ++-- packages/ludic.compass/marks.ludic | 4 ++-- packages/ludic.inventory/state.ludic | 4 ++-- packages/ludic.net/state.ludic | 2 +- packages/ludic.ui/backend.ludic | 8 ++++---- packages/ludic.ui/memo.ludic | 18 +++++++++--------- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/ludic.base/tests/text_test.ludic b/packages/ludic.base/tests/text_test.ludic index 09b5d1a3..c4004c16 100644 --- a/packages/ludic.base/tests/text_test.ludic +++ b/packages/ludic.base/tests/text_test.ludic @@ -24,7 +24,7 @@ program TextTest { sb_add(small, "a line longer than its buffer") 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 tb = strs_new(3) sb_add(sb, "08:03") @@ -37,7 +37,7 @@ program TextTest { let ap: pointer = a let bp: pointer = b expect(ap == bp) - for i in 0 .. 5 { + for i in 0 .. 2 { sb_clear(sb) sb_int(sb, i) expect_eq(sb_intern(sb, tb), string(i)) diff --git a/packages/ludic.base/text_ring.ludic b/packages/ludic.base/text_ring.ludic index a8da4dbb..99ecbe8e 100644 --- a/packages/ludic.base/text_ring.ludic +++ b/packages/ludic.base/text_ring.ludic @@ -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 # what can be showing at once export property TextRing { - slots: []pointer = new []pointer + @max(64) slots: []pointer = new []pointer cap: int = 0 at: int = 0 } diff --git a/packages/ludic.compass/gather.ludic b/packages/ludic.compass/gather.ludic index d9aebbfa..bb61c8bb 100644 --- a/packages/ludic.compass/gather.ludic +++ b/packages/ludic.compass/gather.ludic @@ -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 } -# more marks than any frame has asked for (the tracking view's peak is well under it) -const COMPASS_POOL: int = 512 +# marks made at the start; a frame that takes more grows the pool (declared), up to its @max +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 { let xs = new []CompassMark for i in 0 .. COMPASS_POOL { push(xs, new CompassMark) } diff --git a/packages/ludic.compass/marks.ludic b/packages/ludic.compass/marks.ludic index 3c2af042..af6d9d02 100644 --- a/packages/ludic.compass/marks.ludic +++ b/packages/ludic.compass/marks.ludic @@ -26,11 +26,11 @@ export state CompassState { cmp_cap: int = 64 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_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_capturing: bool = false 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_cused: int = 0 cmp_ranges: []float = null diff --git a/packages/ludic.inventory/state.ludic b/packages/ludic.inventory/state.ludic index bc0fdc66..edcc5448 100644 --- a/packages/ludic.inventory/state.ludic +++ b/packages/ludic.inventory/state.ludic @@ -16,9 +16,9 @@ export property ItemChanged { const IV_POOL: int = 512 export state InventoryState { iv_keys: []string = null - iv_counts: []int = null + @max(1024) iv_counts: []int = null iv_changes: Queue = 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 } diff --git a/packages/ludic.net/state.ludic b/packages/ludic.net/state.ludic index 909d0c47..d4ddb5f7 100644 --- a/packages/ludic.net/state.ludic +++ b/packages/ludic.net/state.ludic @@ -51,7 +51,7 @@ export property NetMessage { export state NetState { net__cfg: NetConfig = new NetConfig net__facts: Queue = 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__watch_url: string = "" # the room's address, made once per room net__seen: []string = new []string # guests already punched for diff --git a/packages/ludic.ui/backend.ludic b/packages/ludic.ui/backend.ludic index 71e557d3..584d735e 100644 --- a/packages/ludic.ui/backend.ludic +++ b/packages/ludic.ui/backend.ludic @@ -32,7 +32,7 @@ function ui_default_backend() -> UiBackend { return UiRenderers[0].make() } 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 uv_on: bool = false # pool.ludic: a build is under way, so expressions' Values are pooled uv_true: Val = null @@ -43,7 +43,7 @@ export state UiState { mm_ivals: []Val = null ev_depth: int = 0 # eval.ludic: a call's arguments, in lists kept one a depth 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 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 @@ -52,8 +52,8 @@ export state UiState { ca_used: int = 0 ca_args: [][]CaVal = new [][]CaVal ca_depth: int = 0 - 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_evs: []UiPointer = pe_evs__new() # pointer_events.ludic: an event's record and its Value, a ring + @max(16) pe_vals: []Val = pe_vals__new() pe_at: int = 0 nth_a: int = 0 # select_nth.ludic: the a and b just read nth_b: int = 0 diff --git a/packages/ludic.ui/memo.ludic b/packages/ludic.ui/memo.ludic index 887fa0ff..6efe7eb5 100644 --- a/packages/ludic.ui/memo.ludic +++ b/packages/ludic.ui/memo.ludic @@ -5,15 +5,15 @@ const MM_CAP: int = 32768 # slots; at most three quarters are used export property UiMemo { slots: words = null # index + 1 into keys, 0 empty - 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 - lists: [][]string = null - grads: []UiGradient = null - 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 - vtpls: []UiVarTpl = null - n1: []float = null # numbers worked out from the key: a colour and its alpha - n2: []float = null + @max(24576) keys: []string = null # the text a result was made from (or the joined text itself) + @max(24576) tags: []int = null # what kind of result: a separator, or a kind below + @max(24576) lists: [][]string = null + @max(24576) grads: []UiGradient = null + @max(24576) texts: []string = null # a text worked out from the key: tw, el_url + @max(24576) vals: []Val = null # a Value made from it: cs_vars_in's + @max(24576) vtpls: []UiVarTpl = null + @max(24576) n1: []float = null # numbers worked out from the key: a colour and its alpha + @max(24576) n2: []float = null } const MM_WORDS: int = -1 # el_words: spaces, a bracket's own kept const MM_GRAD: int = -2