mem-cache: Make boundaries in FALRU an STL container
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Wed, 3 Oct 2018 12:49:57 +0000 (14:49 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Fri, 5 Oct 2018 18:42:49 +0000 (18:42 +0000)
Turn the dynamically allocated array of pointers "boundaries"
into a STL vector.

Change-Id: I3409898473b155f69b4c6e038eba2dffb5b09380
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/13208
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/mem/cache/tags/fa_lru.hh

index 55362a4241eb1081d3f016ba496a6365dddd5699..03af572b876a8007f3b89a897eae5ecbaa0a3181 100644 (file)
@@ -53,6 +53,7 @@
 #include <functional>
 #include <string>
 #include <unordered_map>
+#include <vector>
 
 #include "base/bitfield.hh"
 #include "base/intmath.hh"
@@ -272,7 +273,7 @@ class FALRU : public BaseTags
               numTrackedCaches(max_size > min_size ?
                                floorLog2(max_size) - floorLog2(min_size) : 0),
               inAllCachesMask(mask(numTrackedCaches)),
-              boundaries(new FALRUBlk *[numTrackedCaches])
+              boundaries(numTrackedCaches)
         {
             fatal_if(numTrackedCaches > sizeof(CachesMask) * 8,
                      "Not enough bits (%s) in type CachesMask type to keep "
@@ -280,11 +281,6 @@ class FALRU : public BaseTags
                      numTrackedCaches);
         }
 
-        ~CacheTracking()
-        {
-            delete[] boundaries;
-        }
-
         /**
          * Initialiaze cache blocks and the tracking mechanism
          *
@@ -356,7 +352,7 @@ class FALRU : public BaseTags
         /** A mask for all cache being tracked. */
         const CachesMask inAllCachesMask;
         /** Array of pointers to blocks at the cache boundaries. */
-        FALRUBlk** boundaries;
+        std::vector<FALRUBlk*> boundaries;
 
       protected:
         /**