Skip to content

Commit 827cf42

Browse files
committed
avoid error just computing coverage of generated functions
We only put debuginfo here if we ran the optimizer, so if there isn't debuginfo here, then we either didn't run the optimizer or were the result of const-prop. In the former case, we don't need to invalidate the code for instrumentation (it cannot have code from it). In the later case, we should already have an edge from the non-const-prop result. This only matters for generated functions, since otherwise we have Method's source's accurate debuginfo already and this is just a duplicate reference to it. Fix #58227
1 parent 4b90899 commit 827cf42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

base/staticdata.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ end
8282
function needs_instrumentation(codeinst::CodeInstance, mi::MethodInstance, def::Method, validation_world::UInt)
8383
if JLOptions().code_coverage != 0 || JLOptions().malloc_log != 0
8484
# test if the code needs to run with instrumentation, in which case we cannot use existing generated code
85-
if isdefined(def, :debuginfo) ? # generated_only functions do not have debuginfo, so fall back to considering their codeinst debuginfo though this may be slower (and less accurate?)
85+
if isdefined(def, :debuginfo) ? # generated_only functions do not have debuginfo, so fall back to considering their codeinst debuginfo though this may be slower and less reliable
8686
Compiler.should_instrument(def.module, def.debuginfo) :
87-
Compiler.should_instrument(def.module, codeinst.debuginfo)
87+
isdefined(codeinst, :debuginfo) && Compiler.should_instrument(def.module, codeinst.debuginfo)
8888
return true
8989
end
9090
gensig = gen_staged_sig(def, mi)

0 commit comments

Comments
 (0)