Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions include/hx/Tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,22 @@ struct TLSData
#define EXTERN_FAST_TLS_DATA(TYPE,NAME) \
__declspec(thread) extern TYPE * NAME;

#elif defined(HX_LINUX) && defined(__GNUC__) && !defined(HXCPP_PTHREAD_FAST_TLS)

// The fast slot (the GC's stack context, read on each allocation that leaves
// the inline path) is a plain thread-local pointer: one load from the thread
// pointer instead of a call to pthread_getspecific. __thread rather than
// thread_local, so the extern declaration reads it directly instead of
// calling the wrapper C++ emits in case of a dynamic initializer.
#define DECLARE_TLS_DATA(TYPE,NAME) \
::hx::TLSData<TYPE> NAME;
#define DECLARE_FAST_TLS_DATA(TYPE,NAME) \
__thread TYPE * NAME = nullptr;
#define EXTERN_TLS_DATA(TYPE,NAME) \
extern ::hx::TLSData<TYPE> NAME;
#define EXTERN_FAST_TLS_DATA(TYPE,NAME) \
extern __thread TYPE * NAME;

#else

#define DECLARE_TLS_DATA(TYPE,NAME) \
Expand Down
Loading