summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-03-22 15:53:27 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2013-03-22 15:53:27 -0500
commit47c8cb72fc0b400326c7b9b1f82542d4b72295bd (patch)
tree2c62193c775e4da0c0129719dfc1a09f58617856 /src
parent6465cf58248e094fe960a905039d6eccb7cfcecf (diff)
downloadgem5-47c8cb72fc0b400326c7b9b1f82542d4b72295bd.tar.xz
ruby: message buffer: remove _ptr from some variables
The names were getting too long.
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.cc83
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.hh22
2 files changed, 52 insertions, 53 deletions
diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc
index c0a5cbb48..57ce73292 100644
--- a/src/mem/ruby/buffers/MessageBuffer.cc
+++ b/src/mem/ruby/buffers/MessageBuffer.cc
@@ -43,9 +43,9 @@ MessageBuffer::MessageBuffer(const string &name)
m_time_last_time_pop(0), m_last_arrival_time(0)
{
m_msg_counter = 0;
- m_consumer_ptr = NULL;
- m_sender_ptr = NULL;
- m_receiver_ptr = NULL;
+ m_consumer = NULL;
+ m_sender = NULL;
+ m_receiver = NULL;
m_ordering_set = false;
m_strict_fifo = true;
@@ -67,10 +67,10 @@ MessageBuffer::MessageBuffer(const string &name)
int
MessageBuffer::getSize()
{
- if (m_time_last_time_size_checked == m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_size_checked == m_receiver->curCycle()) {
return m_size_last_time_size_checked;
} else {
- m_time_last_time_size_checked = m_receiver_ptr->curCycle();
+ m_time_last_time_size_checked = m_receiver->curCycle();
m_size_last_time_size_checked = m_size;
return m_size;
}
@@ -90,11 +90,11 @@ MessageBuffer::areNSlotsAvailable(int n)
// until next cycle, but enqueue operations effect the visible
// size immediately
int current_size = max(m_size_at_cycle_start, m_size);
- if (m_time_last_time_pop < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_pop < m_receiver->curCycle()) {
// no pops this cycle - m_size is correct
current_size = m_size;
} else {
- if (m_time_last_time_enqueue < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_enqueue < m_receiver->curCycle()) {
// no enqueues this cycle - m_size_at_cycle_start is correct
current_size = m_size_at_cycle_start;
} else {
@@ -156,9 +156,9 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delay)
m_size++;
// record current time incase we have a pop that also adjusts my size
- if (m_time_last_time_enqueue < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_enqueue < m_receiver->curCycle()) {
m_msgs_this_cycle = 0; // first msg this cycle
- m_time_last_time_enqueue = m_receiver_ptr->curCycle();
+ m_time_last_time_enqueue = m_receiver->curCycle();
}
m_msgs_this_cycle++;
@@ -169,10 +169,9 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delay)
// Calculate the arrival time of the message, that is, the first
// cycle the message can be dequeued.
assert(delay > 0);
- Cycles delta = m_receiver_ptr->ticksToCycles(delay *
- m_sender_ptr->clockPeriod());
+ Cycles delta = m_receiver->ticksToCycles(delay * m_sender->clockPeriod());
- Cycles current_time(m_receiver_ptr->curCycle());
+ Cycles current_time(m_receiver->curCycle());
Cycles arrival_time(0);
if (!RubySystem::getRandomization() || (m_randomization == false)) {
@@ -196,10 +195,10 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delay)
if (arrival_time < m_last_arrival_time) {
panic("FIFO ordering violated: %s name: %s current time: %d "
"delta: %d arrival_time: %d last arrival_time: %d\n",
- *this, m_name, current_time * m_receiver_ptr->clockPeriod(),
- delta * m_receiver_ptr->clockPeriod(),
- arrival_time * m_receiver_ptr->clockPeriod(),
- m_last_arrival_time * m_receiver_ptr->clockPeriod());
+ *this, m_name, current_time * m_receiver->clockPeriod(),
+ delta * m_receiver->clockPeriod(),
+ arrival_time * m_receiver->clockPeriod(),
+ m_last_arrival_time * m_receiver->clockPeriod());
}
}
@@ -212,29 +211,29 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delay)
Message* msg_ptr = message.get();
assert(msg_ptr != NULL);
- assert(m_receiver_ptr->clockEdge() >= msg_ptr->getLastEnqueueTime() &&
+ assert(m_receiver->clockEdge() >= msg_ptr->getLastEnqueueTime() &&
"ensure we aren't dequeued early");
- msg_ptr->setDelayedTicks(m_receiver_ptr->clockEdge() -
+ msg_ptr->setDelayedTicks(m_receiver->clockEdge() -
msg_ptr->getLastEnqueueTime() +
msg_ptr->getDelayedTicks());
- msg_ptr->setLastEnqueueTime(arrival_time * m_receiver_ptr->clockPeriod());
+ msg_ptr->setLastEnqueueTime(arrival_time * m_receiver->clockPeriod());
// Insert the message into the priority heap
- MessageBufferNode thisNode(arrival_time * m_receiver_ptr->clockPeriod(),
+ MessageBufferNode thisNode(arrival_time * m_receiver->clockPeriod(),
m_msg_counter, message);
m_prio_heap.push_back(thisNode);
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
DPRINTF(RubyQueue, "Enqueue arrival_time: %lld, Message: %s\n",
- arrival_time * m_receiver_ptr->clockPeriod(), *(message.get()));
+ arrival_time * m_receiver->clockPeriod(), *(message.get()));
// Schedule the wakeup
- if (m_consumer_ptr != NULL) {
- m_consumer_ptr->scheduleEventAbsolute(
- arrival_time * m_receiver_ptr->clockPeriod());
- m_consumer_ptr->storeEventInfo(m_vnet_id);
+ if (m_consumer != NULL) {
+ m_consumer->scheduleEventAbsolute(
+ arrival_time * m_receiver->clockPeriod());
+ m_consumer->storeEventInfo(m_vnet_id);
} else {
panic("No consumer: %s name: %s\n", *this, m_name);
}
@@ -281,9 +280,9 @@ MessageBuffer::pop()
// record previous size and time so the current buffer size isn't
// adjusted until next cycle
- if (m_time_last_time_pop < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_pop < m_receiver->curCycle()) {
m_size_at_cycle_start = m_size;
- m_time_last_time_pop = m_receiver_ptr->curCycle();
+ m_time_last_time_pop = m_receiver->curCycle();
}
m_size--;
}
@@ -310,13 +309,13 @@ MessageBuffer::recycle()
pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- node.m_time = (m_receiver_ptr->curCycle() + m_recycle_latency) *
- m_receiver_ptr->clockPeriod();
+ node.m_time = (m_receiver->curCycle() + m_recycle_latency) *
+ m_receiver->clockPeriod();
m_prio_heap.back() = node;
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->
- scheduleEventAbsolute(m_receiver_ptr->clockEdge(m_recycle_latency));
+ m_consumer->
+ scheduleEventAbsolute(m_receiver->clockEdge(m_recycle_latency));
}
void
@@ -324,7 +323,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
{
DPRINTF(RubyQueue, "ReanalyzeMessages\n");
assert(m_stall_msg_map.count(addr) > 0);
- Tick nextTick = m_receiver_ptr->clockEdge(Cycles(1));
+ Tick nextTick = m_receiver->clockEdge(Cycles(1));
//
// Put all stalled messages associated with this address back on the
@@ -339,7 +338,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->scheduleEventAbsolute(nextTick);
+ m_consumer->scheduleEventAbsolute(nextTick);
m_stall_msg_map[addr].pop_front();
}
m_stall_msg_map.erase(addr);
@@ -349,7 +348,7 @@ void
MessageBuffer::reanalyzeAllMessages()
{
DPRINTF(RubyQueue, "ReanalyzeAllMessages %s\n");
- Tick nextTick = m_receiver_ptr->clockEdge(Cycles(1));
+ Tick nextTick = m_receiver->clockEdge(Cycles(1));
//
// Put all stalled messages associated with this address back on the
@@ -368,7 +367,7 @@ MessageBuffer::reanalyzeAllMessages()
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->scheduleEventAbsolute(nextTick);
+ m_consumer->scheduleEventAbsolute(nextTick);
(map_iter->second).pop_front();
}
}
@@ -400,20 +399,20 @@ MessageBuffer::setAndReturnDelayCycles(MsgPtr msg_ptr)
// this function should only be called on dequeue
// ensure the msg hasn't been enqueued
- assert(msg_ptr->getLastEnqueueTime() <= m_receiver_ptr->clockEdge());
+ assert(msg_ptr->getLastEnqueueTime() <= m_receiver->clockEdge());
- msg_ptr->setDelayedTicks(m_receiver_ptr->clockEdge() -
- msg_ptr->getLastEnqueueTime() +
- msg_ptr->getDelayedTicks());
+ msg_ptr->setDelayedTicks(m_receiver->clockEdge() -
+ msg_ptr->getLastEnqueueTime() +
+ msg_ptr->getDelayedTicks());
- return m_receiver_ptr->ticksToCycles(msg_ptr->getDelayedTicks());
+ return m_receiver->ticksToCycles(msg_ptr->getDelayedTicks());
}
void
MessageBuffer::print(ostream& out) const
{
ccprintf(out, "[MessageBuffer: ");
- if (m_consumer_ptr != NULL) {
+ if (m_consumer != NULL) {
ccprintf(out, " consumer-yes ");
}
@@ -433,7 +432,7 @@ bool
MessageBuffer::isReady() const
{
return ((m_prio_heap.size() > 0) &&
- (m_prio_heap.front().m_time <= m_receiver_ptr->clockEdge()));
+ (m_prio_heap.front().m_time <= m_receiver->clockEdge()));
}
bool
diff --git a/src/mem/ruby/buffers/MessageBuffer.hh b/src/mem/ruby/buffers/MessageBuffer.hh
index 2a52d2a2e..01bbcb525 100644
--- a/src/mem/ruby/buffers/MessageBuffer.hh
+++ b/src/mem/ruby/buffers/MessageBuffer.hh
@@ -77,28 +77,28 @@ class MessageBuffer
bool areNSlotsAvailable(int n);
int getPriority() { return m_priority_rank; }
void setPriority(int rank) { m_priority_rank = rank; }
- void setConsumer(Consumer* consumer_ptr)
+ void setConsumer(Consumer* consumer)
{
- assert(m_consumer_ptr == NULL);
- m_consumer_ptr = consumer_ptr;
+ assert(m_consumer == NULL);
+ m_consumer = consumer;
}
void setSender(ClockedObject* obj)
{
- assert(m_sender_ptr == NULL || m_sender_ptr == obj);
- m_sender_ptr = obj;
+ assert(m_sender == NULL || m_sender == obj);
+ m_sender = obj;
}
void setReceiver(ClockedObject* obj)
{
- assert(m_receiver_ptr == NULL || m_receiver_ptr == obj);
- m_receiver_ptr = obj;
+ assert(m_receiver == NULL || m_receiver == obj);
+ m_receiver = obj;
}
void setDescription(const std::string& name) { m_name = name; }
std::string getDescription() { return m_name;}
- Consumer* getConsumer() { return m_consumer_ptr; }
+ Consumer* getConsumer() { return m_consumer; }
const Message* peekAtHeadOfQueue() const;
const Message* peek() const { return peekAtHeadOfQueue(); }
@@ -174,11 +174,11 @@ class MessageBuffer
// Data Members (m_ prefix)
//! The two ends of the buffer.
- ClockedObject* m_sender_ptr;
- ClockedObject* m_receiver_ptr;
+ ClockedObject* m_sender;
+ ClockedObject* m_receiver;
//! Consumer to signal a wakeup(), can be NULL
- Consumer* m_consumer_ptr;
+ Consumer* m_consumer;
std::vector<MessageBufferNode> m_prio_heap;
// use a std::map for the stalled messages as this container is