-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add template parameter debuginfo to generic types #55010
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Fails when built against LLVM 5 or 6, works when LLVM is built in-tree. |
797f2ba
to
670ea7b
Compare
Had to delay setting the type parameters until the struct was filled in; which makes sense, the mystery being why it failed with the in-tree LLVM. |
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.
Thanks, @tromey! Looks good. However, would it be possible to use a single replaceArrays()
call to set both the members and the type parameters? Then you wouldn't have to add LLVMRustDIBuilderReplaceTemplateParams
(just extend adapt LLVMRustDICompositeTypeSetTypeArray
).
670ea7b
to
8a3bb9a
Compare
Rebased + tried to address review comments. Let me know what you think. |
Looks great, thank you! @bors r+ |
📌 Commit 8a3bb9a has been approved by |
… r=michaelwoerister Add template parameter debuginfo to generic types This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes rust-lang#9224
⌛ Testing commit 8a3bb9a with merge 7c41b8c778b18bd9c6e4446bd876adc655c2702f... |
💔 Test failed - status-appveyor |
Failed to stage 1 libcore on
|
8a3bb9a
to
2a3f38b
Compare
@bors r+ |
📌 Commit 2a3f38bbff21cf2107b77d8051ff542095b7baca has been approved by |
⌛ Testing commit fb204cb with merge 4d3c2da893443aab6d006a629c4293a79004f8af... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors retry cc SIGILL again |
⌛ Testing commit fb204cb with merge 00663a917413b848ac252805de30df2a051a5630... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors p=47 |
…oerister Add template parameter debuginfo to generic types This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes #9224
☀️ Test successful - status-appveyor, status-travis |
This PR hurf performance on a few benchmarks, the worst by almost 5%. @tromey, any ideas how to ameliorate that? |
The patch itself is pretty straightforward. Unless that new function ( One possible idea is that, since this debug info is primarily useful for pretty-printers, perhaps it could be limited to types where the generic parameters do not appear in any of the fields. Offhand I do not know whether this can be cheaply decided. |
There were no slowdowns in |
Incremental builds are affected more than non-incremental ones. The reason for this might be explained by incr. comp. producing more object files which causes more type information to be duplicated (because type information can't be shared between object files in LLVM). No simple, immediate fix comes to mind, unfortunately. At least only builds with full debuginfo should be affected. Line-info-only builds should be fine. |
We should consider fixing this in LLVM. The problem is only going to get worse -- for example, I'd like to emit DWARF describing all the traits, which I imagine will result in much more IR. |
This changes debuginfo generation to add template parameters to
generic types. With this change the DWARF now has
DW_TAG_template_type_param for types, not just for functions, like:
<2><40d>: Abbrev Number: 6 (DW_TAG_structure_type)
<40e> DW_AT_name : (indirect string, offset: 0x375): Generic
<412> DW_AT_byte_size : 4
<413> DW_AT_alignment : 4
...
<3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param)
<420> DW_AT_type : <0x42a>
<424> DW_AT_name : (indirect string, offset: 0xa65e): T
Closes #9224