fence (25.1c): the census reads the heap outside Ludic's blocks; blocks counted at malloc's own size

The census's native line is malloc's live bytes over every zone since judging began less what
Ludic's tracked blocks kept - the libraries' and drivers' growth, read before the census file is
opened. A tracked block counts malloc_size(), not the size asked for, so kept is what the heap pays
and the residual carries no rounding. @malloc_zone_statistics is declared once, by the fence or by
Os.heap_bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 15:38:13 +03:00
parent a8d54e9878
commit 691964877b
7 changed files with 47519 additions and 47279 deletions

View file

@ -264,7 +264,7 @@ function emit_os_prelude() -> void {
# Os.heap_bytes: malloc_zone_statistics' in-use bytes, all zones. The symbol is weak, so a libc
# without it links and reads 0.
function emit_os_heap() -> void {
emith("declare extern_weak void @malloc_zone_statistics(ptr, ptr)\n")
if not g_mzs_declared { emith("declare extern_weak void @malloc_zone_statistics(ptr, ptr)\n"); g_mzs_declared = true }
emith("define i64 @lp_os_heap_bytes() {\n")
emith("entry:\n %has = icmp ne ptr @malloc_zone_statistics, null\n br i1 %has, label %read, label %none\n")
emith("none:\n ret i64 0\n")