|
@@ -3457,9 +3457,12 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
|
|
|
isize slice_len = var_args.count;
|
|
|
if (slice_len > 0) {
|
|
|
lbAddr base_array = {};
|
|
|
+ lbAddr slice = {};
|
|
|
+
|
|
|
for (auto const &vr : p->variadic_reuses) {
|
|
|
if (are_types_identical(vr.slice_type, slice_type)) {
|
|
|
base_array = vr.base_array;
|
|
|
+ slice = vr.slice_addr;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -3468,14 +3471,15 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
|
|
|
for (auto const &vr : d->variadic_reuses) {
|
|
|
if (are_types_identical(vr.slice_type, slice_type)) {
|
|
|
base_array = lb_add_local_generated(p, alloc_type_array(elem_type, vr.max_count), true);
|
|
|
- array_add(&p->variadic_reuses, lbVariadicReuseData{slice_type, base_array});
|
|
|
+ slice = lb_add_local_generated(p, slice_type, true);
|
|
|
+ array_add(&p->variadic_reuses, lbVariadicReuseData{slice_type, base_array, slice});
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
GB_ASSERT(base_array.addr.value != nullptr);
|
|
|
+ GB_ASSERT(slice.addr.value != nullptr);
|
|
|
|
|
|
- lbAddr slice = lb_add_local_generated(p, slice_type, true);
|
|
|
|
|
|
for (isize i = 0; i < var_args.count; i++) {
|
|
|
lbValue addr = lb_emit_array_epi(p, base_array.addr, cast(i32)i);
|