Daniel Carvalho has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/13656 )

Change subject: mem-cache: Move evictBlock(CacheBlk*, PacketList&) to base
......................................................................

mem-cache: Move evictBlock(CacheBlk*, PacketList&) to base

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 <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/13656
Reviewed-by: Nikos Nikoleris <[email protected]>
Maintainer: Nikos Nikoleris <[email protected]>
---
M src/mem/cache/base.cc
M src/mem/cache/base.hh
M src/mem/cache/cache.cc
M src/mem/cache/cache.hh
M src/mem/cache/noncoherent_cache.cc
M src/mem/cache/noncoherent_cache.hh
6 files changed, 11 insertions(+), 24 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved



diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index 183d93f..ed23ffd 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -1310,6 +1310,15 @@
     blk->invalidate();
 }

+void
+BaseCache::evictBlock(CacheBlk *blk, PacketList &writebacks)
+{
+    PacketPtr pkt = evictBlock(blk);
+    if (pkt) {
+        writebacks.push_back(pkt);
+    }
+}
+
 PacketPtr
 BaseCache::writebackBlk(CacheBlk *blk)
 {
diff --git a/src/mem/cache/base.hh b/src/mem/cache/base.hh
index b9fd7f9..52b0fdb 100644
--- a/src/mem/cache/base.hh
+++ b/src/mem/cache/base.hh
@@ -705,7 +705,7 @@
      * @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.
diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc
index fb0eb9d..3bb2667 100644
--- a/src/mem/cache/cache.cc
+++ b/src/mem/cache/cache.cc
@@ -177,7 +177,7 @@
         // 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 @@
     return pkt;
 }

-void
-Cache::evictBlock(CacheBlk *blk, PacketList &writebacks)
-{
-    PacketPtr pkt = evictBlock(blk);
-    if (pkt) {
-        writebacks.push_back(pkt);
-    }
-}
-
 PacketPtr
 Cache::cleanEvictBlk(CacheBlk *blk)
 {
diff --git a/src/mem/cache/cache.hh b/src/mem/cache/cache.hh
index 588e7b9..a7eb97d 100644
--- a/src/mem/cache/cache.hh
+++ b/src/mem/cache/cache.hh
@@ -141,8 +141,6 @@

     M5_NODISCARD PacketPtr evictBlock(CacheBlk *blk) override;

-    void evictBlock(CacheBlk *blk, PacketList &writebacks) override;
-
     /**
      * Create a CleanEvict request for the given block.
      *
diff --git a/src/mem/cache/noncoherent_cache.cc b/src/mem/cache/noncoherent_cache.cc
index 726c32f..5edd435 100644
--- a/src/mem/cache/noncoherent_cache.cc
+++ b/src/mem/cache/noncoherent_cache.cc
@@ -357,15 +357,6 @@
     return pkt;
 }

-void
-NoncoherentCache::evictBlock(CacheBlk *blk, PacketList &writebacks)
-{
-    PacketPtr pkt = evictBlock(blk);
-    if (pkt) {
-        writebacks.push_back(pkt);
-    }
-}
-
 NoncoherentCache*
 NoncoherentCacheParams::create()
 {
diff --git a/src/mem/cache/noncoherent_cache.hh b/src/mem/cache/noncoherent_cache.hh
index fea3cd9..824c7cc 100644
--- a/src/mem/cache/noncoherent_cache.hh
+++ b/src/mem/cache/noncoherent_cache.hh
@@ -125,8 +125,6 @@

     M5_NODISCARD PacketPtr evictBlock(CacheBlk *blk) override;

-    void evictBlock(CacheBlk *blk, PacketList &writebacks) override;
-
   public:
     NoncoherentCache(const NoncoherentCacheParams *p);
 };

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/13656
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I80fbd16813bfcc4938fb01ed76abe29b3f8b3018
Gerrit-Change-Number: 13656
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to