Skip to content

Commit

Permalink
Revert workarounds for dotnet/linker#2181 (#57451)
Browse files Browse the repository at this point in the history
* Revert workarounds for dotnet/linker#2181

Trying to revert both.
The Http3RequestStream is definitely fixed by the linker changes.
The ArrayPool ones probably not, but trying to get a repro.

* Fully revert ArrayPool workaround
  • Loading branch information
vitek-karas authored Aug 20, 2021
1 parent c5f5b99 commit f53c8dc
Showing 1 changed file with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,14 @@ public bool Trim()
// Under high pressure, release all thread locals.
if (pressure == Utilities.MemoryPressure.High)
{
#if !MONO // TODO https://github.com/mono/linker/issues/2181: Remove !MONO ifdefs in this method once is fixed
if (log.IsEnabled())
if (!log.IsEnabled())
{
foreach (KeyValuePair<ThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets)
{
Array.Clear(tlsBuckets.Key);
}
}
else
{
foreach (KeyValuePair<ThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets)
{
Expand All @@ -226,14 +232,6 @@ public bool Trim()
}
}
}
else
#endif
{
foreach (KeyValuePair<ThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets)
{
Array.Clear(tlsBuckets.Key);
}
}
}
else
{
Expand Down Expand Up @@ -268,14 +266,10 @@ public bool Trim()
{
// Time noticeably wrapped, or we've surpassed the threshold.
// Clear out the array, and log its being trimmed if desired.
if (Interlocked.Exchange(ref buckets[i].Array, null) is T[] buffer)
if (Interlocked.Exchange(ref buckets[i].Array, null) is T[] buffer &&
log.IsEnabled())
{
#if !MONO
if (log.IsEnabled())
{
log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
}
#endif
log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
}
}
}
Expand Down

0 comments on commit f53c8dc

Please # to comment.