From ac1368df50af123b32b41d7115ea4a0f15f7c97f Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 6 Nov 2015 03:26:21 -0500 Subject: mem: Unify delayed packet deletion This patch unifies how we deal with delayed packet deletion, where the receiving slave is responsible for deleting the packet, but the sending agent (e.g. a cache) is still relying on the pointer until the call to sendTimingReq completes. Previously we used a mix of a deletion vector and a construct using unique_ptr. With this patch we ensure all slaves use the latter approach. --- src/mem/dramsim2.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/mem/dramsim2.cc') diff --git a/src/mem/dramsim2.cc b/src/mem/dramsim2.cc index 64acc5b57..cd0f45b23 100644 --- a/src/mem/dramsim2.cc +++ b/src/mem/dramsim2.cc @@ -178,16 +178,10 @@ DRAMSim2::recvTimingReq(PacketPtr pkt) // we should never see a new request while in retry assert(!retryReq); - // @todo temporary hack to deal with memory corruption issues until - // 4-phase transactions are complete - for (int x = 0; x < pendingDelete.size(); x++) - delete pendingDelete[x]; - pendingDelete.clear(); - if (pkt->memInhibitAsserted()) { // snooper will supply based on copy of packet // still target's responsibility to delete packet - pendingDelete.push_back(pkt); + pendingDelete.reset(pkt); return true; } @@ -281,9 +275,8 @@ DRAMSim2::accessAndRespond(PacketPtr pkt) if (!retryResp && !sendResponseEvent.scheduled()) schedule(sendResponseEvent, time); } else { - // @todo the packet is going to be deleted, and the DRAMPacket - // is still having a pointer to it - pendingDelete.push_back(pkt); + // queue the packet for deletion + pendingDelete.reset(pkt); } } -- cgit v1.2.3