Skip to content

Commit 4589ed0

Browse files
vtjnashKristofferC
authored andcommitted
avoid error just computing coverage of generated functions (#58488)
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 (cherry picked from commit d5442db)
1 parent 4d6fece commit 4589ed0

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
@@ -91,9 +91,9 @@ end
9191
function needs_instrumentation(codeinst::CodeInstance, mi::MethodInstance, def::Method, validation_world::UInt)
9292
if JLOptions().code_coverage != 0 || JLOptions().malloc_log != 0
9393
# test if the code needs to run with instrumentation, in which case we cannot use existing generated code
94-
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?)
94+
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
9595
Compiler.should_instrument(def.module, def.debuginfo) :
96-
Compiler.should_instrument(def.module, codeinst.debuginfo)
96+
isdefined(codeinst, :debuginfo) && Compiler.should_instrument(def.module, codeinst.debuginfo)
9797
return true
9898
end
9999
gensig = gen_staged_sig(def, mi)

0 commit comments

Comments
 (0)