the REPLACE function in the paper */
| 517 | |
| 518 | /* the REPLACE function in the paper */ |
| 519 | static void _ARC_replace(cache_t *cache, const request_t *req) { |
| 520 | ARC_params_t *params = (ARC_params_t *)(cache->eviction_params); |
| 521 | |
| 522 | |
| 523 | bool cond1 = params->L1_data_size > 0; |
| 524 | bool cond2 = params->L1_data_size > params->p; |
| 525 | bool cond3 = |
| 526 | params->L1_data_size == params->p && params->curr_obj_in_L2_ghost; |
| 527 | bool cond4 = params->L2_data_size == 0; |
| 528 | |
| 529 | if ((cond1 && (cond2 || cond3)) || cond4) { |
| 530 | // delete the LRU in L1 data, move to L1_ghost |
| 531 | _ARC_evict_L1_data(cache, req); |
| 532 | } else { |
| 533 | // delete the item in L2 data, move to L2_ghost |
| 534 | _ARC_evict_L2_data(cache, req); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | /* finding the eviction candidate in _ARC_evict_miss_on_all_queues, but do not |
| 539 | * perform eviction */ |
no test coverage detected