Skip to content

Commit 70f147c

Browse files
committed
Fix bb_insn_dump & var_list_t reallocation
1 parent 197624d commit 70f147c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/globals.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ void dump_insn()
13061306

13071307
for (int k = 0; k < func->param_defs[i].is_ptr; k++)
13081308
printf("*");
1309-
printf(" %%%s", func->param_defs[i].type->type_name);
1309+
printf(" %%%s", func->param_defs[i].var_name);
13101310
}
13111311
printf(") {\n");
13121312

src/parser.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ var_t *require_var(block_t *blk)
4141
var_list_t *var_list = &blk->locals;
4242

4343
if (var_list->size >= var_list->capacity) {
44-
var_list->capacity *= 2;
44+
var_list->capacity <<= 1;
4545

46-
var_t **new_locals = calloc(var_list->capacity, sizeof(var_t *));
46+
var_t **new_locals =
47+
arena_alloc(BLOCK_ARENA, var_list->capacity * sizeof(var_t *));
4748
memcpy(new_locals, var_list->elements,
4849
var_list->size * sizeof(var_t *));
4950
var_list->elements = new_locals;

0 commit comments

Comments
 (0)