| ... | ... | @@ -7303,8 +7303,12 @@ static void do_code_gen(CodeGen *g) { |
| 7303 | 7303 | } |
| 7304 | 7304 | |
| 7305 | 7305 | // Generate function definitions. |
| 7306 | stage2_progress_update_node(g->sub_progress_node, 0, g->fn_defs.length); |
| 7306 | 7307 | for (size_t fn_i = 0; fn_i < g->fn_defs.length; fn_i += 1) { |
| 7307 | 7308 | ZigFn *fn_table_entry = g->fn_defs.at(fn_i); |
| 7309 | Stage2ProgressNode *fn_prog_node = stage2_progress_start(g->sub_progress_node, |
| 7310 | buf_ptr(&fn_table_entry->symbol_name), buf_len(&fn_table_entry->symbol_name), 0); |
| 7311 | |
| 7308 | 7312 | FnTypeId *fn_type_id = &fn_table_entry->type_entry->data.fn.fn_type_id; |
| 7309 | 7313 | CallingConvention cc = fn_type_id->cc; |
| 7310 | 7314 | bool is_c_abi = cc == CallingConventionC; |
| ... | ... | @@ -7568,6 +7572,7 @@ static void do_code_gen(CodeGen *g) { |
| 7568 | 7572 | |
| 7569 | 7573 | ir_render(g, fn_table_entry); |
| 7570 | 7574 | |
| 7575 | stage2_progress_end(fn_prog_node); |
| 7571 | 7576 | } |
| 7572 | 7577 | |
| 7573 | 7578 | assert(!g->errors.length); |
| ... | ... | @@ -7615,7 +7620,7 @@ static void zig_llvm_emit_output(CodeGen *g) { |
| 7615 | 7620 | if (g->bundle_compiler_rt && (g->out_type == OutTypeObj || |
| 7616 | 7621 | (g->out_type == OutTypeLib && !g->is_dynamic))) |
| 7617 | 7622 | { |
| 7618 | | zig_link_add_compiler_rt(g, g->progress_node); |
| 7623 | zig_link_add_compiler_rt(g, g->sub_progress_node); |
| 7619 | 7624 | } |
| 7620 | 7625 | break; |
| 7621 | 7626 | |
| ... | ... | @@ -9458,7 +9463,7 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose |
| 9458 | 9463 | } |
| 9459 | 9464 | |
| 9460 | 9465 | // returns true if it was a cache miss |
| 9461 | | static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file, Stage2ProgressNode *parent_prog_node) { |
| 9466 | static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) { |
| 9462 | 9467 | Error err; |
| 9463 | 9468 | |
| 9464 | 9469 | Buf *artifact_dir; |
| ... | ... | @@ -9470,7 +9475,7 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file, Stage2Pr |
| 9470 | 9475 | Buf *c_source_basename = buf_alloc(); |
| 9471 | 9476 | os_path_split(c_source_file, nullptr, c_source_basename); |
| 9472 | 9477 | |
| 9473 | | Stage2ProgressNode *child_prog_node = stage2_progress_start(parent_prog_node, buf_ptr(c_source_basename), |
| 9478 | Stage2ProgressNode *child_prog_node = stage2_progress_start(g->sub_progress_node, buf_ptr(c_source_basename), |
| 9474 | 9479 | buf_len(c_source_basename), 0); |
| 9475 | 9480 | |
| 9476 | 9481 | Buf *final_o_basename = buf_alloc(); |
| ... | ... | @@ -9606,17 +9611,15 @@ static void gen_c_objects(CodeGen *g) { |
| 9606 | 9611 | exit(1); |
| 9607 | 9612 | } |
| 9608 | 9613 | |
| 9609 | | codegen_add_time_event(g, "Compile C Code"); |
| 9610 | | const char *c_prog_name = "compiling C objects"; |
| 9611 | | Stage2ProgressNode *c_prog_node = stage2_progress_start(g->progress_node, c_prog_name, strlen(c_prog_name), |
| 9612 | | g->c_source_files.length); |
| 9614 | codegen_add_time_event(g, "Compile C Objects"); |
| 9615 | const char *c_prog_name = "Compile C Objects"; |
| 9616 | codegen_switch_sub_prog_node(g, stage2_progress_start(g->main_progress_node, c_prog_name, strlen(c_prog_name), |
| 9617 | g->c_source_files.length)); |
| 9613 | 9618 | |
| 9614 | 9619 | for (size_t c_file_i = 0; c_file_i < g->c_source_files.length; c_file_i += 1) { |
| 9615 | 9620 | CFile *c_file = g->c_source_files.at(c_file_i); |
| 9616 | | gen_c_object(g, self_exe_path, c_file, c_prog_node); |
| 9621 | gen_c_object(g, self_exe_path, c_file); |
| 9617 | 9622 | } |
| 9618 | | |
| 9619 | | stage2_progress_end(c_prog_node); |
| 9620 | 9623 | } |
| 9621 | 9624 | |
| 9622 | 9625 | void codegen_add_object(CodeGen *g, Buf *object_path) { |
| ... | ... | @@ -10337,9 +10340,8 @@ void codegen_build_and_link(CodeGen *g) { |
| 10337 | 10340 | |
| 10338 | 10341 | codegen_add_time_event(g, "Semantic Analysis"); |
| 10339 | 10342 | const char *progress_name = "Semantic Analysis"; |
| 10340 | | Stage2ProgressNode *child_progress_node = stage2_progress_start(g->progress_node, |
| 10341 | | progress_name, strlen(progress_name), 0); |
| 10342 | | (void)child_progress_node; |
| 10343 | codegen_switch_sub_prog_node(g, stage2_progress_start(g->main_progress_node, |
| 10344 | progress_name, strlen(progress_name), 0)); |
| 10343 | 10345 | |
| 10344 | 10346 | gen_root_source(g); |
| 10345 | 10347 | |
| ... | ... | @@ -10365,18 +10367,16 @@ void codegen_build_and_link(CodeGen *g) { |
| 10365 | 10367 | codegen_add_time_event(g, "Code Generation"); |
| 10366 | 10368 | { |
| 10367 | 10369 | const char *progress_name = "Code Generation"; |
| 10368 | | Stage2ProgressNode *child_progress_node = stage2_progress_start(g->progress_node, |
| 10369 | | progress_name, strlen(progress_name), 0); |
| 10370 | | (void)child_progress_node; |
| 10370 | codegen_switch_sub_prog_node(g, stage2_progress_start(g->main_progress_node, |
| 10371 | progress_name, strlen(progress_name), 0)); |
| 10371 | 10372 | } |
| 10372 | 10373 | |
| 10373 | 10374 | do_code_gen(g); |
| 10374 | 10375 | codegen_add_time_event(g, "LLVM Emit Output"); |
| 10375 | 10376 | { |
| 10376 | 10377 | const char *progress_name = "LLVM Emit Output"; |
| 10377 | | Stage2ProgressNode *child_progress_node = stage2_progress_start(g->progress_node, |
| 10378 | | progress_name, strlen(progress_name), 0); |
| 10379 | | (void)child_progress_node; |
| 10378 | codegen_switch_sub_prog_node(g, stage2_progress_start(g->main_progress_node, |
| 10379 | progress_name, strlen(progress_name), 0)); |
| 10380 | 10380 | } |
| 10381 | 10381 | zig_llvm_emit_output(g); |
| 10382 | 10382 | |
| ... | ... | @@ -10384,9 +10384,8 @@ void codegen_build_and_link(CodeGen *g) { |
| 10384 | 10384 | codegen_add_time_event(g, "Generate .h"); |
| 10385 | 10385 | { |
| 10386 | 10386 | const char *progress_name = "Generate .h"; |
| 10387 | | Stage2ProgressNode *child_progress_node = stage2_progress_start(g->progress_node, |
| 10388 | | progress_name, strlen(progress_name), 0); |
| 10389 | | (void)child_progress_node; |
| 10387 | codegen_switch_sub_prog_node(g, stage2_progress_start(g->main_progress_node, |
| 10388 | progress_name, strlen(progress_name), 0)); |
| 10390 | 10389 | } |
| 10391 | 10390 | gen_h_file(g); |
| 10392 | 10391 | } |
| ... | ... | @@ -10458,6 +10457,7 @@ void codegen_build_and_link(CodeGen *g) { |
| 10458 | 10457 | |
| 10459 | 10458 | codegen_release_caches(g); |
| 10460 | 10459 | codegen_add_time_event(g, "Done"); |
| 10460 | codegen_switch_sub_prog_node(g, nullptr); |
| 10461 | 10461 | } |
| 10462 | 10462 | |
| 10463 | 10463 | void codegen_release_caches(CodeGen *g) { |
| ... | ... | @@ -10487,7 +10487,7 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o |
| 10487 | 10487 | ZigLibCInstallation *libc, const char *name, Stage2ProgressNode *parent_progress_node) |
| 10488 | 10488 | { |
| 10489 | 10489 | Stage2ProgressNode *child_progress_node = stage2_progress_start( |
| 10490 | | parent_progress_node ? parent_progress_node : parent_gen->progress_node, |
| 10490 | parent_progress_node ? parent_progress_node : parent_gen->sub_progress_node, |
| 10491 | 10491 | name, strlen(name), 0); |
| 10492 | 10492 | |
| 10493 | 10493 | CodeGen *child_gen = codegen_create(nullptr, root_src_path, parent_gen->zig_target, out_type, |
| ... | ... | @@ -10524,9 +10524,14 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget |
| 10524 | 10524 | ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build, Stage2ProgressNode *progress_node) |
| 10525 | 10525 | { |
| 10526 | 10526 | CodeGen *g = allocate<CodeGen>(1); |
| 10527 | | g->progress_node = progress_node; |
| 10527 | g->main_progress_node = progress_node; |
| 10528 | 10528 | |
| 10529 | 10529 | codegen_add_time_event(g, "Initialize"); |
| 10530 | { |
| 10531 | const char *progress_name = "Initialize"; |
| 10532 | codegen_switch_sub_prog_node(g, stage2_progress_start(g->main_progress_node, |
| 10533 | progress_name, strlen(progress_name), 0)); |
| 10534 | } |
| 10530 | 10535 | |
| 10531 | 10536 | g->subsystem = TargetSubsystemAuto; |
| 10532 | 10537 | g->libc = libc; |
| ... | ... | @@ -10651,3 +10656,11 @@ bool codegen_fn_has_err_ret_tracing_stack(CodeGen *g, ZigFn *fn, bool is_async) |
| 10651 | 10656 | !codegen_fn_has_err_ret_tracing_arg(g, fn->type_entry->data.fn.fn_type_id.return_type); |
| 10652 | 10657 | } |
| 10653 | 10658 | } |
| 10659 | |
| 10660 | void codegen_switch_sub_prog_node(CodeGen *g, Stage2ProgressNode *node) { |
| 10661 | if (g->sub_progress_node != nullptr) { |
| 10662 | stage2_progress_end(g->sub_progress_node); |
| 10663 | } |
| 10664 | g->sub_progress_node = node; |
| 10665 | } |
| 10666 | |