Skip to content

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

Merged
merged 1 commit into from
Jan 22, 2015

Conversation

michaelwoerister
Copy link
Member

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.

🐔 🐤 🐤 🐤

@rust-highfive
Copy link
Contributor

r? @nick29581

(rust_highfive has picked a reviewer for you, use r? to override)

@nrc
Copy link
Member

nrc commented Jan 6, 2015

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 {
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed.

@nrc
Copy link
Member

nrc commented Jan 9, 2015

r=me, with the above addressed

@frewsxcv
Copy link
Member

frewsxcv commented Jan 9, 2015

And this will also need a rebase

@michaelwoerister michaelwoerister force-pushed the sane-source-locations-pt1 branch 2 times, most recently from f4b1a27 to e087c53 Compare January 14, 2015 10:28
@michaelwoerister
Copy link
Member Author

OK, I think I've addressed all Nick's issue. This should be good to go now.

@nrc
Copy link
Member

nrc commented Jan 20, 2015

@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.
@michaelwoerister michaelwoerister force-pushed the sane-source-locations-pt1 branch from e087c53 to a55ef3a Compare January 21, 2015 09:48
@michaelwoerister
Copy link
Member Author

@nick29581: rebased

@nrc
Copy link
Member

nrc commented Jan 21, 2015

@bors r+ a55ef3a

@bors
Copy link
Collaborator

bors commented Jan 21, 2015

⌛ Testing commit a55ef3a with merge 3a053ac...

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 21, 2015
…ns-pt1

Conflicts:
	src/librustc_trans/trans/debuginfo.rs
@bors
Copy link
Collaborator

bors commented Jan 21, 2015

💔 Test failed - auto-linux-64-x-android-t

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Collaborator

bors commented Jan 22, 2015

⌛ Testing commit a55ef3a with merge 080d476...

@alexcrichton
Copy link
Member

Trying to kick bors...

@alexcrichton alexcrichton reopened this Jan 22, 2015
@bors bors merged commit a55ef3a into rust-lang:master Jan 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants