TimingSimpleCPU: split data sender state fix
authorJoel Hestness <hestness@cs.utexas.edu>
Mon, 7 Feb 2011 06:14:18 +0000 (22:14 -0800)
committerJoel Hestness <hestness@cs.utexas.edu>
Mon, 7 Feb 2011 06:14:18 +0000 (22:14 -0800)
In sendSplitData, keep a pointer to the senderState that may be updated after
the call to handle*Packet. This way, if the receiver updates the packet
senderState, it can still be accessed in sendSplitData.

src/cpu/simple/timing.cc

index 47f99cd6d5c304018b833aac7cbd91fa1530c955..453699f84178cbde228c26646e1b2a18e6981e74 100644 (file)
@@ -325,26 +325,26 @@ TimingSimpleCPU::sendSplitData(RequestPtr req1, RequestPtr req2,
         pkt1->makeResponse();
         completeDataAccess(pkt1);
     } else if (read) {
+        SplitFragmentSenderState * send_state =
+            dynamic_cast<SplitFragmentSenderState *>(pkt1->senderState);
         if (handleReadPacket(pkt1)) {
-            SplitFragmentSenderState * send_state =
-                dynamic_cast<SplitFragmentSenderState *>(pkt1->senderState);
             send_state->clearFromParent();
+            send_state = dynamic_cast<SplitFragmentSenderState *>(
+                    pkt2->senderState);
             if (handleReadPacket(pkt2)) {
-                send_state = dynamic_cast<SplitFragmentSenderState *>(
-                        pkt1->senderState);
                 send_state->clearFromParent();
             }
         }
     } else {
         dcache_pkt = pkt1;
+        SplitFragmentSenderState * send_state =
+            dynamic_cast<SplitFragmentSenderState *>(pkt1->senderState);
         if (handleWritePacket()) {
-            SplitFragmentSenderState * send_state =
-                dynamic_cast<SplitFragmentSenderState *>(pkt1->senderState);
             send_state->clearFromParent();
             dcache_pkt = pkt2;
+            send_state = dynamic_cast<SplitFragmentSenderState *>(
+                    pkt2->senderState);
             if (handleWritePacket()) {
-                send_state = dynamic_cast<SplitFragmentSenderState *>(
-                        pkt1->senderState);
                 send_state->clearFromParent();
             }
         }