[compiler-rt] [msan] Dynamically grow kNumStackOriginDescrs (PR #92826)
Evgenii Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 21 10:54:23 PDT 2024
eugenis wrote:
> > We could go with an array of pointers to exponentially increasing allocations (i.e. same as your case, but never deallocate, instead just allocate more and consider the container a logical concatenation of multiple buffers).
>
> This is still tricky to implement in a thread-safe, lock-free manner, because there are two arrays to be grown (StackOriginDescrs, StackOriginPC).
I think it will actually work pretty well.
If subarrays are power of 2 sized (1, 2, 4, 8, 16, ...), then the subarray for index i is basically log2(i+1). Both arrays can be handled independently; once the index is acquired, the subarray pointer is initialized with a double-checked locking pattern.
https://github.com/llvm/llvm-project/pull/92826
More information about the llvm-commits
mailing list