Skip to content

Commit e3197af

Browse files
authored
fix handling of MethodTable in precompile files (#41277)
This was not an external method table, it is just a normal variable binding. This was causing the precompile files to be corrupted, since we use normal variables that look like this one at https://github.com/JuliaLang/julia/blob/dc2befcffc7412768097c2a2a6819724a4745aeb/base/compiler/utilities.jl#L139-L140 Fixes #41156
1 parent dc2befc commit e3197af

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/dump.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,15 @@ static void jl_collect_lambdas_from_mod(jl_array_t *s, jl_module_t *m) JL_GC_DIS
981981
jl_collect_lambdas_from_mod(s, (jl_module_t*)b->value);
982982
}
983983
}
984-
else if (jl_is_mtable(bv)) {
985-
// a module containing an external method table
986-
jl_collect_methtable_from_mod(s, (jl_methtable_t*)bv);
984+
else if (jl_is_mtable(b->value)) {
985+
jl_methtable_t *mt = (jl_methtable_t*)b->value;
986+
if (mt->module == m && mt->name == b->name) {
987+
// this is probably an external method table, so let's assume so
988+
// as there is no way to precisely distinguish them,
989+
// and the rest of this serializer does not bother
990+
// to handle any method tables specially
991+
jl_collect_methtable_from_mod(s, (jl_methtable_t*)bv);
992+
}
987993
}
988994
}
989995
}

0 commit comments

Comments
 (0)