return (status & BlkValid) != 0;
}
+ /**
+ * Invalidate the block and clear all state.
+ */
+ void invalidate()
+ {
+ status = 0;
+ isTouched = false;
+ clearLoadLocks();
+ }
+
/**
* Check to see if a block has been written.
* @return True if the block is dirty.
pkt->assertMemInhibit();
}
// on ReadExReq we give up our copy unconditionally
- tags->invalidateBlk(blk);
+ assert(blk != tempBlock);
+ tags->invalidate(blk);
+ blk->invalidate();
} else if (blk->isWritable() && !pending_downgrade
&& !pkt->sharedAsserted() && !pkt->req->isInstFetch()) {
// we can give the requester an exclusive copy (by not
// to just ack those as long as we have an exclusive
// copy at this level.
assert(pkt->isUpgrade());
- tags->invalidateBlk(blk);
+ assert(blk != tempBlock);
+ tags->invalidate(blk);
+ blk->invalidate();
}
}
} else if (pkt->isWrite()) {
blk = tags->findBlock(pkt->getAddr());
if (blk != NULL) {
- tags->invalidateBlk(blk);
+ tags->invalidate(blk);
+ blk->invalidate();
}
}
} else if (pkt->isWrite()) {
BlkType *blk = tags->findBlock(pkt->getAddr());
if (blk != NULL) {
- tags->invalidateBlk(blk);
+ tags->invalidate(blk);
+ blk->invalidate();
}
}
if (pkt->isInvalidate()) {
BlkType *blk = tags->findBlock(pkt->getAddr());
if (blk && blk->isValid()) {
- tags->invalidateBlk(blk);
+ tags->invalidate(blk);
+ blk->invalidate();
DPRINTF(Cache, "rcvd mem-inhibited %s on 0x%x: invalidating\n",
pkt->cmdString(), pkt->getAddr());
}
mshr->popTarget();
}
- if (blk) {
+ if (blk && blk->isValid()) {
if (pkt->isInvalidate() || mshr->hasPostInvalidate()) {
- tags->invalidateBlk(blk);
+ assert(blk != tempBlock);
+ tags->invalidate(blk);
+ blk->invalidate();
} else if (mshr->hasPostDowngrade()) {
blk->status &= ~BlkWritable;
}
if (blk->isDirty()) {
allocateWriteBuffer(writebackBlk(blk), time, true);
}
- blk->status &= ~BlkValid;
- tags->invalidateBlk(blk);
+ blk->invalidate();
}
delete pkt;
tags->insertBlock(pkt->getAddr(), blk, id);
}
- // starting from scratch with a new block
- blk->status = 0;
+ // we should never be overwriting a valid block
+ assert(!blk->isValid());
} else {
// existing block... probably an upgrade
assert(blk->tag == tags->extractTag(addr));
// Do this last in case it deallocates block data or something
// like that
if (invalidate) {
- tags->invalidateBlk(blk);
+ assert(blk != tempBlock);
+ tags->invalidate(blk);
+ blk->invalidate();
}
}
}
void
-FALRU::invalidateBlk(FALRU::BlkType *blk)
+FALRU::invalidate(FALRU::BlkType *blk)
{
- if (blk) {
- blk->status = 0;
- blk->isTouched = false;
- tagsInUse--;
- }
+ assert(blk);
+ tagsInUse--;
}
FALRUBlk*
* Invalidate a cache block.
* @param blk The block to invalidate.
*/
- void invalidateBlk(BlkType *blk);
+ void invalidate(BlkType *blk);
/**
* Access block and update replacement data. May not succeed, in which case
}
void
-IIC::invalidateBlk(IIC::BlkType *tag_ptr)
+IIC::invalidate(IIC::BlkType *tag_ptr)
{
if (tag_ptr) {
for (int i = 0; i < tag_ptr->numData; ++i) {
* Invalidate a block.
* @param blk The block to invalidate.
*/
- void invalidateBlk(BlkType *blk);
+ void invalidate(BlkType *blk);
/**
* Access block and update replacement data. May not succeed, in which case
++blkIndex;
// invalidate new cache block
- blk->status = 0;
+ blk->invalidate();
//EGH Fix Me : do we need to initialize blk?
// deal with evicted block
assert(blk->srcMasterId < cache->system->maxMasters());
occupancies[blk->srcMasterId]--;
+
+ blk->invalidate();
}
+ blk->isTouched = true;
// Set tag for new block. Caller is responsible for setting status.
blk->tag = extractTag(addr);
}
void
-LRU::invalidateBlk(BlkType *blk)
+LRU::invalidate(BlkType *blk)
{
- if (blk) {
- if (blk->isValid()) {
- tagsInUse--;
- assert(blk->srcMasterId < cache->system->maxMasters());
- occupancies[blk->srcMasterId]--;
- blk->srcMasterId = Request::invldMasterId;
- }
- blk->status = 0;
- blk->isTouched = false;
- blk->clearLoadLocks();
-
- // should be evicted before valid blocks
- unsigned set = blk->set;
- sets[set].moveToTail(blk);
- }
+ assert(blk);
+ assert(blk->isValid());
+ tagsInUse--;
+ assert(blk->srcMasterId < cache->system->maxMasters());
+ occupancies[blk->srcMasterId]--;
+ blk->srcMasterId = Request::invldMasterId;
+
+ // should be evicted before valid blocks
+ unsigned set = blk->set;
+ sets[set].moveToTail(blk);
}
void
* Invalidate the given block.
* @param blk The block to invalidate.
*/
- void invalidateBlk(BlkType *blk);
+ void invalidate(BlkType *blk);
/**
* Access block and update replacement data. May not succeed, in which case