inorder-mem: clean up allocation/deletion of requests/packets
* * *
This commit is contained in:
parent
1c7e988272
commit
c9a03f549b
5 changed files with 36 additions and 16 deletions
|
@ -108,7 +108,9 @@ InOrderDynInst::setMachInst(ExtMachInst machInst)
|
||||||
void
|
void
|
||||||
InOrderDynInst::initVars()
|
InOrderDynInst::initVars()
|
||||||
{
|
{
|
||||||
req = NULL;
|
fetchMemReq = NULL;
|
||||||
|
dataMemReq = NULL;
|
||||||
|
|
||||||
effAddr = 0;
|
effAddr = 0;
|
||||||
physEffAddr = 0;
|
physEffAddr = 0;
|
||||||
|
|
||||||
|
@ -170,8 +172,14 @@ InOrderDynInst::initVars()
|
||||||
|
|
||||||
InOrderDynInst::~InOrderDynInst()
|
InOrderDynInst::~InOrderDynInst()
|
||||||
{
|
{
|
||||||
if (req) {
|
if (fetchMemReq != 0x0) {
|
||||||
delete req;
|
delete fetchMemReq;
|
||||||
|
fetchMemReq = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataMemReq != 0x0) {
|
||||||
|
delete dataMemReq;
|
||||||
|
dataMemReq = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (traceData) {
|
if (traceData) {
|
||||||
|
|
|
@ -634,7 +634,8 @@ class InOrderDynInst : public FastAlloc, public RefCounted
|
||||||
/** Read Effective Address from instruction & do memory access */
|
/** Read Effective Address from instruction & do memory access */
|
||||||
Fault memAccess();
|
Fault memAccess();
|
||||||
|
|
||||||
RequestPtr memReq;
|
RequestPtr fetchMemReq;
|
||||||
|
RequestPtr dataMemReq;
|
||||||
|
|
||||||
bool memAddrReady;
|
bool memAddrReady;
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,8 @@ CacheUnit::execute(int slot_num)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CompleteFetch:
|
case CompleteFetch:
|
||||||
|
// @TODO: MOVE Functionality of handling fetched data into 'fetch unit'
|
||||||
|
// let cache-unit just be responsible for transferring data.
|
||||||
if (cache_req->isMemAccComplete()) {
|
if (cache_req->isMemAccComplete()) {
|
||||||
DPRINTF(InOrderCachePort,
|
DPRINTF(InOrderCachePort,
|
||||||
"[tid:%i]: Completing Fetch Access for [sn:%i]\n",
|
"[tid:%i]: Completing Fetch Access for [sn:%i]\n",
|
||||||
|
@ -284,6 +286,8 @@ CacheUnit::execute(int slot_num)
|
||||||
inst->traceData->setPC(inst->readPC());
|
inst->traceData->setPC(inst->readPC());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete cache_req->dataPkt;
|
||||||
|
|
||||||
cache_req->done();
|
cache_req->done();
|
||||||
} else {
|
} else {
|
||||||
DPRINTF(InOrderCachePort,
|
DPRINTF(InOrderCachePort,
|
||||||
|
@ -481,6 +485,7 @@ CacheUnit::processCacheCompletion(PacketPtr pkt)
|
||||||
cache_pkt->cacheReq->getInst()->seqNum);
|
cache_pkt->cacheReq->getInst()->seqNum);
|
||||||
|
|
||||||
cache_pkt->cacheReq->done();
|
cache_pkt->cacheReq->done();
|
||||||
|
delete cache_pkt;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,6 +548,8 @@ CacheUnit::processCacheCompletion(PacketPtr pkt)
|
||||||
getMemData(cache_pkt));
|
getMemData(cache_pkt));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete cache_pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_req->setMemAccPending(false);
|
cache_req->setMemAccPending(false);
|
||||||
|
|
|
@ -246,7 +246,13 @@ class CacheRequest : public ResourceRequest
|
||||||
: ResourceRequest(cres, inst, stage_num, res_idx, slot_num, cmd),
|
: ResourceRequest(cres, inst, stage_num, res_idx, slot_num, cmd),
|
||||||
pktCmd(pkt_cmd), memAccComplete(false), memAccPending(false)
|
pktCmd(pkt_cmd), memAccComplete(false), memAccPending(false)
|
||||||
{
|
{
|
||||||
memReq = inst->memReq;
|
if (cmd == CacheUnit::InitiateFetch ||
|
||||||
|
cmd == CacheUnit::CompleteFetch ||
|
||||||
|
cmd == CacheUnit::Fetch) {
|
||||||
|
memReq = inst->fetchMemReq;
|
||||||
|
} else {
|
||||||
|
memReq = inst->dataMemReq;
|
||||||
|
}
|
||||||
|
|
||||||
reqData = new uint8_t[req_size];
|
reqData = new uint8_t[req_size];
|
||||||
retryPkt = NULL;
|
retryPkt = NULL;
|
||||||
|
@ -273,9 +279,6 @@ class CacheRequest : public ResourceRequest
|
||||||
delete retryPkt;
|
delete retryPkt;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (memReq)
|
|
||||||
delete memReq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual PacketDataPtr getData()
|
virtual PacketDataPtr getData()
|
||||||
|
|
|
@ -106,21 +106,22 @@ class TLBUnitRequest : public ResourceRequest {
|
||||||
aligned_addr = inst->getMemAddr();
|
aligned_addr = inst->getMemAddr();
|
||||||
req_size = sizeof(TheISA::MachInst);
|
req_size = sizeof(TheISA::MachInst);
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
inst->fetchMemReq = new Request(inst->readTid(), aligned_addr, req_size,
|
||||||
|
flags, inst->readPC(), res->cpu->readCpuId(), inst->readTid());
|
||||||
|
memReq = inst->fetchMemReq;
|
||||||
} else {
|
} else {
|
||||||
aligned_addr = inst->getMemAddr();;
|
aligned_addr = inst->getMemAddr();;
|
||||||
req_size = inst->getMemAccSize();
|
req_size = inst->getMemAccSize();
|
||||||
flags = inst->getMemFlags();
|
flags = inst->getMemFlags();
|
||||||
}
|
|
||||||
|
|
||||||
if (req_size == 0 && (inst->isDataPrefetch() || inst->isInstPrefetch())) {
|
if (req_size == 0 && (inst->isDataPrefetch() || inst->isInstPrefetch())) {
|
||||||
req_size = 8;
|
req_size = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Add Vaddr & Paddr functions
|
inst->dataMemReq = new Request(inst->readTid(), aligned_addr, req_size,
|
||||||
inst->memReq = new Request(inst->readTid(), aligned_addr, req_size,
|
|
||||||
flags, inst->readPC(), res->cpu->readCpuId(), inst->readTid());
|
flags, inst->readPC(), res->cpu->readCpuId(), inst->readTid());
|
||||||
|
memReq = inst->dataMemReq;
|
||||||
memReq = inst->memReq;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestPtr memReq;
|
RequestPtr memReq;
|
||||||
|
|
Loading…
Reference in a new issue