From 0622f30961fc32b967bb1ef784afc5a205b16f6e Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Tue, 19 Feb 2013 05:56:05 -0500 Subject: mem: Add predecessor to SenderState base class This patch adds a predecessor field to the SenderState base class to make the process of linking them up more uniform, and enable a traversal of the stack without knowing the specific type of the subclasses. There are a number of simplifications done as part of changing the SenderState, particularly in the RubyTest. --- src/mem/comm_monitor.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/mem/comm_monitor.cc') diff --git a/src/mem/comm_monitor.cc b/src/mem/comm_monitor.cc index 51e95b36b..a6c08e3b2 100644 --- a/src/mem/comm_monitor.cc +++ b/src/mem/comm_monitor.cc @@ -167,15 +167,13 @@ CommMonitor::recvTimingReq(PacketPtr pkt) Addr addr = pkt->getAddr(); bool needsResponse = pkt->needsResponse(); bool memInhibitAsserted = pkt->memInhibitAsserted(); - Packet::SenderState* senderState = pkt->senderState; // If a cache miss is served by a cache, a monitor near the memory // would see a request which needs a response, but this response // would be inhibited and not come back from the memory. Therefore // we additionally have to check the inhibit flag. if (needsResponse && !memInhibitAsserted && !stats.disableLatencyHists) { - pkt->senderState = new CommMonitorSenderState(senderState, - curTick()); + pkt->pushSenderState(new CommMonitorSenderState(curTick())); } // Attempt to send the packet (always succeeds for inhibited @@ -184,8 +182,7 @@ CommMonitor::recvTimingReq(PacketPtr pkt) // If not successful, restore the sender state if (!successful && needsResponse && !stats.disableLatencyHists) { - delete pkt->senderState; - pkt->senderState = senderState; + delete pkt->popSenderState(); } if (successful && traceStream != NULL) { @@ -306,7 +303,7 @@ CommMonitor::recvTimingResp(PacketPtr pkt) panic("Monitor got a response without monitor sender state\n"); // Restore the sate - pkt->senderState = commReceivedState->origSenderState; + pkt->senderState = commReceivedState->predecessor; } // Attempt to send the packet -- cgit v1.2.3