mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge branch 'master' into new-temp-allocator
This commit is contained in:
@@ -231,13 +231,12 @@ make_dynamic_array_len_cap :: proc($T: typeid/[dynamic]$E, #any_int len: int, #a
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
@(builtin)
|
@(builtin)
|
||||||
make_map :: proc($T: typeid/map[$K]$E, #any_int capacity: int = 1<<MAP_MIN_LOG2_CAPACITY, allocator := context.allocator, loc := #caller_location) -> T {
|
make_map :: proc($T: typeid/map[$K]$E, #any_int capacity: int = 1<<MAP_MIN_LOG2_CAPACITY, allocator := context.allocator, loc := #caller_location) -> (m: T, err: Allocator_Error) #optional_allocator_error {
|
||||||
make_map_expr_error_loc(loc, capacity)
|
make_map_expr_error_loc(loc, capacity)
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
m: T
|
err = reserve_map(&m, capacity, loc)
|
||||||
reserve_map(&m, capacity, loc)
|
return
|
||||||
return m
|
|
||||||
}
|
}
|
||||||
@(builtin)
|
@(builtin)
|
||||||
make_multi_pointer :: proc($T: typeid/[^]$E, #any_int len: int, allocator := context.allocator, loc := #caller_location) -> (mp: T, err: Allocator_Error) #optional_allocator_error {
|
make_multi_pointer :: proc($T: typeid/[^]$E, #any_int len: int, allocator := context.allocator, loc := #caller_location) -> (mp: T, err: Allocator_Error) #optional_allocator_error {
|
||||||
@@ -276,10 +275,8 @@ clear_map :: proc "contextless" (m: ^$T/map[$K]$V) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@builtin
|
@builtin
|
||||||
reserve_map :: proc(m: ^$T/map[$K]$V, capacity: int, loc := #caller_location) {
|
reserve_map :: proc(m: ^$T/map[$K]$V, capacity: int, loc := #caller_location) -> Allocator_Error {
|
||||||
if m != nil {
|
return __dynamic_map_reserve((^Raw_Map)(m), map_info(T), uint(capacity), loc) if m != nil else nil
|
||||||
__dynamic_map_reserve((^Raw_Map)(m), map_info(T), uint(capacity), loc)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -937,8 +937,8 @@ gb_internal void lb_emit_store(lbProcedure *p, lbValue ptr, lbValue value) {
|
|||||||
|
|
||||||
enum {MAX_STORE_SIZE = 64};
|
enum {MAX_STORE_SIZE = 64};
|
||||||
|
|
||||||
if (!p->in_multi_assignment && lb_sizeof(LLVMTypeOf(value.value)) > MAX_STORE_SIZE) {
|
if (lb_sizeof(LLVMTypeOf(value.value)) > MAX_STORE_SIZE) {
|
||||||
if (LLVMIsALoadInst(value.value)) {
|
if (!p->in_multi_assignment && LLVMIsALoadInst(value.value)) {
|
||||||
LLVMValueRef dst_ptr = ptr.value;
|
LLVMValueRef dst_ptr = ptr.value;
|
||||||
LLVMValueRef src_ptr_original = LLVMGetOperand(value.value, 0);
|
LLVMValueRef src_ptr_original = LLVMGetOperand(value.value, 0);
|
||||||
LLVMValueRef src_ptr = LLVMBuildPointerCast(p->builder, src_ptr_original, LLVMTypeOf(dst_ptr), "");
|
LLVMValueRef src_ptr = LLVMBuildPointerCast(p->builder, src_ptr_original, LLVMTypeOf(dst_ptr), "");
|
||||||
@@ -984,7 +984,7 @@ gb_internal void lb_emit_store(lbProcedure *p, lbValue ptr, lbValue value) {
|
|||||||
|
|
||||||
instr = LLVMBuildStore(p->builder, value.value, ptr.value);
|
instr = LLVMBuildStore(p->builder, value.value, ptr.value);
|
||||||
}
|
}
|
||||||
LLVMSetVolatile(instr, p->in_multi_assignment);
|
// LLVMSetVolatile(instr, p->in_multi_assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
gb_internal LLVMTypeRef llvm_addr_type(lbModule *module, lbValue addr_val) {
|
gb_internal LLVMTypeRef llvm_addr_type(lbModule *module, lbValue addr_val) {
|
||||||
|
|||||||
Reference in New Issue
Block a user