changeset 58fbfddff18d in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=58fbfddff18d
description:
        ruby: replace global g_abs_controls with per-RubySystem var

        This is another step in the process of removing global variables
        from Ruby to enable multiple RubySystem instances in a single 
simulation.

        The list of abstract controllers is per-RubySystem and should be
        represented that way, rather than as a global.

        Since this is the last remaining Ruby global variable, the
        src/mem/ruby/Common/Global.* files are also removed.

diffstat:

 src/cpu/testers/directedtest/RubyDirectedTester.hh             |   1 -
 src/cpu/testers/rubytest/Check.hh                              |   1 -
 src/cpu/testers/rubytest/CheckTable.hh                         |   1 -
 src/cpu/testers/rubytest/RubyTester.cc                         |   1 -
 src/cpu/testers/rubytest/RubyTester.hh                         |   1 -
 src/mem/ruby/common/Global.cc                                  |  33 --------
 src/mem/ruby/common/Global.hh                                  |  41 ----------
 src/mem/ruby/common/SConscript                                 |   1 -
 src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc  |   1 -
 src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc     |   1 -
 src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc |   1 -
 src/mem/ruby/network/simple/Throttle.hh                        |   1 -
 src/mem/ruby/profiler/AccessTraceForAddress.hh                 |   1 -
 src/mem/ruby/profiler/Profiler.cc                              |  15 +-
 src/mem/ruby/profiler/Profiler.hh                              |   5 +-
 src/mem/ruby/structures/RubyMemoryControl.cc                   |   1 -
 src/mem/ruby/structures/RubyMemoryControl.hh                   |   1 -
 src/mem/ruby/structures/TimerTable.cc                          |   1 -
 src/mem/ruby/system/Sequencer.cc                               |   1 -
 src/mem/ruby/system/System.cc                                  |   6 +-
 src/mem/ruby/system/System.hh                                  |   2 +
 src/mem/slicc/symbols/StateMachine.py                          |  14 +-
 src/mem/slicc/symbols/Type.py                                  |   1 -
 23 files changed, 22 insertions(+), 110 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r 80069a602c83 -r 58fbfddff18d 
src/cpu/testers/directedtest/RubyDirectedTester.hh
--- a/src/cpu/testers/directedtest/RubyDirectedTester.hh        Fri Jul 10 
16:05:23 2015 -0500
+++ b/src/cpu/testers/directedtest/RubyDirectedTester.hh        Fri Jul 10 
16:05:24 2015 -0500
@@ -35,7 +35,6 @@
 #include <vector>
 
 #include "mem/ruby/common/DataBlock.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/SubBlock.hh"
 #include "mem/ruby/system/RubyPort.hh"
 #include "mem/mem_object.hh"
diff -r 80069a602c83 -r 58fbfddff18d src/cpu/testers/rubytest/Check.hh
--- a/src/cpu/testers/rubytest/Check.hh Fri Jul 10 16:05:23 2015 -0500
+++ b/src/cpu/testers/rubytest/Check.hh Fri Jul 10 16:05:24 2015 -0500
@@ -36,7 +36,6 @@
 #include "mem/protocol/RubyAccessMode.hh"
 #include "mem/protocol/TesterStatus.hh"
 #include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
 
 class SubBlock;
 
diff -r 80069a602c83 -r 58fbfddff18d src/cpu/testers/rubytest/CheckTable.hh
--- a/src/cpu/testers/rubytest/CheckTable.hh    Fri Jul 10 16:05:23 2015 -0500
+++ b/src/cpu/testers/rubytest/CheckTable.hh    Fri Jul 10 16:05:24 2015 -0500
@@ -35,7 +35,6 @@
 
 #include "base/hashmap.hh"
 #include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
 
 class Check;
 class RubyTester;
diff -r 80069a602c83 -r 58fbfddff18d src/cpu/testers/rubytest/RubyTester.cc
--- a/src/cpu/testers/rubytest/RubyTester.cc    Fri Jul 10 16:05:23 2015 -0500
+++ b/src/cpu/testers/rubytest/RubyTester.cc    Fri Jul 10 16:05:24 2015 -0500
@@ -43,7 +43,6 @@
 #include "cpu/testers/rubytest/Check.hh"
 #include "cpu/testers/rubytest/RubyTester.hh"
 #include "debug/RubyTest.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/SubBlock.hh"
 #include "mem/ruby/system/System.hh"
 #include "sim/sim_exit.hh"
diff -r 80069a602c83 -r 58fbfddff18d src/cpu/testers/rubytest/RubyTester.hh
--- a/src/cpu/testers/rubytest/RubyTester.hh    Fri Jul 10 16:05:23 2015 -0500
+++ b/src/cpu/testers/rubytest/RubyTester.hh    Fri Jul 10 16:05:24 2015 -0500
@@ -47,7 +47,6 @@
 #include <vector>
 
 #include "cpu/testers/rubytest/CheckTable.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/SubBlock.hh"
 #include "mem/ruby/system/RubyPort.hh"
 #include "mem/mem_object.hh"
diff -r 80069a602c83 -r 58fbfddff18d src/mem/ruby/common/Global.cc
--- a/src/mem/ruby/common/Global.cc     Fri Jul 10 16:05:23 2015 -0500
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "mem/ruby/common/Global.hh"
-
-using namespace std;
-
-vector<map<uint32_t, AbstractController *> > g_abs_controls;
diff -r 80069a602c83 -r 58fbfddff18d src/mem/ruby/common/Global.hh
--- a/src/mem/ruby/common/Global.hh     Fri Jul 10 16:05:23 2015 -0500
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MEM_RUBY_COMMON_GLOBAL_HH__
-#define __MEM_RUBY_COMMON_GLOBAL_HH__
-
-#include <map>
-#include <vector>
-
-#include "base/str.hh"
-#include "base/types.hh"
-
-class AbstractController;
-extern std::vector<std::map<uint32_t, AbstractController *> > g_abs_controls;
-
-#endif // __MEM_RUBY_COMMON_GLOBAL_HH__
diff -r 80069a602c83 -r 58fbfddff18d src/mem/ruby/common/SConscript
--- a/src/mem/ruby/common/SConscript    Fri Jul 10 16:05:23 2015 -0500
+++ b/src/mem/ruby/common/SConscript    Fri Jul 10 16:05:24 2015 -0500
@@ -36,7 +36,6 @@
 Source('Address.cc')
 Source('Consumer.cc')
 Source('DataBlock.cc')
-Source('Global.cc')
 Source('Histogram.cc')
 Source('NetDest.cc')
 Source('Set.cc')
diff -r 80069a602c83 -r 58fbfddff18d 
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc     Fri Jul 
10 16:05:23 2015 -0500
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc     Fri Jul 
10 16:05:24 2015 -0500
@@ -32,7 +32,6 @@
 
 #include "base/cast.hh"
 #include "base/stl_helpers.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/NetDest.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh"
diff -r 80069a602c83 -r 58fbfddff18d 
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc        Fri Jul 
10 16:05:23 2015 -0500
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc        Fri Jul 
10 16:05:24 2015 -0500
@@ -28,7 +28,6 @@
  * Authors: Niket Agarwal
  */
 
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh"
 #include "mem/ruby/system/System.hh"
 
diff -r 80069a602c83 -r 58fbfddff18d 
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc    Fri Jul 
10 16:05:23 2015 -0500
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc    Fri Jul 
10 16:05:24 2015 -0500
@@ -32,7 +32,6 @@
 
 #include "base/cast.hh"
 #include "base/stl_helpers.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/NetDest.hh"
 #include "mem/ruby/network/BasicLink.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh"
diff -r 80069a602c83 -r 58fbfddff18d src/mem/ruby/network/simple/Throttle.hh
--- a/src/mem/ruby/network/simple/Throttle.hh   Fri Jul 10 16:05:23 2015 -0500
+++ b/src/mem/ruby/network/simple/Throttle.hh   Fri Jul 10 16:05:24 2015 -0500
@@ -43,7 +43,6 @@
 #include <vector>
 
 #include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/network/Network.hh"
 #include "mem/ruby/system/System.hh"
 
diff -r 80069a602c83 -r 58fbfddff18d 
src/mem/ruby/profiler/AccessTraceForAddress.hh
--- a/src/mem/ruby/profiler/AccessTraceForAddress.hh    Fri Jul 10 16:05:23 
2015 -0500
+++ b/src/mem/ruby/profiler/AccessTraceForAddress.hh    Fri Jul 10 16:05:24 
2015 -0500
@@ -34,7 +34,6 @@
 #include "mem/protocol/RubyAccessMode.hh"
 #include "mem/protocol/RubyRequestType.hh"
 #include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/Set.hh"
 
 class Histogram;
diff -r 80069a602c83 -r 58fbfddff18d src/mem/ruby/profiler/Profiler.cc
--- a/src/mem/ruby/profiler/Profiler.cc Fri Jul 10 16:05:23 2015 -0500
+++ b/src/mem/ruby/profiler/Profiler.cc Fri Jul 10 16:05:24 2015 -0500
@@ -60,7 +60,8 @@
 using namespace std;
 using m5::stl_helpers::operator<<;
 
-Profiler::Profiler(const RubySystemParams *p)
+Profiler::Profiler(const RubySystemParams *p, RubySystem *rs)
+    : m_ruby_system(rs)
 {
     m_hot_lines = p->hot_lines;
     m_all_instructions = p->all_instructions;
@@ -253,8 +254,8 @@
     uint32_t numVNets = Network::getNumberOfVirtualNetworks();
     for (uint32_t i = 0; i < MachineType_NUM; i++) {
         for (map<uint32_t, AbstractController*>::iterator it =
-                  g_abs_controls[i].begin();
-             it != g_abs_controls[i].end(); ++it) {
+                  m_ruby_system->m_abstract_controls[i].begin();
+             it != m_ruby_system->m_abstract_controls[i].end(); ++it) {
 
             AbstractController *ctr = (*it).second;
             delayHistogram.add(ctr->getDelayHist());
@@ -267,8 +268,8 @@
 
     for (uint32_t i = 0; i < MachineType_NUM; i++) {
         for (map<uint32_t, AbstractController*>::iterator it =
-                g_abs_controls[i].begin();
-                it != g_abs_controls[i].end(); ++it) {
+                m_ruby_system->m_abstract_controls[i].begin();
+                it != m_ruby_system->m_abstract_controls[i].end(); ++it) {
 
             AbstractController *ctr = (*it).second;
             Sequencer *seq = ctr->getSequencer();
@@ -280,8 +281,8 @@
 
     for (uint32_t i = 0; i < MachineType_NUM; i++) {
         for (map<uint32_t, AbstractController*>::iterator it =
-                g_abs_controls[i].begin();
-                it != g_abs_controls[i].end(); ++it) {
+                m_ruby_system->m_abstract_controls[i].begin();
+                it != m_ruby_system->m_abstract_controls[i].end(); ++it) {
 
             AbstractController *ctr = (*it).second;
             Sequencer *seq = ctr->getSequencer();
diff -r 80069a602c83 -r 58fbfddff18d src/mem/ruby/profiler/Profiler.hh
--- a/src/mem/ruby/profiler/Profiler.hh Fri Jul 10 16:05:23 2015 -0500
+++ b/src/mem/ruby/profiler/Profiler.hh Fri Jul 10 16:05:24 2015 -0500
@@ -56,7 +56,6 @@
 #include "mem/protocol/PrefetchBit.hh"
 #include "mem/protocol/RubyAccessMode.hh"
 #include "mem/protocol/RubyRequestType.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/MachineID.hh"
 #include "params/RubySystem.hh"
 
@@ -66,9 +65,11 @@
 class Profiler
 {
   public:
-    Profiler(const RubySystemParams *params);
+    Profiler(const RubySystemParams *params, RubySystem *rs);
     ~Profiler();
 
+    RubySystem *m_ruby_system;
+
     void wakeup();
     void regStats(const std::string &name);
     void collateStats();
diff -r 80069a602c83 -r 58fbfddff18d 
src/mem/ruby/structures/RubyMemoryControl.cc
--- a/src/mem/ruby/structures/RubyMemoryControl.cc      Fri Jul 10 16:05:23 
2015 -0500
+++ b/src/mem/ruby/structures/RubyMemoryControl.cc      Fri Jul 10 16:05:24 
2015 -0500
@@ -110,7 +110,6 @@
 #include "base/random.hh"
 #include "debug/RubyMemory.hh"
 #include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/profiler/Profiler.hh"
 #include "mem/ruby/slicc_interface/Message.hh"
 #include "mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh"
diff -r 80069a602c83 -r 58fbfddff18d 
src/mem/ruby/structures/RubyMemoryControl.hh
--- a/src/mem/ruby/structures/RubyMemoryControl.hh      Fri Jul 10 16:05:23 
2015 -0500
+++ b/src/mem/ruby/structures/RubyMemoryControl.hh      Fri Jul 10 16:05:24 
2015 -0500
@@ -37,7 +37,6 @@
 #include "mem/abstract_mem.hh"
 #include "mem/protocol/MemoryMsg.hh"
 #include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
 #include "mem/ruby/profiler/MemCntrlProfiler.hh"
 #include "mem/ruby/structures/MemoryNode.hh"
 #include "mem/ruby/system/System.hh"
diff -r 80069a602c83 -r 58fbfddff18d src/mem/ruby/structures/TimerTable.cc
--- a/src/mem/ruby/structures/TimerTable.cc     Fri Jul 10 16:05:23 2015 -0500
+++ b/src/mem/ruby/structures/TimerTable.cc     Fri Jul 10 16:05:24 2015 -0500
@@ -26,7 +26,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to