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/coherent_xbar.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/mem/coherent_xbar.cc') diff --git a/src/mem/coherent_xbar.cc b/src/mem/coherent_xbar.cc index 6a0136ea8..223ab6ab5 100644 --- a/src/mem/coherent_xbar.cc +++ b/src/mem/coherent_xbar.cc @@ -140,12 +140,6 @@ CoherentXBar::init() bool CoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id) { - // @todo temporary hack to deal with memory corruption issue until - // 4-phase transactions are complete - for (int x = 0; x < pendingDelete.size(); x++) - delete pendingDelete[x]; - pendingDelete.clear(); - // determine the source port based on the id SlavePort *src_port = slavePorts[slave_port_id]; @@ -223,7 +217,10 @@ CoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id) // update the layer state and schedule an idle event reqLayers[master_port_id]->succeededTiming(packetFinishTime); - pendingDelete.push_back(pkt); + + // queue the packet for deletion + pendingDelete.reset(pkt); + return true; } -- cgit v1.2.3