Skip to content

Commit d853806

Browse files
paulirwinclaude
andcommitted
Remove dead ConcurrentDictionaryExtensions; rename memory-barrier feature flag
Delete ConcurrentDictionaryExtensions (TryRemove(KeyValuePair)) - it was added during early MMap PR feedback for a ConcurrentDictionary-based mapping registry that was replaced by SharedMapping/DrainReclaimer, and now has zero usages. Also drop its companion gate FEATURE_CONCURRENTDICTIONARY_TRYREMOVE_KEYVALUEPAIR (new in this PR, used nowhere else). Rename FEATURE_MEMORYBARRIER_PROCESSWIDE -> FEATURE_INTERLOCKED_MEMORYBARRIERPROCESSWIDE to match the FEATURE_<TYPE>_<MEMBER> convention (the API is Interlocked.MemoryBarrierProcessWide), like FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR / FEATURE_STREAM_READEXACTLY. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a9c7562 commit d853806

3 files changed

Lines changed: 3 additions & 43 deletions

File tree

Directory.Build.targets

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
<!-- Features in .NET 5.x+ only -->
7676
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) Or $(TargetFramework.StartsWith('net9.')) Or $(TargetFramework.StartsWith('net10.')) ">
7777

78-
<DefineConstants>$(DefineConstants);FEATURE_CONCURRENTDICTIONARY_TRYREMOVE_KEYVALUEPAIR</DefineConstants>
7978
<DefineConstants>$(DefineConstants);FEATURE_MEMORYMARSHAL_GETARRAYDATAREFERENCE</DefineConstants>
8079
<DefineConstants>$(DefineConstants);FEATURE_READONLYSET</DefineConstants>
8180
<!-- CompareInfo.GetSortKey(ReadOnlySpan<char>, Span<byte>, CompareOptions) and GetSortKeyLength(ReadOnlySpan<char>, CompareOptions) -->
@@ -108,7 +107,7 @@
108107
<DefineConstants>$(DefineConstants);FEATURE_CONDITIONALWEAKTABLE_ADDORUPDATE</DefineConstants>
109108
<DefineConstants>$(DefineConstants);FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR</DefineConstants>
110109
<DefineConstants>$(DefineConstants);FEATURE_ENCODING_GETSTRING_READONLYSPAN</DefineConstants>
111-
<DefineConstants>$(DefineConstants);FEATURE_MEMORYBARRIER_PROCESSWIDE</DefineConstants>
110+
<DefineConstants>$(DefineConstants);FEATURE_INTERLOCKED_MEMORYBARRIERPROCESSWIDE</DefineConstants>
112111
<DefineConstants>$(DefineConstants);FEATURE_MEMORYMARSHAL_CREATEREADONLYSPAN</DefineConstants>
113112
<DefineConstants>$(DefineConstants);FEATURE_NUMBER_PARSE_READONLYSPAN</DefineConstants>
114113
<DefineConstants>$(DefineConstants);FEATURE_QUEUE_TRYDEQUEUE_TRYPEEK</DefineConstants>

src/Lucene.Net/Support/ConcurrentDictionaryExtensions.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/Lucene.Net/Support/DrainReclaimer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public ReadScope Enter()
105105
[MethodImpl(MethodImplOptions.AggressiveInlining)]
106106
public void EnterCore()
107107
{
108-
#if FEATURE_MEMORYBARRIER_PROCESSWIDE
108+
#if FEATURE_INTERLOCKED_MEMORYBARRIERPROCESSWIDE
109109
// Asymmetric fencing: NO StoreLoad barrier on the hot path. Announce
110110
// with a plain store (this slot is reader-private) then read _closed
111111
// plain. The store and read may reorder on this core, but Close issues
@@ -225,7 +225,7 @@ public void Close(Action unmap)
225225
// used by hazard-pointer reclamation and the JVM's shared Arena). Without a
226226
// process-wide barrier the hot path fences per read instead (see Enter), so
227227
// a plain barrier here suffices to pair with it.
228-
#if FEATURE_MEMORYBARRIER_PROCESSWIDE
228+
#if FEATURE_INTERLOCKED_MEMORYBARRIERPROCESSWIDE
229229
Interlocked.MemoryBarrierProcessWide();
230230
#else
231231
Interlocked.MemoryBarrier();

0 commit comments

Comments
 (0)