changeset b66b558578bd in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=b66b558578bd
description:
ruby: get rid of gems_common/util.hh and .cc and use stuff in src/base
diffstat:
29 files changed, 130 insertions(+), 293 deletions(-)
src/cpu/rubytest/CheckTable.cc | 3
src/mem/gems_common/SConscript | 2
src/mem/gems_common/util.cc | 129 ----------------------
src/mem/gems_common/util.hh | 69 -----------
src/mem/ruby/buffers/MessageBuffer.cc | 17 +-
src/mem/ruby/buffers/MessageBuffer.hh | 1
src/mem/ruby/common/Debug.cc | 1
src/mem/ruby/filters/BlockBloomFilter.cc | 14 +-
src/mem/ruby/filters/BulkBloomFilter.cc | 13 +-
src/mem/ruby/filters/GenericBloomFilter.cc | 9 +
src/mem/ruby/filters/H3BloomFilter.cc | 27 ++--
src/mem/ruby/filters/LSB_CountingBloomFilter.cc | 14 +-
src/mem/ruby/filters/MultiBitSelBloomFilter.cc | 34 ++---
src/mem/ruby/filters/MultiGrainBloomFilter.cc | 16 +-
src/mem/ruby/filters/NonCountingBloomFilter.cc | 12 +-
src/mem/ruby/network/garnet/BaseGarnetNetwork.hh | 1
src/mem/ruby/network/simple/PerfectSwitch.cc | 1
src/mem/ruby/network/simple/SimpleNetwork.cc | 8 -
src/mem/ruby/network/simple/Topology.cc | 1
src/mem/ruby/profiler/Profiler.cc | 11 +
src/mem/ruby/system/CacheMemory.cc | 3
src/mem/ruby/system/DirectoryMemory.cc | 10 -
src/mem/ruby/system/MachineID.hh | 4
src/mem/ruby/system/MemoryControl.hh | 1
src/mem/ruby/system/NodeID.hh | 4
src/mem/ruby/system/PersistentTable.cc | 1
src/mem/ruby/system/Sequencer.cc | 1
src/mem/ruby/system/System.cc | 7 -
src/mem/slicc/symbols/StateMachine.py | 9 -
diffs (truncated from 908 to 300 lines):
diff -r 4e24742201d7 -r b66b558578bd src/cpu/rubytest/CheckTable.cc
--- a/src/cpu/rubytest/CheckTable.cc Fri Apr 02 11:20:32 2010 -0700
+++ b/src/cpu/rubytest/CheckTable.cc Fri Apr 02 11:20:32 2010 -0700
@@ -27,6 +27,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
#include "cpu/rubytest/Check.hh"
#include "cpu/rubytest/CheckTable.hh"
#include "cpu/rubytest/CheckTable.hh"
@@ -81,7 +82,7 @@
void
CheckTable::addCheck(const Address& address)
{
- if (log_int(CHECK_SIZE) != 0) {
+ if (floorLog2(CHECK_SIZE) != 0) {
if (address.bitSelect(0, CHECK_SIZE_BITS - 1) != 0) {
ERROR_MSG("Check not aligned");
}
diff -r 4e24742201d7 -r b66b558578bd src/mem/gems_common/SConscript
--- a/src/mem/gems_common/SConscript Fri Apr 02 11:20:32 2010 -0700
+++ b/src/mem/gems_common/SConscript Fri Apr 02 11:20:32 2010 -0700
@@ -33,6 +33,4 @@
if not env['RUBY']:
Return()
-Source('util.cc')
-
TraceFlag('GemsCommon')
diff -r 4e24742201d7 -r b66b558578bd src/mem/gems_common/util.cc
--- a/src/mem/gems_common/util.cc Fri Apr 02 11:20:32 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 1999-2005 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.
- */
-
-/*
- * $Id$
- */
-
-#include <cassert>
-#include <iomanip>
-#include <sstream>
-
-#include "mem/gems_common/util.hh"
-
-using namespace std;
-
-// Split a string into a head and tail strings on the specified
-// character. Return the head and the string passed in is modified by
-// removing the head, leaving just the tail.
-
-string string_split(string& str, char split_character)
-{
- string head = "";
- string tail = "";
-
- unsigned counter = 0;
- while(counter < str.size()) {
- if (str[counter] == split_character) {
- counter++;
- break;
- } else {
- head += str[counter];
- }
- counter++;
- }
-
- while(counter < str.size()) {
- tail += str[counter];
- counter++;
- }
- str = tail;
- return head;
-}
-
-string bool_to_string(bool value)
-{
- if (value) {
- return "true";
- } else {
- return "false";
- }
-}
-
-string int_to_string(int n, bool zero_fill, int width)
-{
- ostringstream sstr;
- if(zero_fill) {
- sstr << setw(width) << setfill('0') << n;
- } else {
- sstr << n;
- }
- string str = sstr.str();
- return str;
-}
-
-float string_to_float(string& str)
-{
- stringstream sstr(str);
- float ret;
- sstr >> ret;
- return ret;
-}
-
-bool string_to_bool(const string & str)
-{
- string lower(str);
- for (size_t i=0;i<str.length();i++)
- lower[i] = tolower(str[i]);
- if (lower == "true")
- return true;
- else if (lower == "false")
- return false;
- else
- assert(0);
-
- return false;
-}
-
-// Log functions
-int log_int(long long n)
-{
- assert(n > 0);
- int counter = 0;
- while (n >= 2) {
- counter++;
- n = n>>(long long)(1);
- }
- return counter;
-}
-
-bool is_power_of_2(long long n)
-{
- return (n == ((long long)(1) << log_int(n)));
-}
-
diff -r 4e24742201d7 -r b66b558578bd src/mem/gems_common/util.hh
--- a/src/mem/gems_common/util.hh Fri Apr 02 11:20:32 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1999-2005 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.
- */
-
-/*
- * $Id$
- */
-
-#ifndef UTIL_H
-#define UTIL_H
-
-#include <string>
-
-std::string string_split(std::string& str, char split_character);
-std::string bool_to_string(bool value);
-std::string int_to_string(int n, bool zero_fill = false, int width = 0);
-float string_to_float(std::string& str);
-bool string_to_bool(const std::string & str);
-int log_int(long long n);
-bool is_power_of_2(long long n);
-
-// Min and Max functions (since they are extern inline, they are as
-// fast as macros)
-
-extern inline
-int max(int n1, int n2)
-{
- if (n1 > n2) {
- return n1;
- } else {
- return n2;
- }
-}
-
-extern inline
-int min(int n1, int n2)
-{
- if (n1 < n2) {
- return n1;
- } else {
- return n2;
- }
-}
-
-#endif //UTIL_H
diff -r 4e24742201d7 -r b66b558578bd src/mem/ruby/buffers/MessageBuffer.cc
--- a/src/mem/ruby/buffers/MessageBuffer.cc Fri Apr 02 11:20:32 2010 -0700
+++ b/src/mem/ruby/buffers/MessageBuffer.cc Fri Apr 02 11:20:32 2010 -0700
@@ -26,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/cprintf.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/system/System.hh"
@@ -123,8 +124,8 @@
DEBUG_NEWLINE(QUEUE_COMP, MedPrio);
DEBUG_MSG(QUEUE_COMP, MedPrio,
- "Peeking at head of queue " + m_name + " time: "
- + int_to_string(g_eventQueue_ptr->getTime()) + ".");
+ csprintf("Peeking at head of queue %s time: %d.",
+ m_name, g_eventQueue_ptr->getTime()));
assert(isReady());
msg_ptr = m_prio_heap.peekMin().m_msgptr.ref();
@@ -151,8 +152,9 @@
MessageBuffer::enqueue(const MsgPtr& message, Time delta)
{
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
- DEBUG_MSG(QUEUE_COMP, HighPrio, "enqueue " + m_name + " time: "
- + int_to_string(g_eventQueue_ptr->getTime()) + ".");
+ DEBUG_MSG(QUEUE_COMP, HighPrio,
+ csprintf("enqueue %s time: %d.", m_name,
+ g_eventQueue_ptr->getTime()));
DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
@@ -228,10 +230,9 @@
m_prio_heap.insert(thisNode);
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
- DEBUG_MSG(QUEUE_COMP, HighPrio, "enqueue " + m_name
- + " with arrival_time " + int_to_string(arrival_time)
- + " cur_time: " + int_to_string(g_eventQueue_ptr->getTime())
- + ".");
+ DEBUG_MSG(QUEUE_COMP, HighPrio,
+ csprintf("enqueue %s with arrival_time %d cur_time: %d.",
+ m_name, arrival_time, g_eventQueue_ptr->getTime()));
DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
diff -r 4e24742201d7 -r b66b558578bd src/mem/ruby/buffers/MessageBuffer.hh
--- a/src/mem/ruby/buffers/MessageBuffer.hh Fri Apr 02 11:20:32 2010 -0700
+++ b/src/mem/ruby/buffers/MessageBuffer.hh Fri Apr 02 11:20:32 2010 -0700
@@ -38,7 +38,6 @@
#include <string>
#include "mem/gems_common/PrioHeap.hh"
-#include "mem/gems_common/util.hh"
#include "mem/ruby/buffers/MessageBufferNode.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/common/Global.hh"
diff -r 4e24742201d7 -r b66b558578bd src/mem/ruby/common/Debug.cc
--- a/src/mem/ruby/common/Debug.cc Fri Apr 02 11:20:32 2010 -0700
+++ b/src/mem/ruby/common/Debug.cc Fri Apr 02 11:20:32 2010 -0700
@@ -30,7 +30,6 @@
#include <stdarg.h>
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev