|
@@ -57,6 +57,9 @@ isize ast_node_size(AstKind kind) {
|
|
|
return align_formula_isize(gb_size_of(AstCommonStuff) + ast_variant_sizes[kind], gb_align_of(void *));
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+gb_global std::atomic<isize> global_total_node_memory_allocated;
|
|
|
+
|
|
|
// NOTE(bill): And this below is why is I/we need a new language! Discriminated unions are a pain in C/C++
|
|
|
Ast *alloc_ast_node(AstFile *f, AstKind kind) {
|
|
|
gbAllocator a = ast_allocator(f);
|
|
@@ -66,6 +69,9 @@ Ast *alloc_ast_node(AstFile *f, AstKind kind) {
|
|
|
Ast *node = cast(Ast *)gb_alloc(a, size);
|
|
|
node->kind = kind;
|
|
|
node->file_id = f ? f->id : 0;
|
|
|
+
|
|
|
+ global_total_node_memory_allocated += size;
|
|
|
+
|
|
|
return node;
|
|
|
}
|
|
|
|
|
@@ -4851,12 +4857,6 @@ ParseFileError init_ast_file(AstFile *f, String fullpath, TokenPos *err_pos) {
|
|
|
f->prev_token = f->tokens[f->prev_token_index];
|
|
|
f->curr_token = f->tokens[f->curr_token_index];
|
|
|
|
|
|
- isize const page_size = 4*1024;
|
|
|
- isize block_size = 2*f->tokens.count*gb_size_of(Ast);
|
|
|
- block_size = ((block_size + page_size-1)/page_size) * page_size;
|
|
|
- block_size = gb_clamp(block_size, page_size, DEFAULT_MINIMUM_BLOCK_SIZE);
|
|
|
- f->arena.minimum_block_size = block_size;
|
|
|
-
|
|
|
array_init(&f->comments, heap_allocator(), 0, 0);
|
|
|
array_init(&f->imports, heap_allocator(), 0, 0);
|
|
|
|