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

Tweak ThreadLocal inlining

Summary:
[Folly] Tweak `ThreadLocal` inlining.

Shrinks overly-large generated code for `ThreadLocal::get()`.

Reviewed By: luciang

Differential Revision: D9732837

fbshipit-source-id: 71eb10d9759e1fa17248e0feed75f610948afe21
parent 462232b4
......@@ -66,7 +66,7 @@ class ThreadLocal {
explicit ThreadLocal(F&& constructor)
: constructor_(std::forward<F>(constructor)) {}
T* get() const {
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN T* get() const {
auto const ptr = tlp_.get();
return FOLLY_LIKELY(!!ptr) ? ptr : makeTlp();
}
......@@ -97,7 +97,7 @@ class ThreadLocal {
ThreadLocal(const ThreadLocal&) = delete;
ThreadLocal& operator=(const ThreadLocal&) = delete;
T* makeTlp() const {
FOLLY_NOINLINE T* makeTlp() const {
auto const ptr = constructor_();
tlp_.reset(ptr);
return ptr;
......
......@@ -433,7 +433,7 @@ struct StaticMeta final : StaticMetaBase {
return *instance;
}
FOLLY_ALWAYS_INLINE static ElementWrapper& get(EntryID* ent) {
FOLLY_EXPORT FOLLY_ALWAYS_INLINE static ElementWrapper& get(EntryID* ent) {
// Eliminate as many branches and as much extra code as possible in the
// cached fast path, leaving only one branch here and one indirection below.
uint32_t id = ent->getOrInvalid();
......@@ -450,7 +450,7 @@ struct StaticMeta final : StaticMetaBase {
return threadEntry->elements[id];
}
static void getSlowReserveAndCache(
FOLLY_NOINLINE static void getSlowReserveAndCache(
EntryID* ent,
uint32_t& id,
ThreadEntry*& threadEntry,
......
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