33c33
< #include "debug/CacheRepl.hh"
---
> #include <memory>
40,41c40,42
< CacheBlk*
< LFURP::getVictim(const ReplacementCandidates& candidates)
---
> void
> LFURP::invalidate(const std::shared_ptr<ReplacementData>& replacement_data)
> const
42a44,64
> // Reset reference count
> std::static_pointer_cast<LFUReplData>(replacement_data)->refCount = 0;
> }
>
> void
> LFURP::touch(const std::shared_ptr<ReplacementData>& replacement_data) const
> {
> // Update reference count
> std::static_pointer_cast<LFUReplData>(replacement_data)->refCount++;
> }
>
> void
> LFURP::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
> {
> // Reset reference count
> std::static_pointer_cast<LFUReplData>(replacement_data)->refCount = 1;
> }
>
> ReplaceableEntry*
> LFURP::getVictim(const ReplacementCandidates& candidates) const
> {
47c69
< CacheBlk* blk = candidates[0];
---
> ReplaceableEntry* victim = candidates[0];
49,55c71,76
< // Stop iteration if found an invalid block
< if (!candidate->isValid()) {
< blk = candidate;
< break;
< // Update victim block if necessary
< } else if (candidate->refCount < blk->refCount) {
< blk = candidate;
---
> // Update victim entry if necessary
> if (std::static_pointer_cast<LFUReplData>(
> candidate->replacementData)->refCount <
> std::static_pointer_cast<LFUReplData>(
> victim->replacementData)->refCount) {
> victim = candidate;
59,60c80,81
< DPRINTF(CacheRepl, "set %x, way %x: selecting blk for replacement\n",
< blk->set, blk->way);
---
> return victim;
> }
62c83,86
< return blk;
---
> std::shared_ptr<ReplacementData>
> LFURP::instantiateEntry()
> {
> return std::shared_ptr<ReplacementData>(new LFUReplData());