boolean inStack = inStack(); moveToStackTop();
boolean inStack = inStack(); moveToStackTop();
/** * Records a cache hit on a cold block. */ private void coldHit(Set<HashEntry<K, V>> evicted) { // See section 3.3 case 2: // "Upon accessing an HIR resident block X: // This is a hit in the cache." // "We move it to the top of stack S." boolean inStack = inStack(); moveToStackTop(); // "There are two cases for block X:" if ( inStack ) { // "(1) If X is in the stack S, we change its status to LIR." hot(); // "This block is also removed from list Q." removeFromQueue(); // "The LIR block in the bottom of S is moved to the end of list Q // with its status changed to HIR." owner.stackBottom().migrateToQueue(); // "A stack pruning is then conducted." owner.pruneStack( evicted ); } else { // "(2) If X is not in stack S, we leave its status in HIR and move // it to the end of list Q." moveToQueueEnd(); } }
/** * Moves this entry from the queue to the stack, marking it hot (as cold * resident entries must remain in the queue). */ private void migrateToStack() { removeFromQueue(); if ( !inStack() ) { moveToStackBottom(); } hot(); }
/** * Temporarily removes this entry from the stack, fixing up neighbor links. * This entry's links remain unchanged, meaning that {@link #inStack()} will * continue to return true. This should only be called if this node's links * will be subsequently changed. */ private void tempRemoveFromStack() { if ( inStack() ) { previousInStack.nextInStack = nextInStack; nextInStack.previousInStack = previousInStack; } }
/** * Records a cache hit on a cold block. */ private void coldHit(Set<HashEntry<K, V>> evicted) { // See section 3.3 case 2: // "Upon accessing an HIR resident block X: // This is a hit in the cache." // "We move it to the top of stack S." boolean inStack = inStack(); moveToStackTop(); // "There are two cases for block X:" if ( inStack ) { // "(1) If X is in the stack S, we change its status to LIR." hot(); // "This block is also removed from list Q." removeFromQueue(); // "The LIR block in the bottom of S is moved to the end of list Q // with its status changed to HIR." owner.stackBottom().migrateToQueue(); // "A stack pruning is then conducted." owner.pruneStack( evicted ); } else { // "(2) If X is not in stack S, we leave its status in HIR and move // it to the end of list Q." moveToQueueEnd(); } }
/** * Moves this entry from the queue to the stack, marking it hot (as cold * resident entries must remain in the queue). */ private void migrateToStack() { removeFromQueue(); if ( !inStack() ) { moveToStackBottom(); } hot(); }
/** * Temporarily removes this entry from the stack, fixing up neighbor links. * This entry's links remain unchanged, meaning that {@link #inStack()} will * continue to return true. This should only be called if this node's links * will be subsequently changed. */ private void tempRemoveFromStack() { if ( inStack() ) { previousInStack.nextInStack = nextInStack; nextInStack.previousInStack = previousInStack; } }