-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rustc: Enable #[thread_local] for Windows #42687
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -334,6 +334,82 @@ impl<T: 'static> LocalKey<T> { | |||
} | |||
|
|||
#[doc(hidden)] | |||
#[cfg(target_thread_local)] | |||
pub mod fast { |
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.
Can we use pub (crate)
here to avoid the #[doc(hidden)]
sadness?
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.
Ah unfortunately the inner type is reexported as #[doc(hidden)]
for "macro hygiene" and rustdoc doesn't see through that so still demands documentation on all the internals :(
LGTM other than the one nit. |
@bors: r=sfackler |
📌 Commit 1a9567a has been approved by |
⌛ Testing commit 1a9567a99ec266817b197a4321ce50840ac4de22 with merge 94cf20512562e34e8e091cff38a8675ef433041a... |
💔 Test failed - status-appveyor |
1a9567a
to
b58ed7c
Compare
@bors: r=sfackler |
📌 Commit b58ed7c has been approved by |
⌛ Testing commit b58ed7c039850e33c6d83b75784976da112d5d5e with merge 3fbe2405f3f4e65c564d7e68cddfc9b6124eef8c... |
💔 Test failed - status-appveyor |
b58ed7c
to
ed3ed24
Compare
Hm I believe I successfully bootstrapped and ran tests for x86_64, but looks like i686 segfaults. I'll try disabling i686-msvc and see how far that gets us. @bors: r=sfackler |
📌 Commit ed3ed24 has been approved by |
⌛ Testing commit ed3ed2414f00d3e03a08c35e7434c20aa838aca6 with merge ec79ceed8c7af7f63dbfe27225eaa6fc3becdb35... |
💔 Test failed - status-appveyor |
Feels... spurious? Or at least unrelated, maybe? But with such a change I'm not going to retry myself...
|
Nah looks like this just doesn't work on 32-bit, I'll ignore the gnu target as well. |
ed3ed24
to
321c5be
Compare
@bors: r=sfackler |
📌 Commit 321c5be has been approved by |
⌛ Testing commit 321c5beca38a1b819e37c6611dde3b69b325fe85 with merge f2f68d3778fae69f9bd8dbac02d11a64bd2a1ee8... |
💔 Test failed - status-appveyor |
|
I think LLVM has had support for quite some time now for this, we just never got around to testing it out and binding it. We've had some trouble landing this in the past I believe, but it's time to try again! This commit flags the `#[thread_local]` attribute as being available for Windows targets and adds an implementation of `register_dtor` in the `thread::local` module to ensure we can destroy these keys. The same functionality is implemented in clang via a function called `__tlregdtor` (presumably provided in some Windows runtime somewhere), but this function unfortunately does not take a data pointer (just a thunk) which means we can't easily call it. For now destructors are just run in the same way the Linux fallback is implemented, which is just keeping track via a single OS-based TLS key.
321c5be
to
06540cb
Compare
Ok well I tested this on one platform before submitting, @bors: r=sfackler |
📌 Commit 06540cb has been approved by |
rustc: Enable #[thread_local] for Windows I think LLVM has had support for quite some time now for this, we just never got around to testing it out and binding it. We've had some trouble landing this in the past I believe, but it's time to try again! This commit flags the `#[thread_local]` attribute as being available for Windows targets and adds an implementation of `register_dtor` in the `thread::local` module to ensure we can destroy these keys. The same functionality is implemented in clang via a function called `__tlregdtor` (presumably provided in some Windows runtime somewhere), but this function unfortunately does not take a data pointer (just a thunk) which means we can't easily call it. For now destructors are just run in the same way the Linux fallback is implemented, which is just keeping track via a single OS-based TLS key.
☀️ Test successful - status-appveyor, status-travis |
Fix Redox build, apparently broken by #42687
I think LLVM has had support for quite some time now for this, we just never got
around to testing it out and binding it. We've had some trouble landing this in
the past I believe, but it's time to try again!
This commit flags the
#[thread_local]
attribute as being available for Windowstargets and adds an implementation of
register_dtor
in thethread::local
module to ensure we can destroy these keys. The same functionality is
implemented in clang via a function called
__tlregdtor
(presumably provided insome Windows runtime somewhere), but this function unfortunately does not take a
data pointer (just a thunk) which means we can't easily call it. For now
destructors are just run in the same way the Linux fallback is implemented,
which is just keeping track via a single OS-based TLS key.