[libcxx-commits] [PATCH] D126975: [libunwind] Disable DwarfFDECache if _LIBUNWIND_NO_HEAP=1

Maksim Kita via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 3 10:25:06 PDT 2022


kitaisreal created this revision.
Herald added a subscriber: libcxx-commits.
Herald added a project: All.
kitaisreal requested review of this revision.

Repository:
  rUNW libunwind

https://reviews.llvm.org/D126975

Files:
  libunwind/src/UnwindCursor.hpp


Index: libunwind/src/UnwindCursor.hpp
===================================================================
--- libunwind/src/UnwindCursor.hpp
+++ libunwind/src/UnwindCursor.hpp
@@ -151,6 +151,7 @@
 template <typename A>
 typename A::pint_t DwarfFDECache<A>::findFDE(pint_t mh, pint_t pc) {
   pint_t result = 0;
+#if !defined(_LIBUNWIND_NO_HEAP)
   _LIBUNWIND_LOG_IF_FALSE(_lock.lock_shared());
   for (entry *p = _buffer; p < _bufferUsed; ++p) {
     if ((mh == p->mh) || (mh == kSearchAll)) {
@@ -161,6 +162,7 @@
     }
   }
   _LIBUNWIND_LOG_IF_FALSE(_lock.unlock_shared());
+#endif
   return result;
 }
 
@@ -198,6 +200,7 @@
 
 template <typename A>
 void DwarfFDECache<A>::removeAllIn(pint_t mh) {
+#if !defined(_LIBUNWIND_NO_HEAP)
   _LIBUNWIND_LOG_IF_FALSE(_lock.lock());
   entry *d = _buffer;
   for (const entry *s = _buffer; s < _bufferUsed; ++s) {
@@ -209,6 +212,7 @@
   }
   _bufferUsed = d;
   _LIBUNWIND_LOG_IF_FALSE(_lock.unlock());
+#endif
 }
 
 #ifdef __APPLE__
@@ -221,11 +225,13 @@
 template <typename A>
 void DwarfFDECache<A>::iterateCacheEntries(void (*func)(
     unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh)) {
+#if !defined(_LIBUNWIND_NO_HEAP)
   _LIBUNWIND_LOG_IF_FALSE(_lock.lock());
   for (entry *p = _buffer; p < _bufferUsed; ++p) {
     (*func)(p->ip_start, p->ip_end, p->fde, p->mh);
   }
   _LIBUNWIND_LOG_IF_FALSE(_lock.unlock());
+#endif
 }
 #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126975.434060.patch
Type: text/x-patch
Size: 1456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220603/67824b6b/attachment.bin>


More information about the libcxx-commits mailing list