@@ -2673,15 +2673,15 @@ static bool get_prefix_arg_err_ret_stack(CodeGen *g, TypeTableEntry *src_return_
2673
2673
}
2674
2674
2675
2675
static size_t get_async_allocator_arg_index (CodeGen *g, TypeTableEntry *src_return_type) {
2676
- // 0 1 2 3 4 5
2677
- // err_ret_stack allocator_ptr alloc free err_code other_args...
2676
+ // 0 1 2 3
2677
+ // err_ret_stack allocator_ptr err_code other_args...
2678
2678
return get_prefix_arg_err_ret_stack (g, src_return_type) ? 1 : 0 ;
2679
2679
}
2680
2680
2681
2681
static size_t get_async_err_code_arg_index (CodeGen *g, TypeTableEntry *src_return_type) {
2682
- // 0 1 2 3 4 5
2683
- // err_ret_stack allocator_ptr alloc free err_code other_args...
2684
- return 3 + get_async_allocator_arg_index (g, src_return_type);
2682
+ // 0 1 2 3
2683
+ // err_ret_stack allocator_ptr err_code other_args...
2684
+ return 1 + get_async_allocator_arg_index (g, src_return_type);
2685
2685
}
2686
2686
2687
2687
static LLVMValueRef ir_render_call (CodeGen *g, IrExecutable *executable, IrInstructionCall *instruction) {
@@ -2704,8 +2704,8 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
2704
2704
bool first_arg_ret = ret_has_bits && handle_is_ptr (src_return_type) &&
2705
2705
calling_convention_does_first_arg_return (fn_type->data .fn .fn_type_id .cc );
2706
2706
bool prefix_arg_err_ret_stack = get_prefix_arg_err_ret_stack (g, src_return_type);
2707
- // +4 for the async args
2708
- size_t actual_param_count = instruction->arg_count + (first_arg_ret ? 1 : 0 ) + (prefix_arg_err_ret_stack ? 1 : 0 ) + 4 ;
2707
+ // +2 for the async args
2708
+ size_t actual_param_count = instruction->arg_count + (first_arg_ret ? 1 : 0 ) + (prefix_arg_err_ret_stack ? 1 : 0 ) + 2 ;
2709
2709
bool is_var_args = fn_type_id->is_var_args ;
2710
2710
LLVMValueRef *gen_param_values = allocate<LLVMValueRef>(actual_param_count);
2711
2711
size_t gen_param_index = 0 ;
@@ -2721,12 +2721,6 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
2721
2721
gen_param_values[gen_param_index] = ir_llvm_value (g, instruction->async_allocator );
2722
2722
gen_param_index += 1 ;
2723
2723
2724
- gen_param_values[gen_param_index] = ir_llvm_value (g, instruction->alloc_fn );
2725
- gen_param_index += 1 ;
2726
-
2727
- gen_param_values[gen_param_index] = ir_llvm_value (g, instruction->free_fn );
2728
- gen_param_index += 1 ;
2729
-
2730
2724
LLVMValueRef err_val_ptr = LLVMBuildStructGEP (g->builder , instruction->tmp_ptr , err_union_err_index, " " );
2731
2725
LLVMBuildStore (g->builder , LLVMConstNull (g->builtin_types .entry_global_error_set ->type_ref ), err_val_ptr);
2732
2726
gen_param_values[gen_param_index] = err_val_ptr;
@@ -3308,15 +3302,7 @@ static LLVMValueRef ir_render_get_implicit_allocator(CodeGen *g, IrExecutable *e
3308
3302
{
3309
3303
TypeTableEntry *src_return_type = g->cur_fn ->type_entry ->data .fn .fn_type_id .return_type ;
3310
3304
size_t allocator_arg_index = get_async_allocator_arg_index (g, src_return_type);
3311
- switch (instruction->id ) {
3312
- case ImplicitAllocatorIdContext:
3313
- return LLVMGetParam (g->cur_fn_val , allocator_arg_index + 0 );
3314
- case ImplicitAllocatorIdAlloc:
3315
- return LLVMGetParam (g->cur_fn_val , allocator_arg_index + 1 );
3316
- case ImplicitAllocatorIdFree:
3317
- return LLVMGetParam (g->cur_fn_val , allocator_arg_index + 2 );
3318
- }
3319
- zig_unreachable ();
3305
+ return LLVMGetParam (g->cur_fn_val , allocator_arg_index);
3320
3306
}
3321
3307
3322
3308
static LLVMAtomicOrdering to_LLVMAtomicOrdering (AtomicOrder atomic_order) {
0 commit comments