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

produce LineInfoNode directly in lowering #37954

Merged
merged 1 commit into from
Oct 14, 2020
Merged

produce LineInfoNode directly in lowering #37954

merged 1 commit into from
Oct 14, 2020

Conversation

JeffBezanson
Copy link
Sponsor Member

This makes the output of lowering closer to what is actually needed, cutting down on extra conversion work.

For top-level code and (upcoming) OpaqueClosure, the extra step won't be needed any more, and for methods all that's needed is to insert the correct name in the location info.

This makes the output of lowering closer to what is actually needed,
cutting down on extra conversion work.
@JeffBezanson JeffBezanson added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Oct 8, 2020
@JeffBezanson JeffBezanson merged commit 31994ac into master Oct 14, 2020
@JeffBezanson JeffBezanson deleted the jb/lineinfo branch October 14, 2020 18:12
@simeonschaub
Copy link
Member

simeonschaub commented Feb 14, 2021

This change seems to have regressed stacktrace printing for inlined functions, which is quite important e.g. for debugging Cassette. Compare this PR:

julia> using Cassette

julia> Cassette.@context NaNCtx;

julia> Cassette.posthook(::NaNCtx, out::Number, f, args...) = isnan(out) ? error("$f$args returned $out") : nothing

julia> checked(f) = Cassette.overdub(NaNCtx(), f)
checked (generic function with 1 method)

julia> checked() do
           0 / 0
       end
ERROR: div_float(0.0, 0.0) returned NaN
 Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] posthook
    @ ~/Documents/julia/bisect.jl:100 [inlined]
  [3] overdub
    @ ./float.jl:407 [inlined]
  [4] overdub
    @ ./int.jl:93 [inlined]
  [5] overdub(::Cassette.Context{nametype(NaNCtx), Nothing, Nothing, Cassette.var"##PassType#251", Nothing, Nothing}, ::typeof(/), ::Int64, ::Int64)
[...]

with 1.5, where 3 and 4 correctly show up as calls to /:

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] posthook at ./REPL[6]:1 [inlined]
 [3] / at ./float.jl:407 [inlined]
 [4] / at ./int.jl:92 [inlined]
 [5] overdub(::Cassette.Context{nametype(NaNCtx),Nothing,Nothing,Cassette.var"##PassType#255",Nothing,Nothing}, ::typeof(/), ::Int64, ::Int64) at /home/simeon/.julia/packages/Cassette/Wjztv/src/overdub.jl:0

Is this something that just needs a fix, or would we need to revert this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants