-
Notifications
You must be signed in to change notification settings - Fork 3
Improve DebugInfo source provenance
#54
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
Conversation
| # Work around `show` functions requiring `invokelatest` queries | ||
| # that may be problematic to execute from within generated functions. | ||
| local inst | ||
| try | ||
| inst = string(stmt[:inst]) | ||
| catch e | ||
| isa(e, UndefVarError) && continue | ||
| rethrow() | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a bit of a hack, though calling show is kind of UB from generated functions. I'm only allowing UndefVarError here which are currently caused by binding lookups in certain cases, but it's not impossible that we later discover that other exceptions may be thrown.
Not to confuse it with the nonlocal insertion
|
I made source location slightly more precise for I'm thinking of removing the |
In the end, I decided to keep the macro and use it in with a standard This PR is ready for review whenever you like @Keno |


This PR accomplishes better
DebugInfotracing via the following changes:DebugInfowas changed to be on top of otherDebugInfonodes. This notably allows Add codegen option to associate debuginfo with statement number at a particular stage #39 to retain source information.@insert_node_hereuses its__source__implicit macro argument to insert additionalDebugInfoinformation, if theinsert_stmt_debuginfosetting is enabled.replace_call!now takes a source and a settings struct to conditionally insert additionalDebugInfo.insert_node_here!calls were converted to the macro form,@insert_node_here. Those that remain in function form use additional source and settings arguments to indicate provenance for optionalDebugInfo.slotnamesinformation has been added to the ODE/DAE RHS codegen, and to the factory IR.I also included a refactor for the naming of locals in the ODE codegen while I was at it; see 676875a. I find it clearer, but if it's just me I am open to reverting that.
To do:
test/ipo.jl.