Skip to content

Commit

Permalink
trace-compile: color recompilation yellow
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Sep 12, 2024
1 parent e52a46c commit e989f0c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,7 @@ jl_code_instance_t *jl_method_inferred_with_abi(jl_method_instance_t *mi JL_PROP

jl_mutex_t precomp_statement_out_lock;

static void record_precompile_statement(jl_method_instance_t *mi, double compilation_time)
static void record_precompile_statement(jl_method_instance_t *mi, double compilation_time, int is_recompile)
{
static ios_t f_precompile;
static JL_STREAM* s_precompile = NULL;
Expand All @@ -2539,11 +2539,15 @@ static void record_precompile_statement(jl_method_instance_t *mi, double compila
}
}
if (!jl_has_free_typevars(mi->specTypes)) {
if (is_recompile && s_precompile == JL_STDERR)
jl_printf(s_precompile, "\e[33m");
if (jl_options.trace_compile_timing)
jl_printf(s_precompile, "#= %6.1f ms =# ", compilation_time / 1e6);
jl_printf(s_precompile, "precompile(");
jl_static_show(s_precompile, mi->specTypes);
jl_printf(s_precompile, ")\n");
if (is_recompile && s_precompile == JL_STDERR)
jl_printf(s_precompile, "\e[0m");
if (s_precompile != JL_STDERR)
ios_flush(&f_precompile);
}
Expand Down Expand Up @@ -2674,7 +2678,7 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t
// unspec is probably not specsig, but might be using specptr
jl_atomic_store_relaxed(&codeinst->specsigflags, specsigflags & ~0b1); // clear specsig flag
jl_mi_cache_insert(mi, codeinst);
record_precompile_statement(mi, 0);
record_precompile_statement(mi, 0, 0);
return codeinst;
}
}
Expand All @@ -2691,7 +2695,7 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t
0, 1, ~(size_t)0, 0, jl_nothing, 0, NULL);
jl_atomic_store_release(&codeinst->invoke, jl_fptr_interpret_call);
jl_mi_cache_insert(mi, codeinst);
record_precompile_statement(mi, 0);
record_precompile_statement(mi, 0, 0);
return codeinst;
}
if (compile_option == JL_OPTIONS_COMPILE_OFF) {
Expand Down Expand Up @@ -2740,7 +2744,7 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t
codeinst = NULL;
}
else if (did_compile && codeinst->owner == jl_nothing) {
record_precompile_statement(mi, compile_time);
record_precompile_statement(mi, compile_time, is_recompile);
}
JL_GC_POP();
}
Expand Down

0 comments on commit e989f0c

Please sign in to comment.