Merge branch 'r3d/zero-leak' into lang/uifree

This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 11:21:22 +03:00
commit 0ec39f8e4e
9 changed files with 119 additions and 19 deletions

View file

@ -28,6 +28,8 @@ import "vk_api.ludic"
# Once a frame: on macOS drains what MoltenVK and the layer autoreleased during the last one (a
# program pumping its own events has no other pool); nothing elsewhere.
extern function vk_frame_pool() = "lvk_frame_pool"
# malloc's live bytes (macOS; 0 elsewhere): a test that a path allocates nothing, frame after frame
extern function vk_heap_bytes() -> long = "lvk_heap_bytes"
extern function vk_sl_prefer(on: int) = "lvk_sl_prefer"
extern function vk_sl_active() -> int = "lvk_sl_active"
extern function vk_sl_init(pref: pointer, sdk_version: long) -> int = "lsl_slInit"

View file

@ -250,3 +250,17 @@ push:
store ptr %p, ptr @lvk_pool
ret void
}
; ---- the heap in use --------------------------------------------------------------------------
; malloc's live bytes across the default zones, for a test that proves a path allocates nothing in
; its steady state (render3d's examples/rendering/steady.ludic). malloc_statistics_t is four
; words: blocks_in_use (u32, padded), size_in_use, max_size_in_use, size_allocated.
declare void @malloc_zone_statistics(ptr, ptr)
define i64 @lvk_heap_bytes() {
entry:
%st = alloca [4 x i64], align 8
call void @malloc_zone_statistics(ptr null, ptr %st)
%p = getelementptr [4 x i64], ptr %st, i32 0, i32 1
%n = load i64, ptr %p
ret i64 %n
}

View file

@ -369,3 +369,9 @@ define void @lvk_frame_pool() {
entry:
ret void
}
; the heap's live bytes are asked for on the Mac only (vk_mac.ll); 0 here, and a test skips its check
define i64 @lvk_heap_bytes() {
entry:
ret i64 0
}