aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-07-14 00:34:34 +0100
committergingerBill <bill@gingerbill.org>2021-07-14 00:34:34 +0100
commitbd8e2f82bed231493718c811ea43e7aebed1fe8d (patch)
tree544e78f168cb680ef9fb8cd804968789d6bf3884 /src/main.cpp
parent69027b6840ae3e46291ff65353eb164ccb2f013e (diff)
Replace non-recursive mutexes with `BlockingMutex`; Minor improves to initialization improves
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8f4b13b23..d4659a41f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1976,6 +1976,8 @@ int main(int arg_count, char const **arg_ptr) {
timings_init(&global_timings, str_lit("Total Time"), 2048);
defer (timings_destroy(&global_timings));
+ TIME_SECTION("initialization");
+
arena_init(&permanent_arena, heap_allocator());
temp_allocator_init(&temporary_allocator_data, 16*1024*1024);
arena_init(&global_ast_arena, heap_allocator());
@@ -2138,9 +2140,11 @@ int main(int arg_count, char const **arg_ptr) {
init_universal();
// TODO(bill): prevent compiling without a linker
+ Parser parser = {0};
+ Checker checker = {0};
+
TIME_SECTION("parse files");
- Parser parser = {0};
if (!init_parser(&parser)) {
return 1;
}
@@ -2158,16 +2162,11 @@ int main(int arg_count, char const **arg_ptr) {
TIME_SECTION("type check");
- Checker checker = {0};
+ checker.parser = &parser;
+ init_checker(&checker);
+ defer (destroy_checker(&checker));
- bool checked_inited = init_checker(&checker, &parser);
- defer (if (checked_inited) {
- destroy_checker(&checker);
- });
-
- if (checked_inited) {
- check_parsed_files(&checker);
- }
+ check_parsed_files(&checker);
if (any_errors()) {
return 1;
}
@@ -2202,10 +2201,6 @@ int main(int arg_count, char const **arg_ptr) {
return 0;
}
- if (!checked_inited) {
- return 1;
- }
-
TIME_SECTION("LLVM API Code Gen");
lbGenerator gen = {};
if (!lb_init_generator(&gen, &checker)) {