This change hides all the initialization of thread_local variables used
by the XRay FDR mode implementation behind a function call. This makes
initialization of thread-local data to be done lazily, instead of
eagerly when they're done as globals. It also gives us an isolation
mechanism if/when we want to change the TLS implementation from using
the C++ thread_local keyword, for something more ad-hoc (potentialy
using pthread directly) on some platforms or set-ups where we cannot use
the C++ thread_local variables.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Out of curiosity, why did you make bool Revision 'volatile'? Will it be modified elsewhere?
Comment Actions
Thanks, @eizan
The recursion guard? That's so that we make sure all the loads and stores are in the same order as they appear in the code.
If we don't use the volatile keyword there, the compiler may be free to elide some of the stores or consolidate them into a single one. Seen this optimisation happen in the wild enough to learn from it. :)