mem-cache: Encapsulate CacheBlk's srcRequestorId

Encapsulate this variable to facilitate polymorphism.

- requestorId was renamed to _requestorId and was privatized.
- The requestor ID should only be modified on insertion and
  invalidation; thus, its setter is not public.

Change-Id: I5bab21a6c21e9d912fb5194bb44ff785d44999f4
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34959
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/mem/cache/cache_blk.cc b/src/mem/cache/cache_blk.cc
index 26ad4af..01b71c5 100644
--- a/src/mem/cache/cache_blk.cc
+++ b/src/mem/cache/cache_blk.cc
@@ -60,7 +60,7 @@
     setTag(tag);
 
     // Set source requestor ID
-    srcRequestorId = src_requestor_ID;
+    setSrcRequestorId(src_requestor_ID);
 
     // Set task ID
     setTaskId(task_ID);
diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh
index 448b895..0ad355c 100644
--- a/src/mem/cache/cache_blk.hh
+++ b/src/mem/cache/cache_blk.hh
@@ -107,9 +107,6 @@
      */
     Tick whenReady;
 
-    /** holds the source requestor ID for this block. */
-    int srcRequestorId;
-
   protected:
     /**
      * Represents that the indicated thread context has a "lock" on
@@ -203,7 +200,7 @@
         status = 0;
         whenReady = MaxTick;
         setRefCount(0);
-        srcRequestorId = Request::invldRequestorId;
+        setSrcRequestorId(Request::invldRequestorId);
         lockList.clear();
     }
 
@@ -293,6 +290,9 @@
     /** Get the task id associated to this block. */
     uint32_t getTaskId() const { return _taskId; }
 
+    /** Get the requestor id associated to this block. */
+    uint32_t getSrcRequestorId() const { return _srcRequestorId; }
+
     /** Get the number of references to this block since insertion. */
     unsigned getRefCount() const { return _refCount; }
 
@@ -466,6 +466,9 @@
     /** Set the task id value. */
     void setTaskId(const uint32_t task_id) { _taskId = task_id; }
 
+    /** Set the source requestor id. */
+    void setSrcRequestorId(const uint32_t id) { _srcRequestorId = id; }
+
     /** Set the number of references to this block since insertion. */
     void setRefCount(const unsigned count) { _refCount = count; }
 
@@ -479,6 +482,9 @@
     /** Task Id associated with this block */
     uint32_t _taskId;
 
+    /** holds the source requestor ID for this block. */
+    int _srcRequestorId;
+
     /** Number of references to this block since it was brought in. */
     unsigned _refCount;
 
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh
index 700edcb..35e984a 100644
--- a/src/mem/cache/tags/base.hh
+++ b/src/mem/cache/tags/base.hh
@@ -253,7 +253,7 @@
         assert(blk);
         assert(blk->isValid());
 
-        stats.occupancies[blk->srcRequestorId]--;
+        stats.occupancies[blk->getSrcRequestorId()]--;
         stats.totalRefs += blk->getRefCount();
         stats.sampledRefs++;