[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 07:45:12 PST 2021


ldionne 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.
----------------
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`?


================
Comment at: libcxxabi/src/cxa_guard_impl.h:232
   AcquireResult cxa_guard_acquire() {
-    AtomicInt<uint8_t> guard_byte(guard_byte_address);
-    if (guard_byte.load(std::_AO_Acquire) != UNSET)
+    // use short-circuit evalutation to avoid calling init_byte.acquire when
+    // guard_byte.acquire returns true. (i.e. don't call it when we know from
----------------



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