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

[Experiment] Don't merge vtables for improved debugging. #103514

Conversation

michaelwoerister
Copy link
Member

With this PR I'd like to test the performance and size impact of making vtables unique by removing the unnamed_addr attribute from them. Having unique vtables is good for debuginfo, because it allows to map from a dyn pointer to the self-type of the trait-object by looking at the vtable's debuginfo. If vtables are merged, we lose this ability because we might get the wrong self-type.

This PR disables vtable merging unconditionally, so we can see the impact on perf.rlo. An actual implementation would likely only disable it when full debuginfo is enabled.

r? @ghost

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 25, 2022
@michaelwoerister
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 25, 2022
@bors
Copy link
Contributor

bors commented Oct 25, 2022

⌛ Trying commit 0247c6a with merge 65f47026b47e75096d402bd8cd83f87bd1994c82...

@bors
Copy link
Contributor

bors commented Oct 25, 2022

☀️ Try build successful - checks-actions
Build commit: 65f47026b47e75096d402bd8cd83f87bd1994c82 (65f47026b47e75096d402bd8cd83f87bd1994c82)

@rust-timer
Copy link
Collaborator

Queued 65f47026b47e75096d402bd8cd83f87bd1994c82 with parent 31d754a, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (65f47026b47e75096d402bd8cd83f87bd1994c82): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking 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.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Instruction count

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

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.2% [-1.2%, -1.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Footnotes

  1. the arithmetic mean of the percent change

  2. number of relevant changes

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 25, 2022
@michaelwoerister
Copy link
Member Author

OK, it looks like performance isn't noticeably affected by this change. I suspect that vtables already don't get merged that often, so the price of making sure it never happens shouldn't be too high.

I'll close this PR and open a cleaned-up version that just enables this when full debuginfo is requested.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 28, 2023
…s-when-debuginfo, r=WaffleLapkin

Don't merge vtables when full debuginfo is enabled.

This PR makes the compiler not emit the `unnamed_addr` attribute for vtables when full debuginfo is enabled, so that they don't get merged even if they have the same contents. This allows debuggers to more reliably map from a dyn pointer to the self-type of a trait object by looking at the vtable's debuginfo.

The PR only changes the behavior of the LLVM backend as other backends don't emit vtable debuginfo (as far as I can tell).

The performance impact of this change should be small as [measured](rust-lang#103514 (comment)) in a previous PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants