Merge lang/foundations 6fb5118 into lang/ecs

This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:46:20 +03:00
commit 54c0feafc2
8 changed files with 73094 additions and 71750 deletions

View file

@ -45,7 +45,10 @@ export function sb_intern(sb: StrBuf, tb: StrTable) -> string {
slot = (slot + 1) & mask
}
let s = text_of(sb.b, sb.n)
if len(tb.ss) >= tb.most { return s }
if len(tb.ss) >= tb.most {
Mem.over("a StrTable past its most (sb_intern)") # 25.5a: a full table is a failure, not a copy per call
return s
}
push(tb.ss, s)
tb.hs[slot] = h
tb.at[slot] = len(tb.ss)

View file

@ -78,7 +78,10 @@ function mm_find(m: UiMemo, tag: int, s: string) -> int {
# a new entry for (tag, s) with its results empty, or -1 when the table is full
@alloc_ok("a memo entry: one per distinct text, bounded by MM_CAP")
function mm_add(m: UiMemo, tag: int, s: string) -> int {
if len(m.keys) * 4 >= MM_CAP * 3 { return -1 }
if len(m.keys) * 4 >= MM_CAP * 3 {
Mem.over("ludic.ui's memo, three quarters of MM_CAP") # 25.5a: past it every miss was made and lost
return -1
}
var at = mm_hash(tag, s) & (MM_CAP - 1)
while m.slots[at] != 0 { at = (at + 1) & (MM_CAP - 1) }
push(m.keys, s)