[NFC][compiler-rt][hwasan] Re-use ring buffer size calculation
authorLeonard Chan <leonardchan@google.com>
Wed, 23 Jun 2021 23:12:52 +0000 (16:12 -0700)
committerLeonard Chan <leonardchan@google.com>
Tue, 29 Jun 2021 18:57:33 +0000 (11:57 -0700)
Users can call HwasanThreadList::GetRingBufferSize rather than RingBufferSize
to prevent having to do the calculation in RingBufferSize. This will be useful
for Fuchsia where we plan to initialize the stack ring buffer separately from
the rest of thread initialization.

Differential Revision: https://reviews.llvm.org/D104823

compiler-rt/lib/hwasan/hwasan_thread_list.h

index 8e6c8ad..15916a8 100644 (file)
@@ -171,6 +171,8 @@ class HwasanThreadList {
     return stats_;
   }
 
+  uptr GetRingBufferSize() const { return ring_buffer_size_; }
+
  private:
   Thread *AllocThread() {
     SpinMutexLock l(&free_space_mutex_);