From 25dab0f27654da0a023d8f6a0302ae417a5451ab Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 28 Sep 2023 09:47:25 -0400 Subject: [PATCH] Remove fallback that assigns a module to inlined frames. (#51405) The work I did in #41099 introduced code which, if method information could not be found for an inlined frame, would fall back to use the module of the next-higher stack frame. This often worked there because the only frames that would not be assigned a module at this point would be e.g., `macro expansion` frames. However, due to the performance impact of the way method roots are currently encoded, the extra method roots were removed in #50546. The result is that inlined frames were being assigned a potentially incorrect module, rather than being left blank. Example: ``` julia> @btime plot([1 2 3], seriestype = :blah) ... [13] #invokelatest#2 @ BenchmarkTools ./essentials.jl:901 [inlined] [14] invokelatest @ BenchmarkTools ./essentials.jl:896 [inlined] ... ``` (cherry picked from commit ed891d6751def90f449e2f37a079514a2089a2fb) --- base/stacktraces.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/base/stacktraces.jl b/base/stacktraces.jl index 9c942814eefad2..bb70b7ea1c0997 100644 --- a/base/stacktraces.jl +++ b/base/stacktraces.jl @@ -206,7 +206,6 @@ Base.@constprop :none function lookup(pointer::Ptr{Cvoid}) elseif miroots !== nothing linfo = lookup_inline_frame_info(func, file, miroots) end - linfo = linfo === nothing ? parentmodule(res[i + 1]) : linfo # e.g. `macro expansion` end res[i] = StackFrame(func, file, linenum, linfo, info[5]::Bool, info[6]::Bool, pointer) end