Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/34959 )
Change subject: mem-cache: Encapsulate CacheBlk's srcRequestorId
......................................................................
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 <[email protected]>
---
M src/mem/cache/cache_blk.cc
M src/mem/cache/cache_blk.hh
M src/mem/cache/tags/base.hh
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/mem/cache/cache_blk.cc b/src/mem/cache/cache_blk.cc
index c99c05c..96c54a2 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 38f66cd..0099f7a 100644
--- a/src/mem/cache/cache_blk.hh
+++ b/src/mem/cache/cache_blk.hh
@@ -92,6 +92,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;
@@ -105,6 +108,9 @@
/** Set the task id value. */
inline void setTaskId(const uint32_t task_id) { _taskId = task_id; }
+ /** Set the source requestor id. */
+ inline void setSrcRequestorId(const uint32_t id) { _srcRequestorId =
id; }
+
/** Set the number of references to this block since insertion. */
inline void setRefCount(const unsigned count) { _refCount = count; }
@@ -133,9 +139,6 @@
*/
Tick whenReady;
- /** holds the source requestor ID for this block. */
- int srcRequestorId;
-
protected:
/**
* Represents that the indicated thread context has a "lock" on
@@ -229,7 +232,7 @@
status = 0;
whenReady = MaxTick;
setRefCount(0);
- srcRequestorId = Request::invldRequestorId;
+ setSrcRequestorId(Request::invldRequestorId);
lockList.clear();
}
@@ -319,6 +322,9 @@
/** Get the task id associated to this block. */
inline uint32_t getTaskId() const { return _taskId; }
+ /** Get the requestor id associated to this block. */
+ inline uint32_t getSrcRequestorId() const { return _srcRequestorId; }
+
/** Get the number of references to this block since insertion. */
inline unsigned getRefCount() const { return _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++;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/34959
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5bab21a6c21e9d912fb5194bb44ff785d44999f4
Gerrit-Change-Number: 34959
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s