diff options
author | Robert Kovacsics <rmk35@cl.cam.ac.uk> | 2018-07-13 14:38:00 +0100 |
---|---|---|
committer | Kovacsics RĂ³bert <kovirobi@gmail.com> | 2018-07-25 13:57:24 +0000 |
commit | 2fe3d660260e7b546b5860ac4459014ed9bee907 (patch) | |
tree | 9ddb798f793db1743b6d31dbeed860bfb3c1a173 /src/mem/cache/blk.hh | |
parent | cd3e7230bee7f557a54bbd908879ce090bc46978 (diff) | |
download | gem5-2fe3d660260e7b546b5860ac4459014ed9bee907.tar.xz |
mem-cache: TempCacheBlk allocates and destroys its own data
This change is because I want to make CacheBlk::data private, so that
I can track all the places which write to it. But to keep that commit
smaller (it is pretty big, because of all the places which might
change it), I have split this into a commit of its own.
Change-Id: I15a2fc1752085ff3681f5c74ec90be3828a559ea
Reviewed-on: https://gem5-review.googlesource.com/11829
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/cache/blk.hh')
-rw-r--r-- | src/mem/cache/blk.hh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mem/cache/blk.hh b/src/mem/cache/blk.hh index 97e1d42d9..3bb0317cc 100644 --- a/src/mem/cache/blk.hh +++ b/src/mem/cache/blk.hh @@ -406,10 +406,17 @@ class TempCacheBlk final : public CacheBlk Addr _addr; public: - TempCacheBlk() : CacheBlk() {} + /** + * Creates a temporary cache block, with its own storage. + * @param size The size (in bytes) of this cache block. + */ + TempCacheBlk(unsigned size) : CacheBlk() + { + data = new uint8_t[size]; + } TempCacheBlk(const TempCacheBlk&) = delete; TempCacheBlk& operator=(const TempCacheBlk&) = delete; - ~TempCacheBlk() {}; + ~TempCacheBlk() { delete [] data; }; /** * Invalidate the block and clear all state. |