[PATCH] D62258: [scudo][standalone] Introduce the thread specific data structures

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 17:02:51 PDT 2019


cryptoad added inline comments.


================
Comment at: lib/scudo/standalone/tsd_exclusive.h:77
+      initOnce(Instance);
+      atomic_thread_fence(memory_order_seq_cst);
+    }
----------------
morehouse wrote:
> cryptoad wrote:
> > morehouse wrote:
> > > I think things would be much simpler if we can use a `StaticSpinMutex`.  We're assuming we're zero-initialized anyway, so the mutex will be initialized before use as well.
> > I agree. But the issue that would come up using `StaticSpinMutex`, is that we would land in `initLinkerInitialized`where we should call the Mutex's `initLinkerInitialized` (to be consistent), while holding it. It works because it's a noop, but doesn't make sense from a logical perspective.
> > Implementing it this way (with our wannabe `call_once`) allows us to not have such a loophole.
> Can we simply remove `initLinkerInitialized` from `StaticSpinMutex`, as we have in sanitizer_common?  We could possibly add a comment that calls to `init` are only necessary if the mutex is not linker initialized.
Definitely can!


Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D62258





More information about the llvm-commits mailing list