diff --git a/src/cpu/o3/lsq.hh b/src/cpu/o3/lsq.hh index 6857a6aca..36ad75aed 100644 --- a/src/cpu/o3/lsq.hh +++ b/src/cpu/o3/lsq.hh @@ -70,6 +70,9 @@ class LSQ { /** Constructs an LSQ with the given parameters. */ LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params); + ~LSQ() { + if (thread) delete [] thread; + } /** Returns the name of the LSQ. */ std::string name() const; @@ -316,7 +319,7 @@ class LSQ { LSQPolicy lsqPolicy; /** The LSQ units for individual threads. */ - LSQUnit thread[Impl::MaxThreads]; + LSQUnit *thread; /** List of Active Threads in System. */ std::list *activeThreads; diff --git a/src/cpu/o3/lsq_impl.hh b/src/cpu/o3/lsq_impl.hh index c796d7078..70db92714 100644 --- a/src/cpu/o3/lsq_impl.hh +++ b/src/cpu/o3/lsq_impl.hh @@ -61,6 +61,8 @@ LSQ::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params) numThreads(params->numThreads), retryTid(-1) { + assert(numThreads > 0 && numThreads <= Impl::MaxThreads); + //**********************************************/ //************ Handle SMT Parameters ***********/ //**********************************************/ @@ -109,6 +111,7 @@ LSQ::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params) } //Initialize LSQs + thread = new LSQUnit[numThreads]; for (ThreadID tid = 0; tid < numThreads; tid++) { thread[tid].init(cpu, iew_ptr, params, this, maxLQEntries, maxSQEntries, tid);