Add mem.Allocator_Query_Info and mem.query_info

This commit is contained in:
gingerBill
2020-08-16 23:05:33 +01:00
parent 033b46def8
commit e7f54d25d6
5 changed files with 86 additions and 14 deletions
+10 -4
View File
@@ -234,6 +234,9 @@ args__: []cstring;
// IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)
@builtin
Maybe :: union(T: typeid) #maybe {T};
Source_Code_Location :: struct {
file_path: string,
@@ -252,10 +255,17 @@ Allocator_Mode :: enum byte {
Free_All,
Resize,
Query_Features,
Query_Info,
}
Allocator_Mode_Set :: distinct bit_set[Allocator_Mode];
Allocator_Query_Info :: struct {
pointer: rawptr,
size: Maybe(int),
alignment: Maybe(int),
}
Allocator_Proc :: #type proc(allocator_data: rawptr, mode: Allocator_Mode,
size, alignment: int,
old_memory: rawptr, old_size: int, flags: u64 = 0, location: Source_Code_Location = #caller_location) -> rawptr;
@@ -310,10 +320,6 @@ Context :: struct {
}
@builtin
Maybe :: union(T: typeid) #maybe {T};
@thread_local global_default_temp_allocator_data: Default_Temp_Allocator;
+3
View File
@@ -139,6 +139,9 @@ default_temp_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode
set^ = {.Alloc, .Free, .Free_All, .Resize, .Query_Features};
}
return set;
case .Query_Info:
return nil;
}
return nil;