Structs

Extra per-location state.

StackCache 🔒

A very small cache of searches of the borrow stack This maps tags to locations in the borrow stack. Any use of this still needs to do a probably-cold random access into the borrow stack to figure out what Permission an SbTag grants. We could avoid this by also storing the Permission in the cache, but most lookups into the cache are immediately followed by access of the full borrow stack anyway.

Constants

CACHE_LEN 🔒

Exactly what cache size we should use is a difficult tradeoff. There will always be some workload which has a SbTag working set which exceeds the size of the cache, and ends up falling back to linear searches of the borrow stack very often. The cost of making this value too large is that the loop in Stack::insert which ensures the entries in the cache stay correct after an insert becomes expensive.