changeset 4cbe53150053 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=4cbe53150053
description:
        o3: Use shared_ptr for MemDepEntry

        This patch transitions the o3 MemDepEntry from the ad-hoc
        RefCountingPtr to the c++11 shared_ptr. There are no changes in
        behaviour, and the code modifications are mainly replacing "new" with
        "make_shared".

diffstat:

 src/cpu/o3/mem_dep_unit.hh      |  6 +++---
 src/cpu/o3/mem_dep_unit_impl.hh |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 399f35ed5cca -r 4cbe53150053 src/cpu/o3/mem_dep_unit.hh
--- a/src/cpu/o3/mem_dep_unit.hh        Thu Oct 16 05:49:49 2014 -0400
+++ b/src/cpu/o3/mem_dep_unit.hh        Thu Oct 16 05:49:49 2014 -0400
@@ -44,10 +44,10 @@
 #define __CPU_O3_MEM_DEP_UNIT_HH__
 
 #include <list>
+#include <memory>
 #include <set>
 
 #include "base/hashmap.hh"
-#include "base/refcnt.hh"
 #include "base/statistics.hh"
 #include "cpu/inst_seq.hh"
 #include "debug/MemDepUnit.hh"
@@ -164,13 +164,13 @@
 
     class MemDepEntry;
 
-    typedef RefCountingPtr<MemDepEntry> MemDepEntryPtr;
+    typedef std::shared_ptr<MemDepEntry> MemDepEntryPtr;
 
     /** Memory dependence entries that track memory operations, marking
      *  when the instruction is ready to execute and what instructions depend
      *  upon it.
      */
-    class MemDepEntry : public RefCounted {
+    class MemDepEntry {
       public:
         /** Constructs a memory dependence entry. */
         MemDepEntry(DynInstPtr &new_inst)
diff -r 399f35ed5cca -r 4cbe53150053 src/cpu/o3/mem_dep_unit_impl.hh
--- a/src/cpu/o3/mem_dep_unit_impl.hh   Thu Oct 16 05:49:49 2014 -0400
+++ b/src/cpu/o3/mem_dep_unit_impl.hh   Thu Oct 16 05:49:49 2014 -0400
@@ -162,7 +162,7 @@
 {
     ThreadID tid = inst->threadNumber;
 
-    MemDepEntryPtr inst_entry = new MemDepEntry(inst);
+    MemDepEntryPtr inst_entry = std::make_shared<MemDepEntry>(inst);
 
     // Add the MemDepEntry to the hash.
     memDepHash.insert(
@@ -259,7 +259,7 @@
 {
     ThreadID tid = inst->threadNumber;
 
-    MemDepEntryPtr inst_entry = new MemDepEntry(inst);
+    MemDepEntryPtr inst_entry = std::make_shared<MemDepEntry>(inst);
 
     // Insert the MemDepEntry into the hash.
     memDepHash.insert(
@@ -310,7 +310,7 @@
 
     ThreadID tid = barr_inst->threadNumber;
 
-    MemDepEntryPtr inst_entry = new MemDepEntry(barr_inst);
+    MemDepEntryPtr inst_entry = std::make_shared<MemDepEntry>(barr_inst);
 
     // Add the MemDepEntry to the hash.
     memDepHash.insert(
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to