aboutsummaryrefslogtreecommitdiff
path: root/core/runtime
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-08-16 23:05:33 +0100
committergingerBill <bill@gingerbill.org>2020-08-16 23:05:33 +0100
commite7f54d25d6ee598eabb74a526e3eff7cdeb0a287 (patch)
tree73cec34d8c50af10fc89291e481957a1c979d8dc /core/runtime
parent033b46def884b94d3095f1f4fb71ca9cf0819081 (diff)
Add `mem.Allocator_Query_Info` and `mem.query_info`
Diffstat (limited to 'core/runtime')
-rw-r--r--core/runtime/core.odin14
-rw-r--r--core/runtime/default_allocators.odin3
2 files changed, 13 insertions, 4 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index d3522c268..4e871351b 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -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;
diff --git a/core/runtime/default_allocators.odin b/core/runtime/default_allocators.odin
index 3643fccdf..14f4edcda 100644
--- a/core/runtime/default_allocators.odin
+++ b/core/runtime/default_allocators.odin
@@ -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;