summaryrefslogtreecommitdiff
path: root/src/mem/cache
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-02-19 05:56:05 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-02-19 05:56:05 -0500
commit0622f30961fc32b967bb1ef784afc5a205b16f6e (patch)
treeb6b57cf049b7fc7e49cc65a735af7508862b9c24 /src/mem/cache
parentf69d431ede9b815ea4b63a2d20237ed3e79df169 (diff)
downloadgem5-0622f30961fc32b967bb1ef784afc5a205b16f6e.tar.xz
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.
Diffstat (limited to 'src/mem/cache')
-rw-r--r--src/mem/cache/cache_impl.hh28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh
index a5f1b4844..d2c9f900e 100644
--- a/src/mem/cache/cache_impl.hh
+++ b/src/mem/cache/cache_impl.hh
@@ -348,24 +348,12 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk,
class ForwardResponseRecord : public Packet::SenderState
{
- Packet::SenderState *prevSenderState;
- PortID prevSrc;
-#ifndef NDEBUG
- BaseCache *cache;
-#endif
public:
- ForwardResponseRecord(Packet *pkt, BaseCache *_cache)
- : prevSenderState(pkt->senderState), prevSrc(pkt->getSrc())
-#ifndef NDEBUG
- , cache(_cache)
-#endif
+
+ PortID prevSrc;
+
+ ForwardResponseRecord(PortID prev_src) : prevSrc(prev_src)
{}
- void restore(Packet *pkt, BaseCache *_cache)
- {
- assert(_cache == cache);
- pkt->senderState = prevSenderState;
- pkt->setDest(prevSrc);
- }
};
@@ -389,7 +377,7 @@ Cache<TagStore>::timingAccess(PacketPtr pkt)
if (pkt->isResponse()) {
// must be cache-to-cache response from upper to lower level
ForwardResponseRecord *rec =
- dynamic_cast<ForwardResponseRecord *>(pkt->senderState);
+ dynamic_cast<ForwardResponseRecord *>(pkt->popSenderState());
assert(!system->bypassCaches());
if (rec == NULL) {
@@ -402,7 +390,7 @@ Cache<TagStore>::timingAccess(PacketPtr pkt)
return true;
}
- rec->restore(pkt, this);
+ pkt->setDest(rec->prevSrc);
delete rec;
memSidePort->schedTimingSnoopResp(pkt, time);
return true;
@@ -1293,14 +1281,14 @@ Cache<TagStore>::handleSnoop(PacketPtr pkt, BlkType *blk,
if (is_timing) {
Packet snoopPkt(pkt, true); // clear flags
snoopPkt.setExpressSnoop();
- snoopPkt.senderState = new ForwardResponseRecord(pkt, this);
+ snoopPkt.pushSenderState(new ForwardResponseRecord(pkt->getSrc()));
cpuSidePort->sendTimingSnoopReq(&snoopPkt);
if (snoopPkt.memInhibitAsserted()) {
// cache-to-cache response from some upper cache
assert(!alreadyResponded);
pkt->assertMemInhibit();
} else {
- delete snoopPkt.senderState;
+ delete snoopPkt.popSenderState();
}
if (snoopPkt.sharedAsserted()) {
pkt->assertShared();