ludic/selfhost/backend/game
Orkuncakilkaya a8d54e9878 fence (25.1): every allocation goes through the fence - sites, frame judging, census, callers
Every allocation the compiler emits goes through @lp_malloc/@lp_calloc/@lp_realloc/@lp_free, and a
Ludic-level one first stores its site (function, file, line, kind) in @lp_site. Off, that is one load
and a predictable branch (30 M allocations: 0.87-0.91 s against 0.87-0.90 s on leaks2).

On (the default in a headless build, and windowed under R3D_DEV), tracking starts at the first frame
on its own and judging once R3D_ALLOC_WARM frames in a row kept nothing (600) or R3D_ALLOC_WARM_MAX
after (re)start; Mem.play()/Mem.rewarm() sends a load back to its warm-up. A judged frame that ends
holding more than it began with is reported by site with its callers (the unwinder, taken only once
judging) and fails the run with exit 86 (R3D_ALLOC_FENCE=off|count|warn|fail). R3D_ALLOC_CENSUS
writes the totals and top sites at exit. The build's defaults are --fence=, --fence-warm=,
--fence-census= or a fence line in the program's package.ludic; the environment overrides them.

The runtime is IR (emit_fence_ir.ludic, generated from a template); tracking is a side table in one
calloc'd region, so no block carries a header and pointers crossing to natives stay safe. Examples
alloc_fence, alloc_fence_leak and alloc_fence_auto with cases in ludic-dev test; reseeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:35:29 +03:00
..
emit_collide.ludic refactor(selfhost): reorganise into concern-based subdirectories 2026-08-31 00:26:02 +03:00
emit_ecs.ludic fence (25.1): every allocation goes through the fence - sites, frame judging, census, callers 2026-09-28 15:35:29 +03:00
emit_game.ludic fence (25.1): every allocation goes through the fence - sites, frame judging, census, callers 2026-09-28 15:35:29 +03:00
emit_machine.ludic wip(0.S3): calls into the runtime get its states supplied; the emitter's own calls to runtime functions reach their thunks; the migration names the runtime's states per file 2026-09-25 15:44:50 +03:00
emit_query.ludic feat(compiler): the built-in ECS's stores grow - 100 000 entities, where 1024 was the wall 2026-09-27 22:53:24 +03:00
emit_save.ludic feat(compiler): the built-in ECS's stores grow - 100 000 entities, where 1024 was the wall 2026-09-27 22:53:24 +03:00
emit_spawn.ludic feat(compiler): the built-in ECS's stores grow - 100 000 entities, where 1024 was the wall 2026-09-27 22:53:24 +03:00
emit_ui.ludic wip(0.S3): calls into the runtime get its states supplied; the emitter's own calls to runtime functions reach their thunks; the migration names the runtime's states per file 2026-09-25 15:44:50 +03:00
emit_world.ludic fence (25.1): every allocation goes through the fence - sites, frame judging, census, callers 2026-09-28 15:35:29 +03:00