allocator interface (first pass)

This commit is contained in:
2026-07-06 21:24:49 +02:00
parent 7ce3917c15
commit 95c61311ca
24 changed files with 833 additions and 161 deletions
+20
View File
@@ -0,0 +1,20 @@
mem :: import "@std/mem"
main func() i32 {
memory ?*mut u8 = mem.alloc(mem.heap, 4, 1)
defer mem.free(mem.heap, memory, 4, 1)
if memory |bytes| {
bytes[0] = 10
bytes[1] = 20
bytes[2] = bytes[0] + bytes[1]
if (bytes[2] != 30) {
return 2
}
return 0
}
return 1
}