aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-04-07 11:47:28 +0100
committergingerBill <bill@gingerbill.org>2020-04-07 11:47:28 +0100
commit29a3cb25d3e8db9ce9b42a68413c10c8551c4362 (patch)
tree329f331d1607f644450b9e4b6505cea8515dce85 /src/parser.cpp
parent7ff690500ac74b916da4df6a6eb62c4dac8ced2b (diff)
Add extra guards for window-only performance checking
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 937e84279..b05f7df2f 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -442,15 +442,15 @@ bool ast_node_expect(Ast *node, AstKind kind) {
}
-gb_global isize volatile total_allocated_node_memory = 0;
-gb_global isize volatile total_subtype_node_memory_test = 0;
+gb_global gbAtomic64 total_allocated_node_memory = {0};
+gb_global gbAtomic64 total_subtype_node_memory_test = {0};
// 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();
- _InterlockedExchangeAdd64(&total_allocated_node_memory, gb_size_of(Ast));
- _InterlockedExchangeAdd64(&total_subtype_node_memory_test, gb_size_of(AstCommonStuff) + ast_variant_sizes[kind]);
+ gb_atomic64_fetch_add(&total_allocated_node_memory, cast(i64)(gb_size_of(Ast)));
+ gb_atomic64_fetch_add(&total_subtype_node_memory_test, cast(i64)(gb_size_of(AstCommonStuff) + ast_variant_sizes[kind]));
Ast *node = gb_alloc_item(a, Ast);
node->kind = kind;