| 99 | } |
| 100 | |
| 101 | void XRTCompilationCache::DiscardEntryRefLocked(CompiledSubgraph* entry) { |
| 102 | if (entry->RefCountIsOne()) { |
| 103 | // The last reference to this entry is going away, so really delete it from |
| 104 | // the cache in such a way that it can't be restored by being looked up |
| 105 | // again. |
| 106 | |
| 107 | // Sanity-check that it has been marked for eviction. |
| 108 | CHECK(entries_by_last_use_.find(entry->last_use) == |
| 109 | entries_by_last_use_.end()); |
| 110 | // Update the counter tracking how much space is taken up by entries that |
| 111 | // are marked for eviction. |
| 112 | --marked_for_eviction_entries_; |
| 113 | |
| 114 | // Remove the entry from the cache. |
| 115 | auto erased = cache_.erase(entry->key); |
| 116 | if (erased == 0) { |
| 117 | LOG(FATAL) << "Tried to discard nonexistent cache entry"; |
| 118 | } |
| 119 | erased = entries_by_uid_.erase(entry->uid); |
| 120 | CHECK_EQ(erased, 1); |
| 121 | } |
| 122 | entry->Unref(); |
| 123 | } |
| 124 | |
| 125 | void XRTCompilationCache::MarkOldestEntryForEviction() { |
| 126 | CompiledSubgraph* entry_to_mark = entries_by_last_use_.begin()->second; |
nothing calls this directly
no test coverage detected