diff options
author | Daniel <odanrc@yahoo.com.br> | 2018-11-13 20:47:51 +0100 |
---|---|---|
committer | Daniel Carvalho <odanrc@yahoo.com.br> | 2018-11-15 16:52:55 +0000 |
commit | 3a3e172b02c108196302a027307eab41626f4d69 (patch) | |
tree | 1556c3facd8b72e10eb3bb60cd882841913eb244 /src/mem/cache/prefetch/stride.cc | |
parent | 359a2ef70996fb4ed64d09421344eef2e4c85ab1 (diff) | |
download | gem5-3a3e172b02c108196302a027307eab41626f4d69.tar.xz |
mem-cache: Vectorize StridePrefetcher's entries.
Turn StridePrefetcher::PCTable::entries into a vector of vectors.
Change-Id: I2a4589a76eb205910c43723638b7989eddd5ca24
Reviewed-on: https://gem5-review.googlesource.com/c/14357
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/cache/prefetch/stride.cc')
-rw-r--r-- | src/mem/cache/prefetch/stride.cc | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/mem/cache/prefetch/stride.cc b/src/mem/cache/prefetch/stride.cc index a00b10a05..fde4f3011 100644 --- a/src/mem/cache/prefetch/stride.cc +++ b/src/mem/cache/prefetch/stride.cc @@ -72,32 +72,26 @@ StridePrefetcher::StridePrefetcher(const StridePrefetcherParams *p) assert(isPowerOf2(pcTableSets)); } -StridePrefetcher::StrideEntry** +std::vector<std::vector<StridePrefetcher::StrideEntry>>& StridePrefetcher::PCTable::allocateNewContext(int context) { auto res = entries.insert(std::make_pair(context, - new StrideEntry*[pcTableSets])); + std::vector<std::vector<StrideEntry>>(pcTableSets))); auto it = res.first; chatty_assert(res.second, "Allocating an already created context\n"); assert(it->first == context); - DPRINTF(HWPrefetch, "Adding context %i with stride entries at %p\n", - context, it->second); + DPRINTF(HWPrefetch, "Adding context %i with stride entries\n", context); - StrideEntry** entry = it->second; - for (int s = 0; s < pcTableSets; s++) { - entry[s] = new StrideEntry[pcTableAssoc]; + std::vector<std::vector<StrideEntry>>& table = it->second; + for (auto& set : table) { + set.resize(pcTableAssoc); } - return entry; + return table; } -StridePrefetcher::PCTable::~PCTable() { - for (auto entry : entries) { - for (int s = 0; s < pcTableSets; s++) { - delete[] entry.second[s]; - } - delete[] entry.second; - } +StridePrefetcher::PCTable::~PCTable() +{ } void @@ -202,7 +196,7 @@ inline StridePrefetcher::StrideEntry* StridePrefetcher::findEntry(Addr pc, bool is_secure, int master_id) { int set = pcHash(pc); - StrideEntry* set_entries = pcTable[master_id][set]; + std::vector<StrideEntry>& set_entries = pcTable[master_id][set]; for (int way = 0; way < pcTableAssoc; way++) { StrideEntry* entry = &set_entries[way]; // Search ways for match |