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

Rewrite Windows compat_fn macro #99553

Merged
merged 1 commit into from
Jul 31, 2022
Merged

Conversation

ChrisDenton
Copy link
Member

@ChrisDenton ChrisDenton commented Jul 21, 2022

This allows using most delay loaded functions before the init code initializes them. It also only preloads a select few functions, rather than all functions.

This is optimized for the common case where a function is used after already being loaded (or failed to load). The only change in codegen at the call site is to use an atomic load instead of a plain load, which should have negligible or no impact.

I've split the old compat_fn macro in two so as not to mix two different use cases. If/when Windows 7 support is dropped compat_fn_optional can be removed entirely.

r? rust-lang/libs

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

rustbot commented Jul 21, 2022

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 @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. 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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 21, 2022
@ChrisDenton ChrisDenton added the O-windows Operating system: Windows label Jul 21, 2022
@ChrisDenton
Copy link
Member Author

Hm, I'm not sure who best to review this. The diff for compat.rs isn't particularly helpful so it might be best reviewed as a new thing. Maybe...

r? @Mark-Simulacrum

But feel very free to re-roll.

library/std/src/sys/windows/compat.rs Outdated Show resolved Hide resolved
library/std/src/sys/windows/compat.rs Outdated Show resolved Hide resolved
library/std/src/sys/windows/compat.rs Outdated Show resolved Hide resolved
library/std/src/sys/windows/compat.rs Outdated Show resolved Hide resolved
@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 23, 2022
@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 25, 2022
@Mark-Simulacrum
Copy link
Member

r=me with some squashing

@bors rollup=iffy

This allows using most delay loaded functions before the init code initializes them. It also only preloads a select few functions, rather than all functions.

Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
@ChrisDenton
Copy link
Member Author

@bors r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Jul 26, 2022

📌 Commit 698d4a8 has been approved by Mark-Simulacrum

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 Jul 26, 2022
@bors
Copy link
Contributor

bors commented Jul 28, 2022

⌛ Testing commit 698d4a8 with merge 9f9b76c027709b96b04ceadc2c19588248755cb3...

@bors
Copy link
Contributor

bors commented Jul 28, 2022

💥 Test timed out

@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 Jul 28, 2022
@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)

@ChrisDenton
Copy link
Member Author

@bors retry dist-aarch64-apple spurious timeout

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

bors commented Jul 31, 2022

⌛ Testing commit 698d4a8 with merge 76822a2...

@bors
Copy link
Contributor

bors commented Jul 31, 2022

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 76822a2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 31, 2022
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #99553!

Tested on commit 76822a2.
Direct link to PR: #99553

💔 miri on windows: test-pass → test-fail (cc @oli-obk @RalfJung).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jul 31, 2022
Tested on commit rust-lang/rust@76822a2.
Direct link to PR: <rust-lang/rust#99553>

💔 miri on windows: test-pass → test-fail (cc @oli-obk @RalfJung).
@bors bors merged commit 76822a2 into rust-lang:master Jul 31, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 31, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (76822a2): comparison url.

Instruction count

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

Max RSS (memory usage)

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.1% 3.1% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.4% -3.0% 2
All 😿🎉 (primary) N/A N/A 0

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regression found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.2% 3.2% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

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

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@ChrisDenton ChrisDenton deleted the lazy-compat-fn branch July 31, 2022 15:55
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. O-windows Operating system: Windows 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.

8 participants