diff options
author | Daniel R. Carvalho <odanrc@yahoo.com.br> | 2018-02-26 15:22:33 +0100 |
---|---|---|
committer | Daniel Carvalho <odanrc@yahoo.com.br> | 2018-03-01 08:14:33 +0000 |
commit | 3c076e4d69b38be9e4ce7ca9cfb7145ae6f27393 (patch) | |
tree | 5e0ceaa3782b22db7fa01e521955be3b01f915ad /src/mem/cache/tags/base_set_assoc.hh | |
parent | f4d83eaf52926aa379292a9f75ba6b36eb04c52d (diff) | |
download | gem5-3c076e4d69b38be9e4ce7ca9cfb7145ae6f27393.tar.xz |
mem-cache: Vectorize C arrays in BaseSetAssoc.
Transform BaseSetAssoc's arrays into C++ vectors to avoid unnecessary
resource management.
Change-Id: I656f42f29e5f9589eba491b410ca1df5a64f2f34
Reviewed-on: https://gem5-review.googlesource.com/8621
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/mem/cache/tags/base_set_assoc.hh')
-rw-r--r-- | src/mem/cache/tags/base_set_assoc.hh | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh index ef4c68b62..cbd48092c 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -50,7 +50,8 @@ #include <cassert> #include <cstring> -#include <list> +#include <memory> +#include <vector> #include "mem/cache/base.hh" #include "mem/cache/blk.hh" @@ -87,18 +88,20 @@ class BaseSetAssoc : public BaseTags const unsigned assoc; /** The allocatable associativity of the cache (alloc mask). */ unsigned allocAssoc; + + /** The cache blocks. */ + std::vector<BlkType> blks; + /** The data blocks, 1 per cache block. */ + std::unique_ptr<uint8_t[]> dataBlks; + /** The number of sets in the cache. */ const unsigned numSets; + /** Whether tags and data are accessed sequentially. */ const bool sequentialAccess; /** The cache sets. */ - SetType *sets; - - /** The cache blocks. */ - BlkType *blks; - /** The data blocks, 1 per cache block. */ - uint8_t *dataBlks; + std::vector<SetType> sets; /** The amount to shift the address to get the set. */ int setShift; @@ -120,7 +123,7 @@ public: /** * Destructor */ - virtual ~BaseSetAssoc(); + virtual ~BaseSetAssoc() {}; /** * Find the cache block given set and way |