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

codegen_llvm: set DW_AT_accessibility #115165

Merged

Conversation

davidtwco
Copy link
Member

Fixes #9228.
Based on #74778.

Sets the accessibility of types and fields in DWARF using DW_AT_accessibility attribute.

DW_AT_accessibility (public/protected/private) isn't exactly right for Rust, but neither is DW_AT_visibility (local/exported/qualified), and there's no way to set DW_AT_visbility in LLVM's API. Debuggers will special-case the handling of these per-language anyway.

r? @wesleywiser (visited in wg-debugging triage)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 24, 2023
@davidtwco davidtwco force-pushed the issue-9228-describe-item-member-visibility branch from 376f738 to 1f83e77 Compare September 6, 2023 15:43
type_did: DefId,
) -> DIFlags {
let parent_did = cx.tcx.parent(type_did);
let visibility = cx.tcx.visibility(did);
Copy link
Member

Choose a reason for hiding this comment

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

I was going to comment that it might make more sense to calculate the visibility from the perspective of the crate root (or, rather, as if you were using the crate as a dependency?) but I don't see why that necessarily be better and the current implementation is simpler and matches the visibility of the declaration site (even if the effective visibility ends up being more hidden due to the visibility/exports of parent modules).

Just noting that is another possible way to implement this but I don't see a strong reason to do that at this time.

@wesleywiser
Copy link
Member

Thanks @davidtwco!

@bors r+

@bors
Copy link
Contributor

bors commented Sep 26, 2023

📌 Commit 1f83e77 has been approved by wesleywiser

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 26, 2023
@bors
Copy link
Contributor

bors commented Sep 26, 2023

⌛ Testing commit 1f83e77 with merge fe9519c...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 26, 2023
…ember-visibility, r=wesleywiser

codegen_llvm: set `DW_AT_accessibility`

Fixes rust-lang#9228.
Based on rust-lang#74778.

Sets the accessibility of types and fields in DWARF using `DW_AT_accessibility` attribute.

`DW_AT_accessibility` (public/protected/private) isn't exactly right for Rust,  but neither is `DW_AT_visibility` (local/exported/qualified), and there's no way to set `DW_AT_visbility` in LLVM's API. Debuggers will special-case the handling of these per-language anyway.

r? `@wesleywiser` (visited in wg-debugging triage)
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Sep 26, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 26, 2023
@davidtwco davidtwco force-pushed the issue-9228-describe-item-member-visibility branch from 1f83e77 to 02682de Compare October 3, 2023 12:13
@davidtwco
Copy link
Member Author

I've split the test up into different files for each type - as far as I can tell the test fails in CI because of the order of items in the LLVM IR.

@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 25, 2023

📌 Commit 02682de has been approved by wesleywiser

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 25, 2023
@bors
Copy link
Contributor

bors commented Oct 25, 2023

⌛ Testing commit 02682de with merge 4ab4817...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 25, 2023
…ember-visibility, r=wesleywiser

codegen_llvm: set `DW_AT_accessibility`

Fixes rust-lang#9228.
Based on rust-lang#74778.

Sets the accessibility of types and fields in DWARF using `DW_AT_accessibility` attribute.

`DW_AT_accessibility` (public/protected/private) isn't exactly right for Rust,  but neither is `DW_AT_visibility` (local/exported/qualified), and there's no way to set `DW_AT_visbility` in LLVM's API. Debuggers will special-case the handling of these per-language anyway.

r? `@wesleywiser` (visited in wg-debugging triage)
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Oct 25, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 25, 2023
@davidtwco davidtwco force-pushed the issue-9228-describe-item-member-visibility branch from 02682de to 1b857fb Compare November 6, 2023 02:48
@davidtwco
Copy link
Member Author

Rebased and fixed tidy errors, will r+ once CI is passing.

@davidtwco
Copy link
Member Author

@bors r=wesleywiser

@bors
Copy link
Contributor

bors commented Dec 15, 2023

📌 Commit ce29051 has been approved by wesleywiser

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2023
@bors
Copy link
Contributor

bors commented Dec 15, 2023

⌛ Testing commit ce29051 with merge 47a262c...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2023
…ember-visibility, r=wesleywiser

codegen_llvm: set `DW_AT_accessibility`

Fixes rust-lang#9228.
Based on rust-lang#74778.

Sets the accessibility of types and fields in DWARF using `DW_AT_accessibility` attribute.

`DW_AT_accessibility` (public/protected/private) isn't exactly right for Rust,  but neither is `DW_AT_visibility` (local/exported/qualified), and there's no way to set `DW_AT_visbility` in LLVM's API. Debuggers will special-case the handling of these per-language anyway.

r? `@wesleywiser` (visited in wg-debugging triage)
@bors
Copy link
Contributor

bors commented Dec 15, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 15, 2023
@rust-log-analyzer
Copy link
Collaborator

The job dist-aarch64-apple failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
SCRIPT=./x.py dist bootstrap --include-default-paths --host=aarch64-apple-darwin --target=aarch64-apple-darwin
SELECT_XCODE=/Applications/Xcode_13.4.1.app
SHELL=/bin/bash
SHLVL=3
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.WcUT1Lj5lV/Listeners
STATS_EXT=true
STATS_EXTP=https://provjobdsettingscdn.blob.core.windows.net/settings/provjobdsettings-0.5.154/provjobd.data
STATS_RDCL=true
STATS_TIS=mining
---
sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
[ 36%] Building CXX object lib/Target/RISCV/MCTargetDesc/CMakeFiles/LLVMRISCVDesc.dir/RISCVBaseInfo.cpp.o
sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
sccache: error: failed to execute compile
sccache: caused by: Failed to send data to or receive data from server
sccache: caused by: Failed to read response header
sccache: caused by: Connection reset by peer (os error 54)
make[2]: *** [lib/Target/NVPTX/MCTargetDesc/CMakeFiles/LLVMNVPTXDesc.dir/NVPTXTargetStreamer.cpp.o] Error 2
make[1]: *** [lib/Target/NVPTX/MCTargetDesc/CMakeFiles/LLVMNVPTXDesc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 36%] Building CXX object lib/Target/RISCV/MCTargetDesc/CMakeFiles/LLVMRISCVDesc.dir/RISCVInstPrinter.cpp.o
[ 36%] Building CXX object lib/Target/Sparc/MCTargetDesc/CMakeFiles/LLVMSparcDesc.dir/SparcELFObjectWriter.cpp.o
[ 36%] Building CXX object lib/Target/Sparc/MCTargetDesc/CMakeFiles/LLVMSparcDesc.dir/SparcInstPrinter.cpp.o
[ 36%] Building CXX object lib/Target/RISCV/MCTargetDesc/CMakeFiles/LLVMRISCVDesc.dir/RISCVMCAsmInfo.cpp.o

@wesleywiser
Copy link
Member

2023-12-15T14:55:36.8253420Z [ 36%] Building CXX object lib/Target/NVPTX/MCTargetDesc/CMakeFiles/LLVMNVPTXDesc.dir/NVPTXTargetStreamer.cpp.o
2023-12-15T14:55:36.8512930Z sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
2023-12-15T14:55:36.8629180Z sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
2023-12-15T14:55:36.8754600Z sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
2023-12-15T14:55:36.8854030Z sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
2023-12-15T14:55:36.8854890Z [ 36%] Building CXX object lib/Target/RISCV/MCTargetDesc/CMakeFiles/LLVMRISCVDesc.dir/RISCVBaseInfo.cpp.o
2023-12-15T14:55:36.8956170Z sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
2023-12-15T14:55:36.9055780Z sccache: error: failed to execute compile
2023-12-15T14:55:36.9156310Z sccache: caused by: Failed to send data to or receive data from server
2023-12-15T14:55:36.9256960Z sccache: caused by: Failed to read response header
2023-12-15T14:55:36.9357660Z sccache: caused by: Connection reset by peer (os error 54)
2023-12-15T14:55:36.9460890Z make[2]: *** [lib/Target/NVPTX/MCTargetDesc/CMakeFiles/LLVMNVPTXDesc.dir/NVPTXTargetStreamer.cpp.o] Error 2
2023-12-15T14:55:36.9568450Z make[1]: *** [lib/Target/NVPTX/MCTargetDesc/CMakeFiles/LLVMNVPTXDesc.dir/all] Error 2
2023-12-15T14:55:36.9676090Z make[1]: *** Waiting for unfinished jobs....

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2023
@bors
Copy link
Contributor

bors commented Dec 15, 2023

⌛ Testing commit ce29051 with merge 6af6885...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2023
…ember-visibility, r=wesleywiser

codegen_llvm: set `DW_AT_accessibility`

Fixes rust-lang#9228.
Based on rust-lang#74778.

Sets the accessibility of types and fields in DWARF using `DW_AT_accessibility` attribute.

`DW_AT_accessibility` (public/protected/private) isn't exactly right for Rust,  but neither is `DW_AT_visibility` (local/exported/qualified), and there's no way to set `DW_AT_visbility` in LLVM's API. Debuggers will special-case the handling of these per-language anyway.

r? `@wesleywiser` (visited in wg-debugging triage)
@bors
Copy link
Contributor

bors commented Dec 15, 2023

⌛ Testing commit ce29051 with merge 3f39cae...

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Dec 15, 2023

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing 3f39cae to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 15, 2023
@bors bors merged commit 3f39cae into rust-lang:master Dec 15, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 15, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3f39cae): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.3%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.7%, -0.6%] 4
Improvements ✅
(secondary)
-0.4% [-0.7%, -0.2%] 22
All ❌✅ (primary) -0.2% [-0.7%, 0.3%] 8

Max RSS (memory usage)

Results

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.

mean range count
Regressions ❌
(primary)
0.9% [0.1%, 1.6%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-3.3%, -0.5%] 2
Improvements ✅
(secondary)
-1.7% [-2.2%, -1.1%] 2
All ❌✅ (primary) -0.5% [-3.3%, 1.6%] 4

Cycles

Results

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.9% [-3.9%, -3.9%] 1
Improvements ✅
(secondary)
-2.3% [-2.6%, -2.1%] 5
All ❌✅ (primary) -3.9% [-3.9%, -3.9%] 1

Binary size

Results

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.

mean range count
Regressions ❌
(primary)
0.3% [0.0%, 0.8%] 61
Regressions ❌
(secondary)
0.2% [0.1%, 0.4%] 15
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.0%, 0.8%] 61

Bootstrap: 673.805s -> 671.537s (-0.34%)
Artifact size: 312.56 MiB -> 312.53 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Dec 15, 2023
@lqd lqd mentioned this pull request Dec 16, 2023
@lqd
Copy link
Member

lqd commented Dec 16, 2023

The wins here are actually the end of the noise spike from the PR merged before this one returning to steady-state.

The 4 regressions look real though and make sense, with more debuginfo data (seen in the binary size increase), and that should come with more work e.g. in the linker (cc @Kobzol: maybe we should normalize/show absolute values in the frontend/backend/linker perf.rlo sections for these cases where we know the total and ratio have changed, but can't compare the sections themselves as they're relative. But maybe using wall-time, until we re-land the switch to storing icounts in measureme, and noise would prevent from seeing actual signal in these small changes there anyways).

Note that we can put a lesser emphasis on the 2 regressions on syn, the biggest binary size increase on serde_derive and so on, they shouldn't be impacted in real-world dependency trees as proc-macros are built without debuginfo by cargo.

The regressions are pretty small, so probably not worth looking into much further imho.

@pnkfelix
Copy link
Member

I agree with @lqd's analysis and am marking as triaged

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 19, 2023
@davidtwco davidtwco deleted the issue-9228-describe-item-member-visibility branch January 3, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

debuginfo: Describe item and member visibility in debugging information
9 participants