From aa5140e26ef30e0c66397e73b20196d7d855875c Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Tue, 7 Jan 2020 23:49:52 +0100 Subject: mem-garnet: Use smart pointers for CrossbarSwitch's members Use smart pointers for the pointers managed by CrossbarSwitch. Change-Id: I71958c72cde5981d730aa3f68bba0ffbe4c2506f Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24244 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc | 13 +++---------- src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh | 8 +++++--- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src/mem') diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc index fbaf25b7d..e3a5665be 100644 --- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc +++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc @@ -1,6 +1,7 @@ /* - * Copyright (c) 2008 Princeton University + * Copyright (c) 2020 Inria * Copyright (c) 2016 Georgia Institute of Technology + * Copyright (c) 2008 Princeton University * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,13 +34,10 @@ #include "mem/ruby/network/garnet2.0/CrossbarSwitch.hh" -#include "base/stl_helpers.hh" #include "debug/RubyNetwork.hh" #include "mem/ruby/network/garnet2.0/OutputUnit.hh" #include "mem/ruby/network/garnet2.0/Router.hh" -using m5::stl_helpers::deletePointers; - CrossbarSwitch::CrossbarSwitch(Router *router) : Consumer(router) { @@ -48,11 +46,6 @@ CrossbarSwitch::CrossbarSwitch(Router *router) m_crossbar_activity = 0; } -CrossbarSwitch::~CrossbarSwitch() -{ - deletePointers(m_switch_buffer); -} - void CrossbarSwitch::init() { @@ -61,7 +54,7 @@ CrossbarSwitch::init() m_num_inports = m_router->get_num_inports(); m_switch_buffer.resize(m_num_inports); for (int i = 0; i < m_num_inports; i++) { - m_switch_buffer[i] = new flitBuffer(); + m_switch_buffer[i].reset(new flitBuffer()); } } diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh index 9d4fee5a7..40d2f6b69 100644 --- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh +++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh @@ -1,6 +1,7 @@ /* - * Copyright (c) 2008 Princeton University + * Copyright (c) 2020 Inria * Copyright (c) 2016 Georgia Institute of Technology + * Copyright (c) 2008 Princeton University * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +36,7 @@ #define __MEM_RUBY_NETWORK_GARNET2_0_CROSSBARSWITCH_HH__ #include +#include #include #include "mem/ruby/common/Consumer.hh" @@ -48,7 +50,7 @@ class CrossbarSwitch : public Consumer { public: CrossbarSwitch(Router *router); - ~CrossbarSwitch(); + ~CrossbarSwitch() = default; void wakeup(); void init(); void print(std::ostream& out) const {}; @@ -66,7 +68,7 @@ class CrossbarSwitch : public Consumer int m_num_inports; double m_crossbar_activity; Router *m_router; - std::vector m_switch_buffer; + std::vector> m_switch_buffer; std::vector m_output_unit; }; -- cgit v1.2.3