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

Fix StaticSingletonManager inline fast path under gcc

Summary: [Folly] Fix StaticSingletonManager inline fast path under gcc - code size for default-initialized `static std::atomic<...>` local is large, but when value-initialized is trivial.

Reviewed By: andriigrynenko

Differential Revision: D14018861

fbshipit-source-id: e767ea3e46c3e3317f7b60008bc77f64edb2dea0
parent eba1ff75
......@@ -34,7 +34,7 @@ class StaticSingletonManager {
public:
template <typename T, typename Tag>
FOLLY_EXPORT FOLLY_ALWAYS_INLINE static T& create() {
static Cache cache;
static Cache cache{};
auto const& key = typeid(TypeTuple<T, Tag>);
auto const v = cache.load(std::memory_order_acquire);
auto const p = FOLLY_LIKELY(!!v) ? v : create_(key, make<T>, cache);
......
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