Skip to content

Commit 75382d6

Browse files
serenity4vtjnash
andauthored
Attach source edges to :uninferred generator CodeInstance (#58324)
I am not sure when we may be in the situation where `edges` is `null`, but if we do, we crash. I triggered such a crash in JuliaComputing/DAECompiler.jl#24, which manually adds edges to handcrafted code instances. I may be doing something wrong, but in any case, it doesn't hurt to be more robust (and perhaps handle this situation more gracefully). --------- Co-authored-by: Jameson Nash <[email protected]>
1 parent f07565f commit 75382d6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/toplevel.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,15 @@ int jl_needs_lowering(jl_value_t *e) JL_NOTSAFEPOINT
517517

518518
JL_DLLEXPORT jl_code_instance_t *jl_new_codeinst_for_uninferred(jl_method_instance_t *mi, jl_code_info_t *src)
519519
{
520+
jl_svec_t *edges = jl_emptysvec;
521+
if (src->edges && jl_is_svec(src->edges))
522+
edges = (jl_svec_t*)src->edges;
523+
520524
// Do not compress this, we expect it to be shortlived.
521525
jl_code_instance_t *ci = jl_new_codeinst(mi, (jl_value_t*)jl_uninferred_sym,
522526
(jl_value_t*)jl_any_type, (jl_value_t*)jl_any_type, jl_nothing,
523527
(jl_value_t*)src, 0, src->min_world, src->max_world,
524-
0, NULL, NULL, NULL);
528+
0, NULL, NULL, edges);
525529
return ci;
526530
}
527531

0 commit comments

Comments
 (0)