summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-09-10 20:14:30 +0000
committerReid Kleckner <reid@kleckner.net>2013-09-10 20:14:30 +0000
commit942f9fe11d3a9583eef6bc4ca2549b1f0d1694da (patch)
tree93752b1c56a7c888c8b64cb535046a4a78efb151 /lib/CodeGen/CGExpr.cpp
parentfe4f670935b07eb18d80200e292e08bfe523e417 (diff)
downloadclang-942f9fe11d3a9583eef6bc4ca2549b1f0d1694da.tar.gz
clang-942f9fe11d3a9583eef6bc4ca2549b1f0d1694da.tar.bz2
clang-942f9fe11d3a9583eef6bc4ca2549b1f0d1694da.tar.xz
[ms-cxxabi] Implement guard variables for static initialization
Static locals requiring initialization are not thread safe on Windows. Unfortunately, it's possible to create static locals that are actually externally visible with inline functions and templates. As a result, we have to implement an initialization guard scheme that is compatible with TUs built by MSVC, which makes thread safety prohibitively difficult. MSVC's scheme is that every function that requires a guard gets an i32 bitfield. Each static local is assigned a bit that indicates if it has been initialized, up to 32 bits, at which point a new bitfield is created. MSVC rejects inline functions with more than 32 static locals, and the externally visible mangling (?_B) only allows for one guard variable per function. On Eli's recommendation, I used MangleNumberingContext to track which bit each static corresponds to. Implements PR16888. Reviewers: rjmccall, eli.friedman Differential Revision: http://llvm-reviews.chandlerc.com/D1416 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
0 files changed, 0 insertions, 0 deletions