-
Notifications
You must be signed in to change notification settings - Fork 13.5k
debuginfo: Make debuginfo source location assignment more stable #20642
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
debuginfo: Make debuginfo source location assignment more stable #20642
Conversation
r? @nick29581 (rust_highfive has picked a reviewer for you, use r? to override) |
r- until after the alpha release, will review then |
pub fn expr_info(expr: &ast::Expr) -> NodeInfo { | ||
NodeInfo { id: expr.id, span: expr.span } | ||
impl NodeIdAndSpan { | ||
pub fn to_source_location(&self) -> debuginfo::DebugLocation { |
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.
I'd prefer to_debug_location
- source is ambiguous with spans
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.
Agreed.
r=me, with the above addressed |
And this will also need a rebase |
f4b1a27
to
e087c53
Compare
OK, I think I've addressed all Nick's issue. This should be good to go now. |
@michaelwoerister ping needs an update |
So far, the source location an LLVM instruction was linked to was controlled by `debuginfo::set_source_location()` and `debuginfo::clear_source_location()`. This interface mimicked how LLVM's `IRBuilder` handles debug location assignment. While this interface has some theoretical performance benefits, it also makes things terribly unstable: One sets some quasi-global state and then hopes that it is still correct when a given instruction is emitted---an assumption that has been proven to not hold a bit too often. This patch requires the debug source location to be passed to the actual instruction emitting function. This makes source location assignment explicit and will prevent future changes to `trans` from accidentally breaking things in the majority of cases. This patch does not yet implement the new principle for all instruction kinds but the stepping experience should have improved significantly nonetheless already.
e087c53
to
a55ef3a
Compare
@nick29581: rebased |
⌛ Testing commit a55ef3a with merge 3a053ac... |
…ns-pt1 Conflicts: src/librustc_trans/trans/debuginfo.rs
💔 Test failed - auto-linux-64-x-android-t |
@bors: retry |
⌛ Testing commit a55ef3a with merge 080d476... |
Trying to kick bors... |
So far, the source location an LLVM instruction was linked to was controlled by
debuginfo::set_source_location()
anddebuginfo::clear_source_location()
. This interface mimicked how LLVM'sIRBuilder
handles debug location assignment. While this interface has some theoretical performance benefits, it also makes things terribly unstable: One sets some quasi-global state and then hopes that it is still correct when a given instruction is emitted---an assumption that has been proven to not hold a bit too often.This patch requires the debug source location to be passed to the actual instruction emitting function. This makes source location assignment explicit and will prevent future changes to
trans
from accidentally breaking things in the majority of cases.This patch does not yet implement the new principle for all instruction kinds but the stepping experience should have improved significantly nonetheless already.
🐔 🐤 🐤 🐤