4 writes to _items
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (4)
src\Compilers\Core\Portable\InternalUtilities\WeakList.cs (4)
22
_items
= Array.Empty<WeakReference<T>>();
67
_items
= newItems;
84
_items
= newItems;
208
_weakList.
_items
= Array.Empty<WeakReference<T>>();
32 references to _items
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (32)
src\Compilers\Core\Portable\InternalUtilities\WeakList.cs (32)
27
Debug.Assert(_size ==
_items
.Length);
28
Debug.Assert(
_items
.Length == 0 ||
_items
.Length >= MinimalNonEmptySize);
30
int alive =
_items
.Length;
32
for (int i = 0; i <
_items
.Length; i++)
34
if (!
_items
[i].TryGetTarget(out _))
45
if (alive <
_items
.Length / 4)
51
else if (alive >= 3 *
_items
.Length / 4)
55
var newItems = new WeakReference<T>[GetExpandedSize(
_items
.Length)];
63
Array.Copy(
_items
, 0, newItems, 0,
_items
.Length);
64
Debug.Assert(_size ==
_items
.Length);
73
Compact(firstDead,
_items
);
76
Debug.Assert(
_items
.Length > 0 && _size < 3 *
_items
.Length / 4, "length: " +
_items
.Length + " size: " + _size);
82
var newItems = (newSize ==
_items
.Length) ?
_items
: new WeakReference<T>[newSize];
95
/// Copies all live references from <see cref="
_items
"/> to <paramref name="result"/>.
100
Debug.Assert(
_items
[firstDead].IsNull());
102
if (!ReferenceEquals(
_items
, result))
104
Array.Copy(
_items
, 0, result, 0, firstDead);
111
var item =
_items
[i];
122
if (ReferenceEquals(
_items
, result))
126
_items
[j++] = null!;
147
return
_items
[index];
152
if (_size ==
_items
.Length)
157
Debug.Assert(_size <
_items
.Length);
158
_items
[_size++] = new WeakReference<T>(item);
188
if (_weakList.
_items
[currentIndex].TryGetTarget(out var item))
211
else if (_alive < _weakList.
_items
.Length / 4)
226
internal WeakReference<T>[] TestOnly_UnderlyingArray { get { return
_items
; } }