* @brief remove the given object from the cache * note that eviction should not call this function, but rather call * `cache_evict_base` because we track extra metadata during eviction * * and this function is different from eviction * because this is used for user trigger * remove, and eviction is used by the cache to make space for new objects * * it needs to call cache_remove_obj_base b
| 257 | * @param obj |
| 258 | */ |
| 259 | static void ClockPro_remove_obj(cache_t *cache, cache_obj_t *obj) { |
| 260 | ClockPro_params_t *params = (ClockPro_params_t *)cache->eviction_params; |
| 261 | |
| 262 | DEBUG_ASSERT(obj != NULL); |
| 263 | cache_obj_t *hand_hot_prev = params->hand_hot->queue.prev; |
| 264 | |
| 265 | if (obj->clockpro.status == CLOCKPRO_TEST) { |
| 266 | params->mem_test -= obj->obj_size; |
| 267 | } else if (obj->clockpro.status == CLOCKPRO_COLD) { |
| 268 | params->mem_cold -= obj->obj_size; |
| 269 | } else if (obj->clockpro.status == CLOCKPRO_HOT) { |
| 270 | params->mem_hot -= obj->obj_size; |
| 271 | } |
| 272 | |
| 273 | if (params->hand_test == obj) { |
| 274 | params->hand_test = obj->queue.next; |
| 275 | } |
| 276 | if (params->hand_cold == obj) { |
| 277 | params->hand_cold = obj->queue.next; |
| 278 | } |
| 279 | if (params->hand_hot == obj) { |
| 280 | params->hand_hot = obj->queue.next; |
| 281 | } |
| 282 | |
| 283 | remove_obj_from_list(¶ms->hand_hot, &hand_hot_prev, obj); |
| 284 | cache_remove_obj_base(cache, obj, true); |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * @brief remove an object from the cache |
no test coverage detected