Module miri::borrow_tracker::stacked_borrows::stack

source ·


  • Extra per-location state.
  • StackCache 🔒
    A very small cache of searches of a borrow stack, mapping Items to their position in said stack.


    Exactly what cache size we should use is a difficult tradeoff. There will always be some workload which has a BorTag 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.