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

Removal of block spans from trans has ruined lexical block debug info #1694

Closed
jdm opened this issue Jan 28, 2012 · 6 comments
Closed

Removal of block spans from trans has ruined lexical block debug info #1694

jdm opened this issue Jan 28, 2012 · 6 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)

Comments

@jdm
Copy link
Contributor

jdm commented Jan 28, 2012

debuginfo was relying on block-level spans to generate proper location information. Now arbitrary non-block spans are being passed instead, causing a proliferation of fake blocks to be created and cached (slowing down debug compilation time by >10x), as well as incorrect debuginfo generation.

jdm added a commit that referenced this issue Jan 28, 2012
…lation time while #1694 is unfixed, and fix stack-exhaustion bug in block parent generation.
@marijnh
Copy link
Contributor

marijnh commented Jan 28, 2012

I'll look into this first thing next week. It's probably just a matter of using better keys for the blocks.

@ghost ghost assigned marijnh Jan 28, 2012
@jdm
Copy link
Contributor Author

jdm commented Jan 28, 2012

I think it's a bit more complicated than that. The block debug info requires a starting line and column for each block, but many of the spans being passed into debuginfo are providing spans for individual ast items within blocks. Furthermore, block debug info refers to parent blocks, which themselves require correct spans. If we can prove that any time we refer to a block, every one of its parent blocks already exist in the metadata cache, we can avoid having to provide spans for all parents as well.

@marijnh
Copy link
Contributor

marijnh commented Jan 29, 2012

I don't really know what a reasonable compile time is with -g. Could you get the patch at https://github.com/marijnh/rust/tree/debuginfo and see if it brings things back to normal?

The reason this worked at all before was purely by accident -- the spans were being tracked so poorly that a lot of insignificant block contexts ended up with the same span. I've now made it so that every context that corresponds to an actual {} in the source program gets a debuginfo block.

But I'm wondering what such blocks add, in terms of useful debuginfo, at all. Maybe we'd be better off simply not bothering with them?

@jdm
Copy link
Contributor Author

jdm commented Jan 29, 2012

I'm not certain what LLVM does if the lexical block debug information is not present when dealing only with line numbers, functions and files as -g currently does. For -xg, this information is very important for variable scoping information.

@jdm
Copy link
Contributor Author

jdm commented Jan 29, 2012

It looks like the lexical block cache is a huge perf drain in its current naive implementation, due to the number of entries. With the cache disabled (but block debug information generated every time), and reverting the path->id changes from create_function, I see -g taking about 1.6x as long as regular. That seems fine to me right now.

@jdm
Copy link
Contributor Author

jdm commented Jan 29, 2012

https://gist.github.com/1701436 is the diff of the changes I made to get the 1.6x build times.

marijnh added a commit that referenced this issue Jan 30, 2012
I.e. a set of curly braces, not everything that creates a block
context in the trans pass.

Issue #1694
@marijnh marijnh closed this as completed Jan 31, 2012
@jdm jdm unassigned marijnh Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants