summaryrefslogtreecommitdiff
path: root/src/sim/system.hh
diff options
context:
space:
mode:
authorGiacomo Travaglini <giacomo.travaglini@arm.com>2018-02-05 17:08:43 +0000
committerGiacomo Travaglini <giacomo.travaglini@arm.com>2018-02-09 15:09:00 +0000
commit6af3a7df1f42fe2ff1cb32ed5d373ce39691281f (patch)
tree223a4801cb13a24b9e393baf202d2ccb27b72834 /src/sim/system.hh
parent3feeb994ae613fd6b3734c1a991285b2ecbd1946 (diff)
downloadgem5-6af3a7df1f42fe2ff1cb32ed5d373ce39691281f.tar.xz
sim: Remove _numContexts member in System class
A System object has a _numContexts member variable which represent the number of ThreadContext registered in the System. Since this has to match the size of the ThreadContext vector, this patch removes the manually cached size. This was usually used as a for-loop index, whereas we want to enforce the use of range-based loops whenever possible. Change-Id: I1ba317c0393bcc9c1aeebbb1fc22d7b2bc2cf90c Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/8062 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com>
Diffstat (limited to 'src/sim/system.hh')
-rw-r--r--src/sim/system.hh7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/sim/system.hh b/src/sim/system.hh
index 5b0c17872..a72f2a762 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -196,7 +196,6 @@ class System : public MemObject
#endif
std::vector<ThreadContext *> threadContexts;
- int _numContexts;
const bool multiThread;
ThreadContext *getThreadContext(ContextID tid)
@@ -204,11 +203,7 @@ class System : public MemObject
return threadContexts[tid];
}
- int numContexts()
- {
- assert(_numContexts == (int)threadContexts.size());
- return _numContexts;
- }
+ unsigned numContexts() const { return threadContexts.size(); }
/** Return number of running (non-halted) thread contexts in
* system. These threads could be Active or Suspended. */