Commit 67c99b13 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

excise AccessSpreader extern-template-struct

Summary:
There appear always to be problems with `extern template struct`. In this case, some compilers either not emitting or dropping thread-local wrapper functions.

```
stderr: Undefined symbols for architecture x86_64:
  "thread-local wrapper routine for folly::AccessSpreader<std::__1::atomic>::cpuCache", referenced from:
      folly::AccessSpreader<std::__1::atomic>::cachedCurrent(unsigned long) in CacheLocality.cpp.o
  "thread-local wrapper routine for folly::SequentialThreadId<std::__1::atomic>::currentId", referenced from:
      folly::SequentialThreadId<std::__1::atomic>::get() in CacheLocality.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Reviewed By: Mizuchi

Differential Revision: D27579816

fbshipit-source-id: b539816fb1f62d9e50e22d6cbc3c91a0d82ac629
parent ad41ba19
......@@ -318,11 +318,6 @@ Getcpu::Func Getcpu::resolveVdsoFunc() {
#endif
}
#ifdef FOLLY_CL_USE_FOLLY_TLS
/////////////// SequentialThreadId
template struct SequentialThreadId<std::atomic>;
#endif
namespace detail {
int AccessSpreaderBase::degenerateGetcpu(unsigned* cpu, unsigned* node, void*) {
......@@ -370,9 +365,6 @@ bool AccessSpreaderBase::initialize(
} // namespace detail
/////////////// AccessSpreader
template struct AccessSpreader<std::atomic>;
SimpleAllocator::SimpleAllocator(size_t allocSize, size_t sz)
: allocSize_{allocSize}, sz_(sz) {}
......
......@@ -170,10 +170,6 @@ Atom<unsigned> SequentialThreadId<Atom>::prevId(0);
template <template <typename> class Atom>
FOLLY_TLS unsigned SequentialThreadId<Atom>::currentId(0);
// Suppress this instantiation in other translation units. It is
// instantiated in CacheLocality.cpp
extern template struct SequentialThreadId<std::atomic>;
#endif
struct HashingThreadId {
......@@ -395,10 +391,6 @@ FOLLY_TLS
template <template <typename> class Atom>
bool AccessSpreader<Atom>::initialized = AccessSpreader<Atom>::initialize();
// Suppress this instantiation in other translation units. It is
// instantiated in CacheLocality.cpp
extern template struct AccessSpreader<std::atomic>;
/**
* A simple freelist allocator. Allocates things of size sz, from
* slabs of size allocSize. Takes a lock on each
......
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