From 7da851d1a834fbe6dd02f87884586129786b14a6 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 30 May 2013 12:54:11 -0400 Subject: 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. --- src/mem/cache/mshr_queue.cc | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/mem/cache/mshr_queue.cc') 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(®isters[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 { -- cgit v1.2.3