Unify thread pool logic across the rest of the compiler, using a global thread pool

This commit is contained in:
gingerBill
2021-08-26 21:22:30 +01:00
parent aba14c43ac
commit ad3a3547d6
9 changed files with 189 additions and 142 deletions
+2 -5
View File
@@ -1104,9 +1104,6 @@ void lb_generate_code(lbGenerator *gen) {
LLVMBool do_threading = (LLVMIsMultithreaded() && USE_SEPARATE_MODULES && MULTITHREAD_OBJECT_GENERATION && worker_count > 0);
thread_pool_init(&lb_thread_pool, heap_allocator(), worker_count, "LLVMBackend");
defer (thread_pool_destroy(&lb_thread_pool));
lbModule *default_module = &gen->default_module;
CheckerInfo *info = gen->info;
@@ -1691,10 +1688,10 @@ void lb_generate_code(lbGenerator *gen) {
wd->code_gen_file_type = code_gen_file_type;
wd->filepath_obj = filepath_obj;
wd->m = m;
thread_pool_add_task(&lb_thread_pool, lb_llvm_emit_worker_proc, wd);
global_thread_pool_add_task(lb_llvm_emit_worker_proc, wd);
}
thread_pool_wait(&lb_thread_pool);
thread_pool_wait(&global_thread_pool);
} else {
for_array(j, gen->modules.entries) {
lbModule *m = gen->modules.entries[j].value;