| 120 | } |
| 121 | |
| 122 | void add(const UnwindInfoSections *UIS) { |
| 123 | CacheEntry *Current = nullptr; |
| 124 | |
| 125 | if (Unused != nullptr) { |
| 126 | Current = Unused; |
| 127 | Unused = Unused->Next; |
| 128 | } else { |
| 129 | Current = MostRecentlyUsed; |
| 130 | CacheEntry *Previous = nullptr; |
| 131 | while (Current->Next != nullptr) { |
| 132 | Previous = Current; |
| 133 | Current = Current->Next; |
| 134 | } |
| 135 | Previous->Next = nullptr; |
| 136 | _LIBUNWIND_FRAMEHEADERCACHE_TRACE("FrameHeaderCache evict [%lx - %lx)", |
| 137 | Current->LowPC(), Current->HighPC()); |
| 138 | } |
| 139 | |
| 140 | Current->Info = *UIS; |
| 141 | Current->Next = MostRecentlyUsed; |
| 142 | MostRecentlyUsed = Current; |
| 143 | _LIBUNWIND_FRAMEHEADERCACHE_TRACE("FrameHeaderCache add [%lx - %lx)", |
| 144 | MostRecentlyUsed->LowPC(), |
| 145 | MostRecentlyUsed->HighPC()); |
| 146 | } |
| 147 | }; |
| 148 | |
| 149 | #endif // __FRAMEHEADER_CACHE_HPP__ |
no test coverage detected