-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Require type_map::stub
callers to supply file information
#104342
Require type_map::stub
callers to supply file information
#104342
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon. Please see the contribution instructions for more information. |
90c9907
to
12da85d
Compare
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.
This is on the right track, thanks for working on this!
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs
Outdated
Show resolved
Hide resolved
☔ The latest upstream changes (presumably #102717) made this pull request unmergeable. Please resolve the merge conflicts. |
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs
Outdated
Show resolved
Hide resolved
That seems fine to me! I think the important part we want to test is that we're generating the right LLVM IR. What it does with that depends on the target and some debuggers probably don't provide this data to the user anyway.
I believe that is correct. In DWARF, you define a struct/class and a part of that which is the variant. For Rust enums, we model this as essentially a struct whose only member is a DW_TAG_variant_part so both the outer struct and the DW_TAG_variant_part should refer to the (Rust) enum definition.
You might be able to clean that up using the unstable
While I think there are some places this is true, there will be a few kinds of types that cannot have locations emitted. For things like tuples or trait objects, there is no real definition location that can be meaningfully assigned. We'll always need to omit location data for those types. Overall this looks good; nice work! |
Oh, just as an FYI, the Windows and Linux targets differ in how they name and generate some kinds of debuginfo so we'll either need to adapt the codegen test to match both or have one codegen test for Linux and one for Windows (I think we do want to have both under test). If you don't have access to a Windows machine, I can pull that together when the PR is ready to merge. |
93f52b3
to
3007f9f
Compare
877ec89
to
23b58af
Compare
Let me know what you think of how I've split up the tests when adding MSVC checks. The order in which debuginfo is produced varies between compilers so it seemed less fragile this way. The only alternative I could think of would be to use a lot of
Seemed like a good fit for |
☔ The latest upstream changes (presumably #105525) made this pull request unmergeable. Please resolve the merge conflicts. |
Overall this is looking really good! I think we're close to merging but it would be good to have a few more tests. In particular, I think async blocks and async functions should already be getting the correct line numbers because of the generator case but it would be good to have that under test. It looks like there is support for setting line numbers for fields in enum variants but that doesn't have a test case. Can you also rebase over master? The test folder was recently moved to the top level so all new tests should be under |
23b58af
to
9ceeedc
Compare
I recombined the two enum tests into one and used the examples you suggested. If I understand correctly, and please feel free to correct me, the difference between "native" and "cpp-like" enums is an implementation detail and not the direct result of how enums are expressed in Rust. That being the case I see no reason for having the two separate test cases that I did. |
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.
This is really great work! Thanks for all your effort on this!
Let's do a perf run real quick just to see if there is any impact to LLVM throughput. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 2838ec9 with merge 2c129ea29c5d78e5d60baa102938ad79f286cf7b... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (2c129ea29c5d78e5d60baa102938ad79f286cf7b): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
The perf results are very strange. It looks like performing code generation for more modules than before but it's unclear to me why that is. The worst results are in incremental patch benchmarks. Perhaps line numbers or something in the other module changed and we were able to ignore that before? |
@bors r=wesleywiser |
…ypes, r=wesleywiser Require `type_map::stub` callers to supply file information This change attaches file information (`DIFile` reference and line number) to struct debug info nodes. Before: ``` ; foo.ll ... !5 = !DIFile(filename: "<unknown>", directory: "") ... !16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !5, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "4cb373851db92e732c4cb5651b886dd0") ... ``` After: ``` ; foo.ll ... !3 = !DIFile(filename: "foo.rs", directory: "/home/matt/src/rust98678", checksumkind: CSK_SHA1, checksum: "bcb9f08512c8f3b8181ef4726012bc6807bc9be4") ... !16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !3, line: 3, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "9e5968c7af39c148acb253912b7f409f") ... ``` Fixes rust-lang#98678 r? `@wesleywiser`
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
This particular failure seems to be due to the path separator, as I wrote the Why wasn't this CI triggered automatically after I pushed? Finding out this is still a problem weeks after last touching this is incredibly frustrating. Was there something else I should have done to trigger this to run? |
@Kobzol Do you konw if there is a command for the bot to test a certain target? |
I reproduced and fixed the problem using |
@bors r=wesleywiser |
What do you mean by target here? |
run CI for |
Yeah, you can do that with arbitrary try builds (https://rustc-dev-guide.rust-lang.org/tests/ci.html#try-builds - see the part with |
☀️ Test successful - checks-actions |
Finished benchmarking commit (8575f8f): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary 4.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 767.254s -> 766.323s (-0.12%) |
This change attaches file information (
DIFile
reference and line number) to struct debug info nodes.Before:
After:
Fixes #98678
r? @wesleywiser