Uh oh!
There was an error while loading. Please reload this page.
Make the LocalKey facade of thread_local! inlineable cross-crate. - #43931
Conversation
oli-obk
commented
Aug 17, 2017
This doesn't work on stage0 apparently. |
@oli-obk Fixing. |
48c6988 to
2040db1Comparealexcrichton
commented
Aug 17, 2017
Awesome, looks great! One thing I noticed locally was that the Regardless of that decision r=me, just wanted to see what you thought |
eddyb
commented
Aug 17, 2017
Ah I didn't think much about it but in the cheap cases it'd definitely help. @bors r=alexcrichton |
bors
commented
Aug 17, 2017
📌 Commit ee1a970 has been approved by |
bors
commented
Aug 19, 2017
⌛ Testing commit ee1a970513d32d8a748e446d10b093f6d79225ea with merge 414b93e932ec81413dddc3d011c8f0a3f5a6145c... |
bors
commented
Aug 19, 2017
💔 Test failed - status-appveyor |
@bors retry Failed to build |
bors
commented
Aug 19, 2017
⌛ Testing commit ee1a970513d32d8a748e446d10b093f6d79225ea with merge b60970f3ff1d0716c7ff153db0412ce677ea0e9b... |
bors
commented
Aug 19, 2017
💔 Test failed - status-appveyor |
kennytm
commented
Aug 19, 2017
Same issue. Legit. @eddyb |
Same failure. I have |
kennytm
commented
Aug 19, 2017
Perhaps a bug in the rvalue promotion to |
@kennytm That |
EDIT: I'm dumb, MSVC doesn't use OS TLS, so it's the fast TLS that's broken... |
@alexcrichton Weren't there some oddities ages ago, back in the old runtime, where some of the thread-local accesses had to be in non- |
alexcrichton
commented
Aug 20, 2017
eddyb
commented
Aug 20, 2017
@alexcrichton Do you think not having |
alexcrichton
commented
Aug 22, 2017
Personally, not really, but you seem eager to land this so I won't stop you if you'd like to do that. If you do, though, please leave a comment with as much information that you know. |
carols10cents
commented
Aug 28, 2017
friendly ping @eddyb to keep this on your radar! |
alexcrichton
commented
Aug 28, 2017
@bors: r- This got back in the queue... |
… in order to limit stack frame sizes after extra inlining from rust-lang/rust#43931 See #18420 (comment)
… in order to limit stack frame sizes after extra inlining from rust-lang/rust#43931 See #18420 (comment)
Issue rust-lang#25088 has been part of `thread_local!` for quite some time now. Historical attempts have been made to add `#[inline]` to `__getit` in rust-lang#43931, rust-lang#50252, and rust-lang#59720, but these attempts ended up not landing at the time due to segfaults on Windows. In the interim though with `const`-initialized thread locals AFAIK this is the only remaining bug which is why you might want to use `#[thread_local]` over `thread_local!`. As a result I figured it was time to resubmit this and see how it fares on CI and if I can help debugging any issues that crop up. Closesrust-lang#25088
…ss-crate, r=Mark-Simulacrum std: Attempt again to inline thread-local-init across crates Issue rust-lang#25088 has been part of `thread_local!` for quite some time now. Historical attempts have been made to add `#[inline]` to `__getit` in rust-lang#43931, rust-lang#50252, and rust-lang#59720, but these attempts ended up not landing at the time due to segfaults on Windows. In the interim though with `const`-initialized thread locals AFAIK this is the only remaining bug which is why you might want to use `#[thread_local]` over `thread_local!`. As a result I figured it was time to resubmit this and see how it fares on CI and if I can help debugging any issues that crop up. Closesrust-lang#25088
Fixes (almost*) #25088 by changing the
LocalKeystaticthread_local!generates to aconst.This can be done because a
LocalKeyvalue holds no actual TLS data, only function pointers to get at said data, and it could even be madeCopywithout any negative consequences.The recent stabilization of rvalue promotion to
'staticallows doing this without changing the API.r? @alexcrichton
*almost because we can't yet inline
__getitbecause it breaks on MSVC, see #43931 (comment)