summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags/iic_repl/gen.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:12:23 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:12:23 -0400
commit93a159875aa081cf3452754b890d83ae7c2bf943 (patch)
treeb9b1859ddcef2053f6a07c6ba7b446395686c023 /src/mem/cache/tags/iic_repl/gen.cc
parentd52adc4eb68c2733f9af4ac68834583c0a555f9d (diff)
downloadgem5-93a159875aa081cf3452754b890d83ae7c2bf943.tar.xz
Fix: Address a few minor issues identified by cppcheck
This patch addresses a number of smaller issues identified by the code inspection utility cppcheck. There are a number of identified leaks in the arm/linux/system.cc (although the function only get's called once so it is not a major problem), a few deletes in dev/x86/i8042.cc that were not array deletes, and sprintfs where the character array had one element less than needed. In the IIC tags there was a function allocating an array of longs which is in fact never used.
Diffstat (limited to 'src/mem/cache/tags/iic_repl/gen.cc')
-rw-r--r--src/mem/cache/tags/iic_repl/gen.cc39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/mem/cache/tags/iic_repl/gen.cc b/src/mem/cache/tags/iic_repl/gen.cc
index 137130b27..3212b74ab 100644
--- a/src/mem/cache/tags/iic_repl/gen.cc
+++ b/src/mem/cache/tags/iic_repl/gen.cc
@@ -93,45 +93,6 @@ GenRepl::getRepl()
return 0xffffffff;
}
-unsigned long *
-GenRepl::getNRepl(int n)
-{
- unsigned long *tmp;
- GenReplEntry *re;
- int i;
- if (!(num_pool_entries>(n-1))) {
- fatal("Not enough blks available to replace");
- }
- num_entries -= n;
- num_pool_entries -= n;
- tmp = new unsigned long[n]; /* array of cache_blk pointers */
- int blk_index = 0;
- for (i = 0; i < num_pools && blk_index < n; i++) {
- while (blk_index < n && (re = pools[i].pop())) {
- // Remove invalidated entries
- if (!re->valid) {
- delete re;
- continue;
- }
- if (iic->clearRef(re->tag_ptr)) {
- pools[(((i+1)== num_pools)? i :i+1)].push(re, misses);
- }
- else {
- tmp[blk_index] = re->tag_ptr;
- blk_index++;
- delete re;
- repl_pool.sample(i);
- }
- }
- }
- if (blk_index >= n)
- return tmp;
- /* search the fresh pool */
-
- fatal("No N replacements found");
- return NULL;
-}
-
void
GenRepl::doAdvance(std::list<unsigned long> &demoted)
{