// Token: 0x17001B5E RID: 7006 internal AccessorInfo this[SourceValueType sourceValueType, Type type, string name] { get { if (type == null || name == null) { return(null); } AccessorInfo accessorInfo = (AccessorInfo)this._table[new AccessorTable.AccessorTableKey(sourceValueType, type, name)]; if (accessorInfo != null) { accessorInfo.Generation = this._generation; } return(accessorInfo); } set { if (type != null && name != null) { value.Generation = this._generation; this._table[new AccessorTable.AccessorTableKey(sourceValueType, type, name)] = value; if (!this._cleanupRequested) { this.RequestCleanup(); } } } }
// map (SourceValueType, type, name) to (accessor, propertyType, args) internal AccessorInfo this[SourceValueType sourceValueType, Type type, string name] { get { if (type == null || name == null) { return(null); } AccessorInfo info = (AccessorInfo)_table[new AccessorTableKey(sourceValueType, type, name)]; if (info != null) { #if DEBUG // record the age of cache hits int age = _generation - info.Generation; if (age >= _ages.Length) { int[] newAges = new int[2 * age]; _ages.CopyTo(newAges, 0); _ages = newAges; } ++_ages[age]; ++_hits; #endif info.Generation = _generation; } #if DEBUG else { ++_misses; } #endif return(info); } set { if (type != null && name != null) { value.Generation = _generation; _table[new AccessorTableKey(sourceValueType, type, name)] = value; if (!_cleanupRequested) { RequestCleanup(); } } } }
// Token: 0x06007348 RID: 29512 RVA: 0x00210EBC File Offset: 0x0020F0BC private object CleanupOperation(object arg) { object[] array = new object[this._table.Count]; int num = 0; IDictionaryEnumerator enumerator = this._table.GetEnumerator(); while (enumerator.MoveNext()) { AccessorInfo accessorInfo = (AccessorInfo)enumerator.Value; int num2 = this._generation - accessorInfo.Generation; if (num2 >= 10) { array[num++] = enumerator.Key; } } for (int i = 0; i < num; i++) { this._table.Remove(array[i]); } this._generation++; this._cleanupRequested = false; return(null); }
// run a cleanup pass private object CleanupOperation(object arg) { // find entries that are sufficiently old object[] keysToRemove = new object[_table.Count]; int n = 0; IDictionaryEnumerator ide = _table.GetEnumerator(); while (ide.MoveNext()) { AccessorInfo info = (AccessorInfo)ide.Value; int age = _generation - info.Generation; if (age >= AgeLimit) { keysToRemove[n++] = ide.Key; } } #if DEBUG if (_traceSize) { Console.WriteLine("After generation {0}, removing {1} of {2} entries from AccessorTable, new count is {3}", _generation, n, _table.Count, _table.Count - n); } #endif // remove those entries for (int i = 0; i < n; ++i) { _table.Remove(keysToRemove[i]); } ++_generation; _cleanupRequested = false; return(null); }