summaryrefslogtreecommitdiff
path: root/src/mem/cache/mshr_queue.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-05-30 12:54:11 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2013-05-30 12:54:11 -0400
commit7da851d1a834fbe6dd02f87884586129786b14a6 (patch)
treeba426b7526b9480c38ebead26fc320f7fcbec347 /src/mem/cache/mshr_queue.cc
parent42191522cc16f0f1c98455e52681a928cba4052a (diff)
downloadgem5-7da851d1a834fbe6dd02f87884586129786b14a6.tar.xz
mem: Spring cleaning of MSHR and MSHRQueue
This patch does some minor tidying up of the MSHR and MSHRQueue. The clean up started as part of some ad-hoc tracing and debugging, but seems worthwhile enough to go in as a separate patch. The highlights of the changes are reduced scoping (private) members where possible, avoiding redundant new/delete, and constructor initialisation to please static code analyzers.
Diffstat (limited to 'src/mem/cache/mshr_queue.cc')
-rw-r--r--src/mem/cache/mshr_queue.cc18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/mem/cache/mshr_queue.cc b/src/mem/cache/mshr_queue.cc
index af13d12d3..d8cc5f40a 100644
--- a/src/mem/cache/mshr_queue.cc
+++ b/src/mem/cache/mshr_queue.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012-2013 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
@@ -51,24 +51,16 @@ using namespace std;
MSHRQueue::MSHRQueue(const std::string &_label,
int num_entries, int reserve, int _index)
- : label(_label),
- numEntries(num_entries + reserve - 1), numReserve(reserve),
- drainManager(NULL), index(_index)
+ : label(_label), numEntries(num_entries + reserve - 1),
+ numReserve(reserve), registers(numEntries),
+ drainManager(NULL), allocated(0), inServiceEntries(0), index(_index)
{
- allocated = 0;
- inServiceEntries = 0;
- registers = new MSHR[numEntries];
for (int i = 0; i < numEntries; ++i) {
registers[i].queue = this;
freeList.push_back(&registers[i]);
}
}
-MSHRQueue::~MSHRQueue()
-{
- delete [] registers;
-}
-
MSHR *
MSHRQueue::findMatch(Addr addr) const
{
@@ -253,7 +245,7 @@ MSHRQueue::squash(int threadNum)
assert(0/*target->req->threadId()*/ == threadNum);
}
assert(!mshr->hasTargets());
- assert(mshr->ntargets==0);
+ assert(mshr->getNumTargets()==0);
if (!mshr->inService) {
i = deallocateOne(mshr);
} else {