mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Rename os.default_allocator to os.heap_allocator
This commit is contained in:
+3
-3
@@ -66,7 +66,7 @@ read_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
default_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
|
heap_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
|
||||||
size, alignment: int,
|
size, alignment: int,
|
||||||
old_memory: rawptr, old_size: int, flags: u64 = 0, loc := #caller_location) -> rawptr {
|
old_memory: rawptr, old_size: int, flags: u64 = 0, loc := #caller_location) -> rawptr {
|
||||||
using mem.Allocator_Mode;
|
using mem.Allocator_Mode;
|
||||||
@@ -91,9 +91,9 @@ default_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
default_allocator :: proc() -> mem.Allocator {
|
heap_allocator :: proc() -> mem.Allocator {
|
||||||
return mem.Allocator{
|
return mem.Allocator{
|
||||||
procedure = default_allocator_proc,
|
procedure = heap_allocator_proc,
|
||||||
data = nil,
|
data = nil,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ __init_context_from_ptr :: proc "contextless" (c: ^Context, other: ^Context) {
|
|||||||
__init_context :: proc "contextless" (c: ^Context) {
|
__init_context :: proc "contextless" (c: ^Context) {
|
||||||
if c == nil do return;
|
if c == nil do return;
|
||||||
|
|
||||||
c.allocator = os.default_allocator();
|
c.allocator = os.heap_allocator();
|
||||||
c.thread_id = os.current_thread_id();
|
c.thread_id = os.current_thread_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1334,7 +1334,7 @@ void generate_minimum_dependency_set(Checker *c, Entity *start) {
|
|||||||
|
|
||||||
AstPackage *os = get_core_package(&c->info, str_lit("os"));
|
AstPackage *os = get_core_package(&c->info, str_lit("os"));
|
||||||
String required_os_entities[] = {
|
String required_os_entities[] = {
|
||||||
str_lit("default_allocator"),
|
str_lit("heap_allocator"),
|
||||||
};
|
};
|
||||||
for (isize i = 0; i < gb_count_of(required_os_entities); i++) {
|
for (isize i = 0; i < gb_count_of(required_os_entities); i++) {
|
||||||
add_dependency_to_set(c, scope_lookup_entity(os->scope, required_mem_entities[i]));
|
add_dependency_to_set(c, scope_lookup_entity(os->scope, required_mem_entities[i]));
|
||||||
|
|||||||
+1
-1
@@ -1637,7 +1637,7 @@ irValue *ir_find_or_generate_context_ptr(irProcedure *proc) {
|
|||||||
|
|
||||||
irValue *ep = ir_emit_struct_ep(proc, c, 0);
|
irValue *ep = ir_emit_struct_ep(proc, c, 0);
|
||||||
Array<irValue *> args = {};
|
Array<irValue *> args = {};
|
||||||
irValue *v = ir_emit_package_call(proc, "os", "default_allocator", args);
|
irValue *v = ir_emit_package_call(proc, "os", "heap_allocator", args);
|
||||||
ir_emit_store(proc, ep, v);
|
ir_emit_store(proc, ep, v);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
|||||||
Reference in New Issue
Block a user