private void ReadRequestUpdownFinish(CoherentCacheNode source, uint @set, uint way, DirectoryLock dirLock, ref uint pending, Action<bool, bool> onCompletedCallback) { pending--; if (pending == 0) { DirectoryEntry dirEntry = this.Cache.Directory.Entries[(int)@set][(int)way]; if (dirEntry.Owner != null && dirEntry.Owner != source) { dirEntry.Owner = null; } dirEntry.SetSharer (source); if (!dirEntry.IsShared) { dirEntry.Owner = source; } this.Cache.AccessLine (@set, way); dirLock.Unlock (); this.Schedule (() => onCompletedCallback (false, dirEntry.IsShared), 2); } }
private void WriteRequestUpdownFinish(CoherentCacheNode source, bool hasError, uint @set, uint way, uint tag, MESIState state, DirectoryLock dirLock, Action<bool> onCompletedCallback) { if (!hasError) { DirectoryEntry dirEntry = this.Cache.Directory.Entries[(int)@set][(int)way]; dirEntry.SetSharer (source); dirEntry.Owner = source; this.Cache.AccessLine (@set, way); if (state != MESIState.Modified) { this.Cache.SetLine (@set, way, tag, MESIState.Exclusive); } dirLock.Unlock (); this.Schedule (() => onCompletedCallback (false), 2); } else { dirLock.Unlock (); this.Schedule (() => onCompletedCallback (true), 2); } }
private void ReadRequestUpdown(CoherentCacheNode source, uint @set, uint way, uint tag, MESIState state, DirectoryLock dirLock, Action<bool, bool> onCompletedCallback) { uint pending = 1; if (state != MESIState.Invalid) { DirectoryEntry dirEntry = this.Cache.Directory.Entries[(int)@set][(int)way]; if (dirEntry.Owner != null && dirEntry.Owner != source) { pending++; this.ReadRequest (dirEntry.Owner, tag, (hasError, isShared) => this.ReadRequestUpdownFinish (source, @set, way, dirLock, ref pending, onCompletedCallback)); } this.ReadRequestUpdownFinish (source, @set, way, dirLock, ref pending, onCompletedCallback); } else { this.ReadRequest (this.Next, tag, (hasError, isShared) => { if (!hasError) { this.Cache.SetLine (@set, way, tag, isShared ? MESIState.Shared : MESIState.Exclusive); this.ReadRequestUpdownFinish (source, @set, way, dirLock, ref pending, onCompletedCallback); } else { dirLock.Unlock (); this.Schedule (() => onCompletedCallback (true, false), 2); } }); } }
private void ReadRequestDownupFinish(uint @set, uint way, uint tag, DirectoryLock dirLock, ref uint pending, Action<bool, bool> onCompletedCallback) { pending--; if (pending == 0) { DirectoryEntry dirEntry = this.Cache.Directory.Entries[(int)@set][(int)way]; dirEntry.Owner = null; this.Cache.SetLine (@set, way, tag, MESIState.Shared); this.Cache.AccessLine (@set, way); dirLock.Unlock (); this.Schedule (() => onCompletedCallback (false, false), 2); } }
private void ReadRequestDownup(uint @set, uint way, uint tag, DirectoryLock dirLock, Action<bool, bool> onCompletedCallback) { uint pending = 1; DirectoryEntry dirEntry = this.Cache.Directory.Entries[(int)@set][(int)way]; if (dirEntry.Owner != null) { pending++; this.ReadRequest (dirEntry.Owner, tag, (hasError, isShared) => this.ReadRequestDownupFinish (@set, way, tag, dirLock, ref pending, onCompletedCallback)); } this.ReadRequestDownupFinish (@set, way, tag, dirLock, ref pending, onCompletedCallback); }
private void EvictWritebackFinish(CoherentCacheNode source, bool hasError, uint @set, uint way, uint tag, DirectoryLock dirLock, Action<bool> onReceiveReplyCallback) { if (!hasError) { this.Cache.SetLine (@set, way, tag, MESIState.Modified); this.Cache.AccessLine (@set, way); this.EvictProcess (source, @set, way, dirLock, onReceiveReplyCallback); } else { dirLock.Unlock (); onReceiveReplyCallback (true); } }
private void EvictProcess(CoherentCacheNode source, uint @set, uint way, DirectoryLock dirLock, Action<bool> onReceiveReplyCallback) { DirectoryEntry dirEntry = this.Cache.Directory.Entries[(int)@set][(int)way]; dirEntry.UnsetSharer (source); if (dirEntry.Owner == source) { dirEntry.Owner = null; } dirLock.Unlock (); onReceiveReplyCallback (false); }