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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 13 11:35:29 PST 2021


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

Please rebase onto `main` and make sure you have a green CI run.



================
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.
----------------
DanielMcIntosh-IBM wrote:
> 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).
Thanks for the information!


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