feat(compiler): the built-in ECS's stores grow - 100 000 entities, where 1024 was the wall
Every per-entity store (@S_ components, @H_ flags, alive, kind, freelist, owners) is a heap block
L_grow doubles from 1024 as L_alloc hands out a slot past it, the new slots zeroed; each site loads
the store's base where it indexes it (ecs_base, its registers %ecsb* so a raw function's t0 labels
cannot collide). Prop.has bounds against @L_cap, Pool.capacity answers it, a mod's registered
stores grow with the rest, every main grows the stores once before anything reads them. A snapshot
records its slot count first and a load grows to it before reading back. The overflow stop of
1c7ce84 is gone with the wall. ludic-dev test 305 passed, selfhost-test 33 passed; 1000 / 5000 /
100000 entities spawn and count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0c6235e55b
commit
8384ad3215
13 changed files with 27441 additions and 26036 deletions
|
|
@ -25,7 +25,8 @@ function emit_query(st: Node) -> void {
|
|||
emit(body); emit(":\n"); g_term = false
|
||||
let i1 = emit_bind(`load i32, ptr {ip}`)
|
||||
# alive?
|
||||
let ap = nreg(); emit(" "); emit(ap); emit(" = getelementptr inbounds ["); emit(me); emit(" x i32], ptr @L_alive, i32 0, i32 "); emit(i1); emit("\n")
|
||||
let eb1 = ecs_base("L_alive")
|
||||
let ap = nreg(); emit(" "); emit(ap); emit(" = getelementptr inbounds i32, ptr "); emit(eb1); emit(", i32 "); emit(i1); emit("\n")
|
||||
let al = emit_bind(`load i32, ptr {ap}`)
|
||||
let alc = emit_bind(`icmp ne i32 {al}, 0`)
|
||||
let ka = lbl("qa")
|
||||
|
|
@ -40,14 +41,16 @@ function emit_query(st: Node) -> void {
|
|||
let ak = find_arch_id(tm.s)
|
||||
var ok: pointer = "0"
|
||||
if ak > 0 {
|
||||
let kp = nreg(); emit(" "); emit(kp); emit(" = getelementptr inbounds ["); emit(me); emit(" x i32], ptr @L_kind, i32 0, i32 "); emit(i1); emit("\n")
|
||||
let eb2 = ecs_base("L_kind")
|
||||
let kp = nreg(); emit(" "); emit(kp); emit(" = getelementptr inbounds i32, ptr "); emit(eb2); emit(", i32 "); emit(i1); emit("\n")
|
||||
let kv = emit_bind(`load i32, ptr {kp}`)
|
||||
let kok = emit_bind(`icmp eq i32 {kv}, {itoa(ak)}`)
|
||||
let mev = emit_bind(`load i32, ptr @ME_{tm.s}`) # model-enabled flag
|
||||
let meok = emit_bind(`icmp ne i32 {mev}, 0`)
|
||||
ok = emit_bind(`and i1 {kok}, {meok}`)
|
||||
} else {
|
||||
let hp = nreg(); emit(" "); emit(hp); emit(" = getelementptr inbounds ["); emit(me); emit(" x i8], ptr @H_"); emit(tm.s); emit(", i32 0, i32 "); emit(i1); emit("\n")
|
||||
let eb3 = ecs_base(`H_{tm.s}`)
|
||||
let hp = nreg(); emit(" "); emit(hp); emit(" = getelementptr inbounds i8, ptr "); emit(eb3); emit(", i32 "); emit(i1); emit("\n")
|
||||
let hv = emit_bind(`load i8, ptr {hp}`)
|
||||
ok = emit_bind(`icmp ne i8 {hv}, 0`)
|
||||
}
|
||||
|
|
@ -66,7 +69,8 @@ function emit_query(st: Node) -> void {
|
|||
if tm.ival == 0 and find_arch_id(tm.s) == 0 {
|
||||
if vi < len(st.kids) {
|
||||
let slot = nreg()
|
||||
emit(" "); emit(slot); emit(" = getelementptr inbounds ["); emit(me); emit(" x %Cmp_"); emit(tm.s); emit("], ptr @S_"); emit(tm.s); emit(", i32 0, i32 "); emit(i1); emit("\n")
|
||||
let eb4 = ecs_base(`S_{tm.s}`)
|
||||
emit(" "); emit(slot); emit(" = getelementptr inbounds %Cmp_"); emit(tm.s); emit(", ptr "); emit(eb4); emit(", i32 "); emit(i1); emit("\n")
|
||||
let vslot = emit_alloca("ptr")
|
||||
emit(" store ptr "); emit(slot); emit(", ptr "); emit(vslot); emit("\n")
|
||||
loc_push(st.kids[vi].s, vslot, tm.s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue