bool FrSymbol::isLocked() const { FrFrame *fr = find_vframe_inline(this) ; if (fr) return fr->isLocked() ; else if (VFrame_Info) return VFrame_Info->isLocked(this) ; else return false ; }
static bool discard_clean_frame(const FrObject *obj, va_list args) { FrVarArg(uint32_t,thres) ; FrVarArg(int *,discarded) ; FrFrame *frame = ((FrSymbol*)obj)->symbolFrame() ; // throw out the current frame if it is a clean virtual frame last used // before the threshold value of the clock if (frame && frame->isVFrame() && !frame->isLocked() && !frame->dirtyFrame() && frame->getLRUclock() < thres) { frame->discard() ; // discard the frame (*discarded)++ ; } return true ; }
bool FrSymbol::unlockFrame() { FrFrame *fr = symbolFrame() ; // don't use find_vframe above, to avoid pulling in frame if not already // in memory if (fr && fr->isLocked() && VFrame_Info) { if (VFrame_Info->unlockFrame(this)) fr->setLock(false) ; else return false ; } return true ; }
FrFrame *FrSymbol::lockFrame() { FrFrame *fr = find_vframe_inline(this) ; if (fr && !fr->isLocked() && VFrame_Info) { if (VFrame_Info->lockFrame(this)) fr->setLock(true) ; else { FrWarningVA("unable to lock frame %s",symbolName()) ; return 0 ; } } return fr ; }
static bool discard_dirty_frame(const FrObject *obj, va_list args) { FrVarArg(uint32_t,thres) ; FrVarArg(int *,discarded) ; FrFrame *frame = ((FrSymbol*)obj)->symbolFrame() ; // throw out any and all unlocked virtual frames, even if dirty, that were // last used before the threshold value of the clock if (frame && frame->isVFrame() && !frame->isLocked() && frame->getLRUclock() < thres) { if (frame->dirtyFrame()) frame->frameName()->commitFrame() ; frame->discard() ; // discard the frame (*discarded)++ ; } return true ; }