about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authortyler <tyler@brainiumstudios.com>2019-04-30 18:24:38 -0700
committertyler <tyler@brainiumstudios.com>2019-05-15 07:30:33 -0700
commit7acfb99adc013d4b77c611cfc51bade551205f5a (patch)
tree59461cea814349005ab153ae4ebb218f0b9441eb /src/libstd/sys
parent430a091cd80c0e4b6bf44f6a19463a832e566f97 (diff)
downloadrust-7acfb99adc013d4b77c611cfc51bade551205f5a.tar.gz
rust-7acfb99adc013d4b77c611cfc51bade551205f5a.zip
Revert "ensure fast thread local lookups occur once per access on macos"
This reverts commit d252f3b77f3b7d4cd59620588f9d026633c05816.
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/redox/fast_thread_local.rs6
-rw-r--r--src/libstd/sys/unix/fast_thread_local.rs17
-rw-r--r--src/libstd/sys/windows/fast_thread_local.rs4
3 files changed, 1 insertions, 26 deletions
diff --git a/src/libstd/sys/redox/fast_thread_local.rs b/src/libstd/sys/redox/fast_thread_local.rs
index c34cd575db7..67b92d490b2 100644
--- a/src/libstd/sys/redox/fast_thread_local.rs
+++ b/src/libstd/sys/redox/fast_thread_local.rs
@@ -1,8 +1,4 @@
 #![cfg(target_thread_local)]
 #![unstable(feature = "thread_local_internals", issue = "0")]
 
-pub use crate::sys_common::thread_local::register_dtor_fallback as register_dtor;
-
-pub unsafe fn lookup_once<T>(ptr: *const &T) -> &T {
-    *ptr
-}
+pub use crate::sys_common::thread_local::register_dtor_fallback as register_dtor;
\ No newline at end of file
diff --git a/src/libstd/sys/unix/fast_thread_local.rs b/src/libstd/sys/unix/fast_thread_local.rs
index 28fb9800541..c34c2e6e786 100644
--- a/src/libstd/sys/unix/fast_thread_local.rs
+++ b/src/libstd/sys/unix/fast_thread_local.rs
@@ -82,20 +82,3 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) {
         }
     }
 }
-
-#[cfg(not(target_os = "macos"))]
-pub unsafe fn lookup_once<T>(ptr: *const &T) -> &T {
-    *ptr
-}
-
-#[cfg(target_os = "macos")]
-pub unsafe fn lookup_once<T>(ptr: *const &T) -> &T {
-    // On macos, thread_local lookups can result in terrible code due to
-    // aggressive rerunning of the macos equivalent of `__tls_get_addr` - four
-    // lookups per actual reference in user code.
-    //
-    // Using a read_volatile on a value holding fast Key's address tricks the
-    // optimizer into only calling the macos get_addr equivalent once per time
-    // requested by the user.
-    crate::ptr::read_volatile(ptr)
-}
diff --git a/src/libstd/sys/windows/fast_thread_local.rs b/src/libstd/sys/windows/fast_thread_local.rs
index 566d5524fd7..31d0bd1e72e 100644
--- a/src/libstd/sys/windows/fast_thread_local.rs
+++ b/src/libstd/sys/windows/fast_thread_local.rs
@@ -2,7 +2,3 @@
 #![cfg(target_thread_local)]
 
 pub use crate::sys_common::thread_local::register_dtor_fallback as register_dtor;
-
-pub unsafe fn lookup_once<T>(ptr: *const &T) -> &T {
-    *ptr
-}