Skip to content

debug_method_invalidation: print the module-of-definition #35747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,14 +1487,29 @@ static void update_max_args(jl_methtable_t *mt, jl_value_t *type)

JL_DLLEXPORT int jl_debug_method_invalidation = 0;

static void show_method_instance_module(jl_method_instance_t *mi)
{
jl_static_show(JL_STDOUT, (jl_value_t*)mi);
if (jl_is_method(mi->def.method)) {
jl_uv_puts(JL_STDOUT, " (in ", 5);
jl_static_show(JL_STDOUT, mi->def.method->module);
jl_uv_puts(JL_STDOUT, ")", 1);
}
else if (jl_is_module(mi->def.module)) {
jl_uv_puts(JL_STDOUT, " (toplevel thunk in ", 5);
jl_static_show(JL_STDOUT, mi->def.module);
jl_uv_puts(JL_STDOUT, ")", 1);
}
}

// recursively invalidate cached methods that had an edge to a replaced method
static void invalidate_method_instance(jl_method_instance_t *replaced, size_t max_world, int depth)
{
if (jl_debug_method_invalidation) {
int d0 = depth;
while (d0-- > 0)
jl_uv_puts(JL_STDOUT, " ", 1);
jl_static_show(JL_STDOUT, (jl_value_t*)replaced);
show_method_instance_module(replaced);
jl_uv_puts(JL_STDOUT, "\n", 1);
}
if (!jl_is_method(replaced->def.method))
Expand Down Expand Up @@ -1624,7 +1639,7 @@ static int invalidate_mt_cache(jl_typemap_entry_t *oldentry, void *closure0)
if (intersects) {
if (jl_debug_method_invalidation) {
jl_uv_puts(JL_STDOUT, "-- ", 3);
jl_static_show(JL_STDOUT, (jl_value_t*)mi);
show_method_instance_module(mi);
jl_uv_puts(JL_STDOUT, "\n", 1);
}
oldentry->max_world = env->max_world;
Expand Down