mem-cache: Move evictBlock(CacheBlk*, PacketList&) to base
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Fri, 19 Oct 2018 15:58:42 +0000 (17:58 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Mon, 22 Oct 2018 10:19:10 +0000 (10:19 +0000)
Move evictBlock(CacheBlk*, PacketList&) to base cache,
as it is both sub-classes implementations are equal.

Change-Id: I80fbd16813bfcc4938fb01ed76abe29b3f8b3018
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/13656
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

src/mem/cache/base.cc
src/mem/cache/base.hh
src/mem/cache/cache.cc
src/mem/cache/cache.hh
src/mem/cache/noncoherent_cache.cc
src/mem/cache/noncoherent_cache.hh

index 183d93f14a8556de9960d37f486d71d5c4794ed7..ed23ffde29c56af64652ea091463cf3c2d89f13a 100644 (file)
@@ -1310,6 +1310,15 @@ BaseCache::invalidateBlock(CacheBlk *blk)
     blk->invalidate();
 }
 
+void
+BaseCache::evictBlock(CacheBlk *blk, PacketList &writebacks)
+{
+    PacketPtr pkt = evictBlock(blk);
+    if (pkt) {
+        writebacks.push_back(pkt);
+    }
+}
+
 PacketPtr
 BaseCache::writebackBlk(CacheBlk *blk)
 {
index b9fd7f9434dc4801696acc1e152ad59e5fc5f248..52b0fdbcd082b8aa3db9fe5f12d00215b92cb04e 100644 (file)
@@ -705,7 +705,7 @@ class BaseCache : public MemObject
      * @param blk Block to invalidate
      * @param writebacks Return a list of packets with writebacks
      */
-    virtual void evictBlock(CacheBlk *blk, PacketList &writebacks) = 0;
+    void evictBlock(CacheBlk *blk, PacketList &writebacks);
 
     /**
      * Invalidate a cache block.
index fb0eb9d052202885988ac5f85a954f6205431417..3bb2667af7d9e84bb110734287e83a70819c6d4d 100644 (file)
@@ -177,7 +177,7 @@ Cache::access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat,
         // flush and invalidate any existing block
         CacheBlk *old_blk(tags->findBlock(pkt->getAddr(), pkt->isSecure()));
         if (old_blk && old_blk->isValid()) {
-            evictBlock(old_blk, writebacks);
+            BaseCache::evictBlock(old_blk, writebacks);
         }
 
         blk = nullptr;
@@ -848,15 +848,6 @@ Cache::evictBlock(CacheBlk *blk)
     return pkt;
 }
 
-void
-Cache::evictBlock(CacheBlk *blk, PacketList &writebacks)
-{
-    PacketPtr pkt = evictBlock(blk);
-    if (pkt) {
-        writebacks.push_back(pkt);
-    }
-}
-
 PacketPtr
 Cache::cleanEvictBlk(CacheBlk *blk)
 {
index 588e7b94ea1af812a3baf983c5948bad7d3d3794..a7eb97d3bb7097b4089c10034971982d4c323ff3 100644 (file)
@@ -141,8 +141,6 @@ class Cache : public BaseCache
 
     M5_NODISCARD PacketPtr evictBlock(CacheBlk *blk) override;
 
-    void evictBlock(CacheBlk *blk, PacketList &writebacks) override;
-
     /**
      * Create a CleanEvict request for the given block.
      *
index 726c32f1c8024f758d0030f2d059585b1cbcab81..5edd435c6eded8c2c20784f67404705aef3c77c6 100644 (file)
@@ -357,15 +357,6 @@ NoncoherentCache::evictBlock(CacheBlk *blk)
     return pkt;
 }
 
-void
-NoncoherentCache::evictBlock(CacheBlk *blk, PacketList &writebacks)
-{
-    PacketPtr pkt = evictBlock(blk);
-    if (pkt) {
-        writebacks.push_back(pkt);
-    }
-}
-
 NoncoherentCache*
 NoncoherentCacheParams::create()
 {
index fea3cd980100c74bcd2efe1a292487d2f1b678e9..824c7ccc9f18a2421ee75e49784631d1b3f4fa05 100644 (file)
@@ -125,8 +125,6 @@ class NoncoherentCache : public BaseCache
 
     M5_NODISCARD PacketPtr evictBlock(CacheBlk *blk) override;
 
-    void evictBlock(CacheBlk *blk, PacketList &writebacks) override;
-
   public:
     NoncoherentCache(const NoncoherentCacheParams *p);
 };