diff options
Diffstat (limited to 'src/cpu/simple/timing.cc')
-rw-r--r-- | src/cpu/simple/timing.cc | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc index 657c2976f..14e760af9 100644 --- a/src/cpu/simple/timing.cc +++ b/src/cpu/simple/timing.cc @@ -261,7 +261,7 @@ TimingSimpleCPU::handleReadPacket(PacketPtr pkt) SimpleExecContext &t_info = *threadInfo[curThread]; SimpleThread* thread = t_info.thread; - RequestPtr req = pkt->req; + const RequestPtr &req = pkt->req; // We're about the issues a locked load, so tell the monitor // to start caring about this address @@ -285,7 +285,7 @@ TimingSimpleCPU::handleReadPacket(PacketPtr pkt) } void -TimingSimpleCPU::sendData(RequestPtr req, uint8_t *data, uint64_t *res, +TimingSimpleCPU::sendData(const RequestPtr &req, uint8_t *data, uint64_t *res, bool read) { SimpleExecContext &t_info = *threadInfo[curThread]; @@ -321,8 +321,8 @@ TimingSimpleCPU::sendData(RequestPtr req, uint8_t *data, uint64_t *res, } void -TimingSimpleCPU::sendSplitData(RequestPtr req1, RequestPtr req2, - RequestPtr req, uint8_t *data, bool read) +TimingSimpleCPU::sendSplitData(const RequestPtr &req1, const RequestPtr &req2, + const RequestPtr &req, uint8_t *data, bool read) { PacketPtr pkt1, pkt2; buildSplitPacket(pkt1, pkt2, req1, req2, req, data, read); @@ -377,14 +377,14 @@ TimingSimpleCPU::translationFault(const Fault &fault) } PacketPtr -TimingSimpleCPU::buildPacket(RequestPtr req, bool read) +TimingSimpleCPU::buildPacket(const RequestPtr &req, bool read) { return read ? Packet::createRead(req) : Packet::createWrite(req); } void TimingSimpleCPU::buildSplitPacket(PacketPtr &pkt1, PacketPtr &pkt2, - RequestPtr req1, RequestPtr req2, RequestPtr req, + const RequestPtr &req1, const RequestPtr &req2, const RequestPtr &req, uint8_t *data, bool read) { pkt1 = pkt2 = NULL; @@ -438,8 +438,9 @@ TimingSimpleCPU::initiateMemRead(Addr addr, unsigned size, if (traceData) traceData->setMem(addr, size, flags); - RequestPtr req = new Request(asid, addr, size, flags, dataMasterId(), pc, - thread->contextId()); + RequestPtr req = std::make_shared<Request>( + asid, addr, size, flags, dataMasterId(), pc, + thread->contextId()); req->taskId(taskId()); @@ -479,7 +480,7 @@ TimingSimpleCPU::handleWritePacket() SimpleExecContext &t_info = *threadInfo[curThread]; SimpleThread* thread = t_info.thread; - RequestPtr req = dcache_pkt->req; + const RequestPtr &req = dcache_pkt->req; if (req->isMmappedIpr()) { Cycles delay = TheISA::handleIprWrite(thread->getTC(), dcache_pkt); new IprEvent(dcache_pkt, this, clockEdge(delay)); @@ -519,8 +520,9 @@ TimingSimpleCPU::writeMem(uint8_t *data, unsigned size, if (traceData) traceData->setMem(addr, size, flags); - RequestPtr req = new Request(asid, addr, size, flags, dataMasterId(), pc, - thread->contextId()); + RequestPtr req = std::make_shared<Request>( + asid, addr, size, flags, dataMasterId(), pc, + thread->contextId()); req->taskId(taskId()); @@ -620,7 +622,7 @@ TimingSimpleCPU::fetch() if (needToFetch) { _status = BaseSimpleCPU::Running; - RequestPtr ifetch_req = new Request(); + RequestPtr ifetch_req = std::make_shared<Request>(); ifetch_req->taskId(taskId()); ifetch_req->setContext(thread->contextId()); setupFetchRequest(ifetch_req); @@ -638,7 +640,7 @@ TimingSimpleCPU::fetch() void -TimingSimpleCPU::sendFetch(const Fault &fault, RequestPtr req, +TimingSimpleCPU::sendFetch(const Fault &fault, const RequestPtr &req, ThreadContext *tc) { if (fault == NoFault) { @@ -659,7 +661,6 @@ TimingSimpleCPU::sendFetch(const Fault &fault, RequestPtr req, } } else { DPRINTF(SimpleCPU, "Translation of addr %#x faulted\n", req->getVaddr()); - delete req; // fetch fault: advance directly to next instruction (fault handler) _status = BaseSimpleCPU::Running; advanceInst(fault); @@ -775,7 +776,6 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt) } if (pkt) { - delete pkt->req; delete pkt; } } @@ -831,7 +831,6 @@ TimingSimpleCPU::completeDataAccess(PacketPtr pkt) SplitFragmentSenderState * send_state = dynamic_cast<SplitFragmentSenderState *>(pkt->senderState); assert(send_state); - delete pkt->req; delete pkt; PacketPtr big_pkt = send_state->bigPkt; delete send_state; @@ -866,7 +865,6 @@ TimingSimpleCPU::completeDataAccess(PacketPtr pkt) traceData = NULL; } - delete pkt->req; delete pkt; postExecute(); |