mem: typed allocation helpers + drop bare malloc/free (Phase 2.2); resolve 0119 as |>-contract clarification
This commit is contained in:
@@ -6,14 +6,15 @@ out :: (str: string) -> void #builtin;
|
||||
size_of :: ($T: Type) -> s64 #builtin;
|
||||
align_of :: ($T: Type) -> s64 #builtin;
|
||||
// Low-level libc bindings, used by allocator implementations to avoid
|
||||
// recursing through `context.allocator`.
|
||||
// recursing through `context.allocator`. The bare `malloc`/`free`
|
||||
// spellings are NOT declared: the Allocator protocol + the std/mem.sx
|
||||
// helpers are the allocation surface (`free` is the typed slice helper
|
||||
// there). Raw libc escape hatch: `libc_malloc` / `libc_free`.
|
||||
libc_malloc :: (size: s64) -> *void #foreign libc "malloc";
|
||||
libc_free :: (ptr: *void) -> void #foreign libc "free";
|
||||
|
||||
malloc :: (size: s64) -> *void #foreign libc "malloc";
|
||||
memcpy :: (dst: *void, src: *void, size: s64) -> *void #foreign libc "memcpy";
|
||||
memset :: (dst: *void, val: s64, size: s64) -> void #foreign libc "memset";
|
||||
free :: (ptr: *void) -> void #foreign libc "free";
|
||||
type_of :: (val: $T) -> Type #builtin;
|
||||
type_name :: ($T: Type) -> string #builtin;
|
||||
field_count :: ($T: Type) -> s64 #builtin;
|
||||
|
||||
Reference in New Issue
Block a user