Skip to content

Commit f154d65

Browse files
authored
Delete FEATURE_DOUBLE_ALIGNMENT_HINT for GC heap allocations (#115985)
* Delete FEATURE_DOUBLE_ALIGNMENT_HINT for allocations This optimization is no longer relevant on current x86 hardware. The performance penalty for misaligned memory access is negligible compared to what it used to be. Fixes #101284 * Delete tests that are no longer applicable
1 parent 82ef541 commit f154d65

24 files changed

+5
-1092
lines changed

src/coreclr/inc/clrconfigvalues.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,6 @@ CONFIG_DWORD_INFO(INTERNAL_AlwaysUseMetadataInterfaceMapLayout, W("AlwaysUseMeta
749749
CONFIG_DWORD_INFO(INTERNAL_AssertOnUnneededThis, W("AssertOnUnneededThis"), 0, "While the ConfigDWORD is unnecessary, the contained ASSERT should be kept. This may result in some work tracking down violating MethodDescCallSites.")
750750
CONFIG_DWORD_INFO(INTERNAL_AssertStacktrace, W("AssertStacktrace"), 1, "")
751751
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DisableConfigCache, W("DisableConfigCache"), 0, "Used to disable the \"probabilistic\" config cache, which walks through the appropriate config registry keys on init and probabilistically keeps track of which exist.")
752-
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DoubleArrayToLargeObjectHeap, W("DoubleArrayToLargeObjectHeap"), 0, "Controls double[] placement")
753752
CONFIG_STRING_INFO(INTERNAL_DumpOnClassLoad, W("DumpOnClassLoad"), "Dumps information about loaded class to log.")
754753
CONFIG_DWORD_INFO(INTERNAL_ExpandAllOnLoad, W("ExpandAllOnLoad"), 0, "")
755754
CONFIG_DWORD_INFO(INTERNAL_ForceRelocs, W("ForceRelocs"), 0, "")

src/coreclr/inc/switches.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@
151151
#define FEATURE_64BIT_ALIGNMENT
152152
#endif
153153

154-
// Prefer double alignment for structs and arrays with doubles. Put arrays of doubles more agressively
155-
// into large object heap for performance because large object heap is 8 byte aligned
154+
// Prefer double alignment for structs with doubles on the stack.
156155
#if !defined(FEATURE_64BIT_ALIGNMENT) && !defined(HOST_64BIT)
157156
#define FEATURE_DOUBLE_ALIGNMENT_HINT
158157
#endif

src/coreclr/vm/eeconfig.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ HRESULT EEConfig::Init()
173173
fConditionalContracts = false;
174174
#endif
175175

176-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
177-
DoubleArrayToLargeObjectHeapThreshold = 1000;
178-
#endif
179-
180176
#ifdef _DEBUG
181177
// interop logging
182178
m_TraceWrapper = 0;
@@ -468,10 +464,6 @@ HRESULT EEConfig::sync()
468464
}
469465
#endif // defined(FEATURE_READYTORUN)
470466

471-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
472-
DoubleArrayToLargeObjectHeapThreshold = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DoubleArrayToLargeObjectHeap, DoubleArrayToLargeObjectHeapThreshold);
473-
#endif
474-
475467
#ifdef _DEBUG
476468
IfFailRet (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_BreakOnClassLoad, (LPWSTR*) &pszBreakOnClassLoad));
477469
pszBreakOnClassLoad = NarrowWideChar((LPWSTR)pszBreakOnClassLoad);

src/coreclr/vm/eeconfig.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,6 @@ class EEConfig
299299
bool ExpandModulesOnLoad(void) const { LIMITED_METHOD_CONTRACT; return fExpandAllOnLoad; }
300300
#endif //_DEBUG
301301

302-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
303-
// Because the large object heap is 8 byte aligned, we want to put
304-
// arrays of doubles there more agressively than normal objects.
305-
// This is the threshold for this. It is the number of doubles,
306-
// not the number of bytes in the array.
307-
unsigned int GetDoubleArrayToLargeObjectHeapThreshold() const { LIMITED_METHOD_CONTRACT; return DoubleArrayToLargeObjectHeapThreshold; }
308-
#endif
309-
310302
#ifdef TEST_DATA_CONSISTENCY
311303
// get the value of fTestDataConsistency, which controls whether we test that we can correctly detect
312304
// held locks in DAC builds. This is determined by an environment variable.
@@ -517,10 +509,6 @@ class EEConfig
517509
bool m_fBuiltInCOMInteropSupported; // COM built-in support
518510
#endif // FEATURE_COMINTEROP
519511

520-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
521-
unsigned int DoubleArrayToLargeObjectHeapThreshold; // double arrays of more than this number of elems go in large object heap
522-
#endif
523-
524512
#ifdef _DEBUG
525513
bool fExpandAllOnLoad; // True if we want to load all types/jit all methods in an assembly
526514
// at load time.

src/coreclr/vm/gchelpers.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,6 @@ OBJECTREF AllocateSzArray(MethodTable* pArrayMT, INT32 cElements, GC_ALLOC_FLAGS
510510
size_t totalSize = safeTotalSize.Value();
511511
#endif
512512

513-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
514-
if ((pArrayMT->GetArrayElementTypeHandle() == CoreLibBinder::GetElementType(ELEMENT_TYPE_R8)) &&
515-
((DWORD)cElements >= g_pConfig->GetDoubleArrayToLargeObjectHeapThreshold()))
516-
{
517-
STRESS_LOG2(LF_GC, LL_INFO10, "Allocating double MD array of size %d and length %d to large object heap\n", totalSize, cElements);
518-
flags |= GC_ALLOC_LARGE_OBJECT_HEAP;
519-
}
520-
#endif
521-
522513
if (totalSize >= LARGE_OBJECT_SIZE && totalSize >= GCHeapUtilities::GetGCHeap()->GetLOHThreshold())
523514
flags |= GC_ALLOC_LARGE_OBJECT_HEAP;
524515

@@ -533,12 +524,6 @@ OBJECTREF AllocateSzArray(MethodTable* pArrayMT, INT32 cElements, GC_ALLOC_FLAGS
533524
}
534525
else
535526
{
536-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
537-
if (pArrayMT->GetArrayElementTypeHandle() == CoreLibBinder::GetElementType(ELEMENT_TYPE_R8))
538-
{
539-
flags |= GC_ALLOC_ALIGN8;
540-
}
541-
#endif
542527
#ifdef FEATURE_64BIT_ALIGNMENT
543528
MethodTable* pElementMT = pArrayMT->GetArrayElementTypeHandle().GetMethodTable();
544529
if (pElementMT->RequiresAlign8() && pElementMT->IsValueType())
@@ -773,15 +758,6 @@ OBJECTREF AllocateArrayEx(MethodTable *pArrayMT, INT32 *pArgs, DWORD dwNumArgs,
773758
size_t totalSize = safeTotalSize.Value();
774759
#endif
775760

776-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
777-
if ((pArrayMT->GetArrayElementTypeHandle() == CoreLibBinder::GetElementType(ELEMENT_TYPE_R8)) &&
778-
(cElements >= g_pConfig->GetDoubleArrayToLargeObjectHeapThreshold()))
779-
{
780-
STRESS_LOG2(LF_GC, LL_INFO10, "Allocating double MD array of size %d and length %d to large object heap\n", totalSize, cElements);
781-
flags |= GC_ALLOC_LARGE_OBJECT_HEAP;
782-
}
783-
#endif
784-
785761
if (totalSize >= LARGE_OBJECT_SIZE && totalSize >= GCHeapUtilities::GetGCHeap()->GetLOHThreshold())
786762
flags |= GC_ALLOC_LARGE_OBJECT_HEAP;
787763

src/coreclr/vm/i386/jitinterfacex86.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,8 @@ void *JIT_TrialAlloc::GenAllocArray(Flags flags)
407407
// array header or alignment.
408408
sl.Emit16(0xfa81);
409409

410-
411-
// The large object heap is 8 byte aligned, so for double arrays we
412-
// want to bias toward putting things in the large object heap
413410
unsigned maxElems = 0xffff - 256;
414411

415-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
416-
if ((flags & ALIGN8) && g_pConfig->GetDoubleArrayToLargeObjectHeapThreshold() < maxElems)
417-
maxElems = g_pConfig->GetDoubleArrayToLargeObjectHeapThreshold();
418-
#endif // FEATURE_DOUBLE_ALIGNMENT_HINT
419412
if (flags & OBJ_ARRAY)
420413
{
421414
//Since we know that the array elements are sizeof(OBJECTREF), set maxElems exactly here (use the

src/coreclr/vm/jitinterface.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5701,16 +5701,6 @@ CorInfoHelpFunc CEEInfo::getNewHelperStatic(MethodTable * pMT, bool * pHasSideEf
57015701
helper = CORINFO_HELP_NEWSFAST;
57025702
}
57035703

5704-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
5705-
// If we are use the fast allocator we also may need the
5706-
// specialized varion for align8
5707-
if (pMT->GetClass()->IsAlign8Candidate() &&
5708-
(helper == CORINFO_HELP_NEWSFAST))
5709-
{
5710-
helper = CORINFO_HELP_NEWSFAST_ALIGN8;
5711-
}
5712-
#endif // FEATURE_DOUBLE_ALIGNMENT_HINT
5713-
57145704
return helper;
57155705
}
57165706

@@ -5788,13 +5778,6 @@ CorInfoHelpFunc CEEInfo::getNewArrHelperStatic(TypeHandle clsHnd)
57885778
// Use the slow helper
57895779
result = CORINFO_HELP_NEWARR_1_DIRECT;
57905780
}
5791-
#ifdef FEATURE_DOUBLE_ALIGNMENT_HINT
5792-
else if (elemType == ELEMENT_TYPE_R8)
5793-
{
5794-
// Use the Align8 fast helper
5795-
result = CORINFO_HELP_NEWARR_1_ALIGN8;
5796-
}
5797-
#endif
57985781
else
57995782
{
58005783
// Yea, we can do it the fast way!

src/tests/JIT/Methodical/Methodical_d1.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@
7777
<Compile Include="divrem\rem\r8rem.cs" />
7878
<Compile Include="divrem\rem\u4rem.cs" />
7979
<Compile Include="divrem\rem\u8rem.cs" />
80-
<Compile Include="doublearray\dblarray1.cs" />
81-
<Compile Include="doublearray\dblarray2.cs" />
82-
<Compile Include="doublearray\dblarray3.cs" />
8380
<Compile Include="eh\basics\multihandler.cs" />
8481
<Compile Include="eh\basics\throwincatch.cs" />
8582
<Compile Include="eh\basics\throwinclassconstructor.cs" />
@@ -160,4 +157,4 @@
160157
<Compile Include="explicit\rotate\rotarg_valref.cs" />
161158
</ItemGroup>
162159
<Import Project="$(TestSourceDir)MergedTestRunner.targets" />
163-
</Project>
160+
</Project>

src/tests/JIT/Methodical/Methodical_do.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@
7373
<Compile Include="divrem\rem\r8rem.cs" />
7474
<Compile Include="divrem\rem\u4rem.cs" />
7575
<Compile Include="divrem\rem\u8rem.cs" />
76-
<Compile Include="doublearray\dblarray1.cs" />
77-
<Compile Include="doublearray\dblarray2.cs" />
78-
<Compile Include="doublearray\dblarray3.cs" />
7976
<Compile Include="eh\basics\multihandler.cs" />
8077
<Compile Include="eh\basics\throwincatch.cs" />
8178
<Compile Include="eh\basics\throwinclassconstructor.cs" />
@@ -284,4 +281,4 @@
284281
<Compile Include="xxobj\sizeof\sizeof64.cs" />
285282
</ItemGroup>
286283
<Import Project="$(TestSourceDir)MergedTestRunner.targets" />
287-
</Project>
284+
</Project>

src/tests/JIT/Methodical/Methodical_r1.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@
7878
<Compile Include="divrem\rem\r8rem.cs" />
7979
<Compile Include="divrem\rem\u4rem.cs" />
8080
<Compile Include="divrem\rem\u8rem.cs" />
81-
<Compile Include="doublearray\dblarray1.cs" />
82-
<Compile Include="doublearray\dblarray2.cs" />
83-
<Compile Include="doublearray\dblarray3.cs" />
8481
<Compile Include="eh\basics\multihandler.cs" />
8582
<Compile Include="eh\basics\throwincatch.cs" />
8683
<Compile Include="eh\basics\throwinclassconstructor.cs" />
@@ -161,4 +158,4 @@
161158
<Compile Include="explicit\rotate\rotarg_valref.cs" />
162159
</ItemGroup>
163160
<Import Project="$(TestSourceDir)MergedTestRunner.targets" />
164-
</Project>
161+
</Project>

src/tests/JIT/Methodical/Methodical_ro.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@
7373
<Compile Include="divrem\rem\r8rem.cs" />
7474
<Compile Include="divrem\rem\u4rem.cs" />
7575
<Compile Include="divrem\rem\u8rem.cs" />
76-
<Compile Include="doublearray\dblarray1.cs" />
77-
<Compile Include="doublearray\dblarray2.cs" />
78-
<Compile Include="doublearray\dblarray3.cs" />
7976
<Compile Include="eh\basics\multihandler.cs" />
8077
<Compile Include="eh\basics\throwincatch.cs" />
8178
<Compile Include="eh\basics\throwinclassconstructor.cs" />
@@ -284,4 +281,4 @@
284281
<Compile Include="xxobj\sizeof\sizeof64.cs" />
285282
</ItemGroup>
286283
<Import Project="$(TestSourceDir)MergedTestRunner.targets" />
287-
</Project>
284+
</Project>

src/tests/JIT/Methodical/doublearray/dblarray1.cs

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

0 commit comments

Comments
 (0)