From 8dc70f797cf8b4315d689ce94ab004faadb015b7 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 16 Mar 2023 15:16:17 +0000 Subject: Increase use of `temporary_allocator()` where possible --- src/llvm_backend_general.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/llvm_backend_general.cpp') diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp index 52ea4f399..aa887418f 100644 --- a/src/llvm_backend_general.cpp +++ b/src/llvm_backend_general.cpp @@ -496,6 +496,8 @@ gb_internal void lb_emit_bounds_check(lbProcedure *p, Token token, lbValue index return; } + TEMPORARY_ALLOCATOR_GUARD(); + index = lb_emit_conv(p, index, t_int); len = lb_emit_conv(p, len, t_int); @@ -503,7 +505,7 @@ gb_internal void lb_emit_bounds_check(lbProcedure *p, Token token, lbValue index lbValue line = lb_const_int(p->module, t_i32, token.pos.line); lbValue column = lb_const_int(p->module, t_i32, token.pos.column); - auto args = array_make(permanent_allocator(), 5); + auto args = array_make(temporary_allocator(), 5); args[0] = file; args[1] = line; args[2] = column; @@ -521,6 +523,8 @@ gb_internal void lb_emit_matrix_bounds_check(lbProcedure *p, Token token, lbValu return; } + TEMPORARY_ALLOCATOR_GUARD(); + row_index = lb_emit_conv(p, row_index, t_int); column_index = lb_emit_conv(p, column_index, t_int); row_count = lb_emit_conv(p, row_count, t_int); @@ -530,7 +534,7 @@ gb_internal void lb_emit_matrix_bounds_check(lbProcedure *p, Token token, lbValu lbValue line = lb_const_int(p->module, t_i32, token.pos.line); lbValue column = lb_const_int(p->module, t_i32, token.pos.column); - auto args = array_make(permanent_allocator(), 7); + auto args = array_make(temporary_allocator(), 7); args[0] = file; args[1] = line; args[2] = column; @@ -1336,6 +1340,7 @@ gb_internal void lb_emit_store_union_variant(lbProcedure *p, lbValue parent, lbV gb_internal void lb_clone_struct_type(LLVMTypeRef dst, LLVMTypeRef src) { + TEMPORARY_ALLOCATOR_GUARD(); unsigned field_count = LLVMCountStructElementTypes(src); LLVMTypeRef *fields = gb_alloc_array(temporary_allocator(), LLVMTypeRef, field_count); LLVMGetStructElementTypes(src, fields); -- cgit v1.2.3