Fixed leaky imports, modified log stuff

This commit is contained in:
Krzosa Karol
2022-10-11 10:20:18 +02:00
parent 977a62d5ae
commit 4004b8b8d3
8 changed files with 67 additions and 41 deletions

View File

@@ -302,7 +302,7 @@ const U32 COMPILE_TESTING = 0x8;
function void
compile_file(String filename, U32 compile_flags = COMPILE_NULL){
if(is_flag_set(compile_flags, COMPILE_AND_RUN)){
log_info("\n%Q - ", filename);
log_info_no_nl("%Q - ", filename);
}
String result = compile_file_to_string(filename);
@@ -322,20 +322,20 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
F64 end = os_time();
if(is_flag_set(compile_flags, COMPILE_PRINT_STATS)){
log_info("\ntotal = %f", os_time() - total_time);
log_info("\nclang = %f", end - begin);
log_info("\nparsing = %f", parsing_time_end - parsing_time_begin);
log_info("\nresolving = %f", resolving_time_end - resolving_time_begin);
log_info("\ngeneratin = %f", generating_time_end - generating_time_begin);
log_info("total = %f", os_time() - total_time);
log_info("clang = %f", end - begin);
log_info("parsing = %f", parsing_time_end - parsing_time_begin);
log_info("resolving = %f", resolving_time_end - resolving_time_begin);
log_info("generatin = %f", generating_time_end - generating_time_begin);
}
if(is_flag_set(compile_flags, COMPILE_PRINT_ALLOCATOR_STATS_BEFORE_DESTROY)){
Arena *p = (Arena *)pctx->perm;
Arena *stage = (Arena *)&pctx->stage_arena;
log_info("\nPernament arena len: %llu commit: %llu", p->len, p->memory.commit);
log_info("\nStage arena len: %llu commit: %llu", stage->len, stage->memory.commit);
log_info("\nScratch1 len: %llu commit: %llu", thread_ctx.scratch[0].len, thread_ctx.scratch[0].memory.commit);
log_info("\nScratch2 len: %llu commit: %llu", thread_ctx.scratch[1].len, thread_ctx.scratch[1].memory.commit);
log_info("Pernament arena len: %llu commit: %llu", p->len, p->memory.commit);
log_info("Stage arena len: %llu commit: %llu", stage->len, stage->memory.commit);
log_info("Scratch1 len: %llu commit: %llu", thread_ctx.scratch[0].len, thread_ctx.scratch[0].memory.commit);
log_info("Scratch2 len: %llu commit: %llu", thread_ctx.scratch[1].len, thread_ctx.scratch[1].memory.commit);
}
if(is_flag_set(compile_flags, COMPILE_AND_RUN)){
@@ -348,11 +348,12 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
int result = system((char *)sys.str);
assert(result != -1);
if(result == 0){
log_info(PRINTF_GREEN "OK!" PRINTF_RESET);
log_info_no_nl(PRINTF_GREEN "OK!" PRINTF_RESET);
}
if(result != 0){
log_info(PRINTF_RED "ERROR!" PRINTF_RESET);
log_info_no_nl(PRINTF_RED "ERROR!" PRINTF_RESET);
}
log_info("");
}
destroy_compiler();