From 8b789ae451aa0b756b4e192629c78c3bcea34cdd Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 16 Oct 2014 05:49:47 -0400 Subject: [PATCH] base: Transition CP annotate to use shared_ptr --- src/base/cp_annotate.cc | 4 ++-- src/base/cp_annotate.hh | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/base/cp_annotate.cc b/src/base/cp_annotate.cc index 858ee0cb8..4904949b4 100644 --- a/src/base/cp_annotate.cc +++ b/src/base/cp_annotate.cc @@ -822,7 +822,7 @@ CPA::swSyscallLink(ThreadContext *tc) CPA::AnnDataPtr CPA::add(int t, int f, int c, int sm, int stq, int32_t d) { - AnnDataPtr an = new AnnotateData; + AnnDataPtr an = std::make_shared(); an->time = curTick(); an->data = d; an->orig_data = d; @@ -1373,7 +1373,7 @@ CPA::unserialize(Checkpoint *cp, const std::string §ion) if (!qSize[x]) continue; for (int y = 0; y < qSize[x]; y++) { - AnnDataPtr a = new AnnotateData; + AnnDataPtr a = std::make_shared(); a->unserialize(cp, csprintf("%s.Q%d_%d", section, x, y)); data.push_back(a); qData[x].push_back(a); diff --git a/src/base/cp_annotate.hh b/src/base/cp_annotate.hh index b5c968857..5d554aa73 100644 --- a/src/base/cp_annotate.hh +++ b/src/base/cp_annotate.hh @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -189,7 +190,7 @@ class CPA : SimObject } /* struct that is written to the annotation output file */ - struct AnnotateData : public RefCounted { + struct AnnotateData { Tick time; uint32_t data; @@ -206,7 +207,7 @@ class CPA : SimObject }; - typedef RefCountingPtr AnnDataPtr; + typedef std::shared_ptr AnnDataPtr; /* header for the annotation file */ struct AnnotateHeader { -- 2.30.2