Commit 10a9dadf authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Cut SingletonThreadLocal::getWrapperInline

Summary:
[Folly] Cut `SingletonThreadLocal::getWrapperInline`.

It would not be useful in any scenario, given that the generated code is very large.

Reviewed By: djwatson

Differential Revision: D7315501

fbshipit-source-id: 1ebc15ca0eaf13adaf52fae3971e7f9914bfe10e
parent 9885dc08
...@@ -96,21 +96,14 @@ class SingletonThreadLocal { ...@@ -96,21 +96,14 @@ class SingletonThreadLocal {
} }
}; };
FOLLY_EXPORT FOLLY_ALWAYS_INLINE static Wrapper& getWrapperInline() { FOLLY_EXPORT FOLLY_NOINLINE static Wrapper& getWrapper() {
/* library-local */ static auto entry = /* library-local */ static auto entry =
detail::createGlobal<ThreadLocal<Wrapper>, Tag>(); detail::createGlobal<ThreadLocal<Wrapper>, Tag>();
return **entry; return **entry;
} }
FOLLY_NOINLINE static Wrapper& getWrapperOutline() {
return getWrapperInline();
}
/// Benchmarks indicate that getSlow being inline but containing a call to
/// getWrapperOutline is faster than getSlow being outline but containing
/// a call to getWrapperInline, which would otherwise produce smaller code.
FOLLY_ALWAYS_INLINE static Wrapper& getSlow(Wrapper*& cache) { FOLLY_ALWAYS_INLINE static Wrapper& getSlow(Wrapper*& cache) {
cache = &getWrapperOutline(); cache = &getWrapper();
cache->cache = &cache; cache->cache = &cache;
return *cache; return *cache;
} }
...@@ -122,7 +115,7 @@ class SingletonThreadLocal { ...@@ -122,7 +115,7 @@ class SingletonThreadLocal {
static FOLLY_TLS Wrapper* cache; static FOLLY_TLS Wrapper* cache;
return FOLLY_LIKELY(!!cache) ? *cache : getSlow(cache); return FOLLY_LIKELY(!!cache) ? *cache : getSlow(cache);
#else #else
return getWrapperInline(); return getWrapper();
#endif #endif
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment