[libcxx-commits] [PATCH] D115367: [NFC][libcxxabi] Pulled guard byte code out of GuardObject

Daniel McIntosh via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 13 09:48:37 PST 2021


DanielMcIntosh-IBM marked an inline comment as done.
DanielMcIntosh-IBM added inline comments.


================
Comment at: libcxxabi/src/cxa_guard_impl.h:15
  *
  * The first "guard byte" (which is checked by the compiler) is set only upon
  * the completion of cxa release.
----------------
ldionne wrote:
> This is confusing me -- does the compiler really check the guard byte? Isn't it what we do in the library when we do `guard_byte.load(std::_AO_Acquire) != UNSET`?
Yes, for performance reasons we check it inline before calling `__cxa_guard_acquire`: https://godbolt.org/z/hY1555Wcx. I believe in clang this is generated around clang/lib/CodeGen/ItaniumCXXABI.cpp:2470. As you point out, we also check it inside `__cxa_guard_acquire`, I assume this is in case the library is used with a compiler that doesn't generate the inline check (or something along those lines).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115367/new/

https://reviews.llvm.org/D115367



More information about the libcxx-commits mailing list