DInst *DInst::clone() { #if (defined MIPS_EMUL) DInst *newDInst = createDInst(inst, vaddr, cId, context); #else #if (defined TLS) DInst *newDInst = createDInst(inst, vaddr, cId, myEpoch); #else DInst *newDInst = createDInst(inst, vaddr, cId); #endif // Else of (defined TLS) #endif // Else of (defined MIPS_EMUL) #ifdef TASKSCALAR // setting the LVID for the cloned instruction // this will call incOutsReqs for the HVersion. newDInst->setLVID(lvid, lvidVersion); #endif #ifdef SESC_BAAD I(0); #endif return newDInst; }
void FetchEngine::realFetch(IBucket *bucket, int fetchMax) { int n2Fetched=fetchMax > 0 ? fetchMax : FetchWidth; maxBB = BB4Cycle; // Reset the max number of BB to fetch in this cycle (decreased in processBranch) // This method only can be called once per cycle or the restriction of the // BB4Cycle would not enforced I(pid>=0); I(maxBB>0); I(bucket->empty()); I(missInstID==0); Pid_t myPid = flow.currentPid(); #ifdef TASKSCALAR TaskContext *tc = TaskContext::getTaskContext(myPid); I(tc); GLVID *lvid = gms->findCreateLVID(tc->getVersion()); if (lvid==0) { // Not enough LVIDs. Stall fetch I(missInstID==0); nDelayInst2.add(n2Fetched); return; } HVersion *lvidVersion = tc->getVersion(); // no duplicate #endif do { nGradInsts++; // Before executePC because it can trigger a context switch DInst *dinst = flow.executePC(); if (dinst == 0) break; // If we are stalled, then this instruction will issue again so we do not // want to count this one #if (defined TM) if(transGCM->checkStall(myPid)) { delete(dinst); dinst==0; break; } else tmReport->registerTransInstAbort(myPid,dinst->transType); #endif #ifdef TASKSCALAR dinst->setLVID(lvid, lvidVersion); #endif //TASKSCALAR const Instruction *inst = dinst->getInst(); #if !(defined MIPS_EMUL) if (inst->isStore()) { #if (defined TLS) dinst->getEpoch()->pendInstr(); dinst->getEpoch()->execInstr(); #endif // (defined TLS) } #endif // For !(defined MIPS_EMUL) instFetched(dinst); bucket->push(dinst); #ifdef XACTION gproc->getXactionManager()->dinstFetch(dinst); #endif n2Fetched--; bbSize++; fbSize++; if(inst->isBranch()) { szBB.sample(bbSize); bbSize=0; if (!processBranch(dinst, n2Fetched)) { break; } } }while(n2Fetched>0 && flow.currentPid()==myPid); #ifdef TASKSCALAR if (!bucket->empty()) lvid->garbageCollect(); #endif ushort tmp = FetchWidth - n2Fetched; totalnInst+=tmp; if( totalnInst >= nInst2Sim ) { MSG("stopSimulation at %lld (%lld)",totalnInst, nInst2Sim); osSim->stopSimulation(); } nFetched.add(tmp); }