================
@@ -138,6 +138,20 @@ const uint8_t *MemoryCache::FindL1CacheEntry(lldb::addr_t
addr,
return pos->second->GetBytes() + (addr - chunk_range.GetRangeBase());
}
+const uint8_t *MemoryCache::FindL2CacheEntry(lldb::addr_t addr,
+ size_t len) const {
+ if (m_L2_cache.empty())
+ return nullptr;
+ const lldb::addr_t line_offset = addr % m_L2_cache_line_byte_size;
+ BlockMap::const_iterator pos = m_L2_cache.find(addr - line_offset);
+ if (pos == m_L2_cache.end())
+ return nullptr;
+ // Like the L1 lookup, a read spanning two lines is treated as a miss.
----------------
felipepiovezan wrote:
I think this comment should be removed for two reasons:
> // Like the L1 lookup,
The L1 cache has no concept of lines, it deals with chunks of arbitrary sizes.
> a read spanning two lines is treated as a miss.
This doesn't explain _why_ it is treated as a miss, which is the interesting
part; instead, it is just restating word-by-word what `if` statement already
states. And the "why" is just "to keep the implementation simple".
https://github.com/llvm/llvm-project/pull/216318
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits