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

Inline core::panic::Location methods #96348

Merged
merged 1 commit into from
Apr 30, 2022

Conversation

overdrivenpotato
Copy link
Contributor

This avoids the overhead of a function call when used.

@rust-highfive
Copy link
Collaborator

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs to request review from a libs-api team reviewer. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 23, 2022
@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 23, 2022
@the8472
Copy link
Member

the8472 commented Apr 23, 2022

For caller this was tried previously and had to be reverted, see #95735

@overdrivenpotato
Copy link
Contributor Author

@the8472 Isn't that a bug in bjorn3/rustc_codegen_cranelift rather than a responsibility of libcore? Perhaps that is a symptom of a bigger issue in that project, regarding inlined #[track_caller] functions.

@the8472
Copy link
Member

the8472 commented Apr 23, 2022

I'm just pointing out the issue, I'm no cranelift expert. But cranelift is an official, although experimental, compiler backend so libcore has to work with it too.

@bjorn3
Copy link
Member

bjorn3 commented Apr 30, 2022

Perhaps that is a symptom of a bigger issue in that project, regarding inlined #[track_caller] functions.

Looks like the implementation of #[track_caller] in cg_llvm changed since I implemented it in cg_clif. I will try to apply the changes to cg_clif and report back.

@bjorn3
Copy link
Member

bjorn3 commented Apr 30, 2022

That was indeed the issue. Pushed rust-lang/rustc_codegen_cranelift@f3fc94f with a fix. Adding #[inline] to Location::caller() is fine with me.

@bjorn3
Copy link
Member

bjorn3 commented Apr 30, 2022

By the way feel free to ping me about anything regarding the cranelift backend.

@overdrivenpotato
Copy link
Contributor Author

Great, thanks for clarifying @bjorn3. Do you have the ability to merge this PR?

@bjorn3
Copy link
Member

bjorn3 commented Apr 30, 2022

Technically I can approve it. However I don't feel qualified to review non-compiler changes.

@the8472
Copy link
Member

the8472 commented Apr 30, 2022

The rationale from the previously approved PR should still apply. It's not an API change. And @bjorn3 fixed the reason for the revert. So this should be fine.

Disabling rollup since the queue is almost empty and this changes a few more methods to inline, compared to the previous PR.

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Apr 30, 2022

📌 Commit 92a5841 has been approved by the8472

@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 Apr 30, 2022
@bors
Copy link
Contributor

bors commented Apr 30, 2022

⌛ Testing commit 92a5841 with merge 579d268...

@bors
Copy link
Contributor

bors commented Apr 30, 2022

☀️ Test successful - checks-actions
Approved by: the8472
Pushing 579d268 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 30, 2022
@bors bors merged commit 579d268 into rust-lang:master Apr 30, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 30, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (579d268): comparison url.

Summary:

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regressions found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 0 11 0 0 0
mean2 N/A 0.5% N/A N/A N/A
max N/A 0.8% N/A N/A N/A

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

@rustbot rustbot added the perf-regression Performance regression. label Apr 30, 2022
@overdrivenpotato
Copy link
Contributor Author

The inlining here only changes function calls to register loads, so this seems spurious. https://godbolt.org/z/41YhbWfEr

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Apr 30, 2022
@overdrivenpotato overdrivenpotato deleted the inline-location branch June 12, 2022 17:07
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-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants