aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-26 23:10:15 +0100
committergingerBill <bill@gingerbill.org>2021-08-26 23:10:15 +0100
commitda79124e5d43c54a358fd18b64414ec2c1536476 (patch)
treecdf5d0379fb49cd209c903b4e17282c2bf8050e8 /src/parser.cpp
parent2f34f1283a067335d5738abe15997e6af5e3a600 (diff)
Use local mutex for each `AstFile.arena`
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index d8f3a9e33..f77179ea7 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -4786,6 +4786,7 @@ ParseFileError init_ast_file(AstFile *f, String fullpath, TokenPos *err_pos) {
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;
+ arena_init_local_mutex(&f->arena);
array_init(&f->comments, heap_allocator(), 0, 0);
@@ -5539,7 +5540,7 @@ ParseFileError process_imported_file(Parser *p, ImportedFile imported_file) {
FileInfo fi = imported_file.fi;
TokenPos pos = imported_file.pos;
- AstFile *file = gb_alloc_item(heap_allocator(), AstFile);
+ AstFile *file = gb_alloc_item(permanent_allocator(), AstFile);
file->pkg = pkg;
file->id = cast(i32)(imported_file.index+1);
TokenPos err_pos = {0};