Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert storage of method instance in LineInfoNode #50546

Merged
merged 4 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function ir_inline_linetable!(linetable::Vector{LineInfoNode}, inlinee_ir::IRCod
# Append the linetable of the inlined function to our line table
topline::Int32 = linetable_offset + Int32(1)
coverage_by_path = JLOptions().code_coverage == 3
push!(linetable, LineInfoNode(inlinee_def.module, inlinee, inlinee_def.file, inlinee_def.line, inlined_at))
push!(linetable, LineInfoNode(inlinee_def.module, inlinee_def.name, inlinee_def.file, inlinee_def.line, inlined_at))
oldlinetable = inlinee_ir.linetable
extra_coverage_line = zero(Int32)
for oldline in eachindex(oldlinetable)
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ function typeinf_ext(interp::AbstractInterpreter, mi::MethodInstance)
tree.slotflags = fill(IR_FLAG_NULL, nargs)
tree.ssavaluetypes = 1
tree.codelocs = Int32[1]
tree.linetable = LineInfoNode[LineInfoNode(method.module, mi, method.file, method.line, Int32(0))]
tree.linetable = LineInfoNode[LineInfoNode(method.module, method.name, method.file, method.line, Int32(0))]
tree.ssaflags = UInt8[0]
set_inlineable!(tree, true)
tree.parent = mi
Expand Down
13 changes: 10 additions & 3 deletions test/stacktraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,16 @@ trace = (try; f(3); catch; stacktrace(catch_backtrace()); end)[1:3]
can_inline = Bool(Base.JLOptions().can_inline)
for (frame, func, inlined) in zip(trace, [g,h,f], (can_inline, can_inline, false))
@test frame.func === typeof(func).name.mt.name
@test frame.linfo.def.module === which(func, (Any,)).module
@test frame.linfo.def === which(func, (Any,))
@test frame.linfo.specTypes === Tuple{typeof(func), Int}
# broken until #50082 can be addressed
if inlined
@test frame.linfo.def.module === which(func, (Any,)).module broken=true
@test frame.linfo.def === which(func, (Any,)) broken=true
@test frame.linfo.specTypes === Tuple{typeof(func), Int} broken=true
else
@test frame.linfo.def.module === which(func, (Any,)).module
@test frame.linfo.def === which(func, (Any,))
@test frame.linfo.specTypes === Tuple{typeof(func), Int}
Comment on lines +96 to +102
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm late to the party, but this could have been simply

        @test frame.linfo.def.module === which(func, (Any,)).module broken=inlined
        @test frame.linfo.def === which(func, (Any,)) broken=inlined
        @test frame.linfo.specTypes === Tuple{typeof(func), Int} broken=inlined

The whole point of broken=... is to avoid these if blocks 🙂

end
# line
@test frame.file === Symbol(@__FILE__)
@test !frame.from_c
Expand Down