Skip to content

Commit 1400c1e

Browse files
authored
Cleanup ifdefs (#99511)
- Delete unused defines - Fix logic around funclet related ifdefs in a few places
1 parent af0634e commit 1400c1e

19 files changed

+37
-80
lines changed

src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@
206206
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.CoreCLR.cs" />
207207
<Compile Include="$(BclSourcesRoot)\System\Runtime\ControlledExecution.CoreCLR.cs" />
208208
<Compile Include="$(BclSourcesRoot)\System\Runtime\DependentHandle.cs" />
209-
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Common\src\System\Runtime\RhFailFastReason.cs" Condition="('$(Platform)' != 'x86' or '$(TargetsWindows)' != 'true')" />
210-
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Runtime.Base\src\System\Runtime\ExceptionHandling.cs" Condition="('$(Platform)' != 'x86' or '$(TargetsWindows)' != 'true')" />
211-
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Runtime.Base\src\System\Runtime\ExceptionIDs.cs" Condition="('$(Platform)' != 'x86' or '$(TargetsWindows)' != 'true')" />
212-
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Runtime.Base\src\System\Runtime\StackFrameIterator.cs" Condition="('$(Platform)' != 'x86' or '$(TargetsWindows)' != 'true')" />
213-
<Compile Include="$(BclSourcesRoot)\System\Runtime\ExceptionServices\AsmOffsets.cs" Condition="('$(Platform)' != 'x86' or '$(TargetsWindows)' != 'true')" />
214-
<Compile Include="$(BclSourcesRoot)\System\Runtime\ExceptionServices\InternalCalls.cs" Condition="('$(Platform)' != 'x86' or '$(TargetsWindows)' != 'true')" />
209+
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Common\src\System\Runtime\RhFailFastReason.cs" />
210+
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Runtime.Base\src\System\Runtime\ExceptionHandling.cs" />
211+
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Runtime.Base\src\System\Runtime\ExceptionIDs.cs" />
212+
<Compile Include="$(MSBuildThisFileDirectory)..\nativeaot\Runtime.Base\src\System\Runtime\StackFrameIterator.cs" />
213+
<Compile Include="$(BclSourcesRoot)\System\Runtime\ExceptionServices\AsmOffsets.cs" />
214+
<Compile Include="$(BclSourcesRoot)\System\Runtime\ExceptionServices\InternalCalls.cs" />
215215
<Compile Include="$(BclSourcesRoot)\System\Runtime\GCSettings.CoreCLR.cs" />
216216
<Compile Include="$(BclSourcesRoot)\System\Runtime\JitInfo.CoreCLR.cs" />
217217
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\ComTypes\IEnumerable.cs" />

src/coreclr/clr.featuredefines.props

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,26 @@
11
<Project>
22
<PropertyGroup>
33
<FeatureCoreCLR>true</FeatureCoreCLR>
4-
<FeatureCollectibleALC>true</FeatureCollectibleALC>
54
<FeatureEventTrace>true</FeatureEventTrace>
65
<FeatureICastable>true</FeatureICastable>
76
<FeaturePerfTracing>true</FeaturePerfTracing>
87
<FeatureTypeEquivalence>true</FeatureTypeEquivalence>
9-
<FeatureBasicFreeze>true</FeatureBasicFreeze>
108
<ProfilingSupportedBuild>true</ProfilingSupportedBuild>
119
</PropertyGroup>
1210

1311
<PropertyGroup Condition="'$(TargetsUnix)' == 'true'">
1412
<FeatureXplatEventSource Condition="'$(TargetOS)' == 'linux'">true</FeatureXplatEventSource>
15-
1613
<FeatureArrayStubAsIL>true</FeatureArrayStubAsIL>
1714
<FeatureMulticastStubAsIL>true</FeatureMulticastStubAsIL>
18-
<FeaturePortableShuffleThunks Condition="'$(Platform)' != 'x86'">true</FeaturePortableShuffleThunks>
19-
<FeatureInstantiatingStubAsIL>true</FeatureInstantiatingStubAsIL>
20-
<FeatureStubsAsIL>true</FeatureStubsAsIL>
2115
<FeatureComWrappers>true</FeatureComWrappers>
2216
</PropertyGroup>
2317

2418
<PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
2519
<FeatureArrayStubAsIL Condition="'$(Platform)' != 'x86'">true</FeatureArrayStubAsIL>
2620
<FeatureMulticastStubAsIL Condition="'$(Platform)' != 'x86'">true</FeatureMulticastStubAsIL>
27-
<FeatureStubsAsIL Condition="'$(Platform)' == 'arm64'">true</FeatureStubsAsIL>
2821
<FeatureComWrappers>true</FeatureComWrappers>
2922
<FeatureCominterop>true</FeatureCominterop>
3023
<FeatureCominteropApartmentSupport>true</FeatureCominteropApartmentSupport>
31-
<FeatureWin32Registry>true</FeatureWin32Registry>
32-
<FeatureProfAttach>true</FeatureProfAttach>
33-
<FeaturePortableShuffleThunks Condition="'$(Platform)' != 'x86'">true</FeaturePortableShuffleThunks>
34-
<FeatureInstantiatingStubAsIL Condition="'$(Platform)' != 'x86'">true</FeatureInstantiatingStubAsIL>
3524
</PropertyGroup>
3625

3726
<PropertyGroup Condition="'$(TargetsOSX)' == 'true' OR '$(TargetsMacCatalyst)' == 'true' OR '$(TargetsiOS)' == 'true' OR '$(TargetstvOS)' == 'true'">
@@ -45,23 +34,16 @@
4534
<PropertyGroup>
4635
<DefineConstants Condition="'$(FeatureArrayStubAsIL)' == 'true'">$(DefineConstants);FEATURE_ARRAYSTUB_AS_IL</DefineConstants>
4736
<DefineConstants Condition="'$(FeatureMulticastStubAsIL)' == 'true'">$(DefineConstants);FEATURE_MULTICASTSTUB_AS_IL</DefineConstants>
48-
<DefineConstants Condition="'$(FeatureInstantiatingStubAsIL)' == 'true'">$(DefineConstants);FEATURE_INSTANTIATINGSTUB_AS_IL</DefineConstants>
49-
<DefineConstants Condition="'$(FeatureStubsAsIL)' == 'true'">$(DefineConstants);FEATURE_STUBS_AS_IL</DefineConstants>
50-
<DefineConstants Condition="'$(FeatureCollectibleALC)' == 'true'">$(DefineConstants);FEATURE_COLLECTIBLE_ALC</DefineConstants>
5137
<DefineConstants Condition="'$(FeatureComWrappers)' == 'true'">$(DefineConstants);FEATURE_COMWRAPPERS</DefineConstants>
5238
<DefineConstants Condition="'$(FeatureCominterop)' == 'true'">$(DefineConstants);FEATURE_COMINTEROP</DefineConstants>
5339
<DefineConstants Condition="'$(FeatureCominteropApartmentSupport)' == 'true'">$(DefineConstants);FEATURE_COMINTEROP_APARTMENT_SUPPORT</DefineConstants>
5440
<DefineConstants Condition="'$(FeatureObjCMarshal)' == 'true'">$(DefineConstants);FEATURE_OBJCMARSHAL</DefineConstants>
5541
<DefineConstants Condition="'$(FeaturePerfTracing)' == 'true'">$(DefineConstants);FEATURE_PERFTRACING</DefineConstants>
5642
<DefineConstants Condition="'$(FeatureXplatEventSource)' == 'true'">$(DefineConstants);FEATURE_EVENTSOURCE_XPLAT</DefineConstants>
57-
<DefineConstants Condition="'$(FeatureWin32Registry)' == 'true'">$(DefineConstants);FEATURE_WIN32_REGISTRY</DefineConstants>
5843
<DefineConstants Condition="'$(FeatureTypeEquivalence)' == 'true'">$(DefineConstants);FEATURE_TYPEEQUIVALENCE</DefineConstants>
59-
<DefineConstants Condition="'$(FeatureBasicFreeze)' == 'true'">$(DefineConstants);FEATURE_BASICFREEZE</DefineConstants>
60-
<DefineConstants Condition="'$(FeaturePortableShuffleThunks)' == 'true'">$(DefineConstants);FEATURE_PORTABLE_SHUFFLE_THUNKS</DefineConstants>
6144
<DefineConstants Condition="'$(FeatureICastable)' == 'true'">$(DefineConstants);FEATURE_ICASTABLE</DefineConstants>
6245
<DefineConstants Condition="'$(FeatureEHFunclets)' == 'true'">$(DefineConstants);FEATURE_EH_FUNCLETS</DefineConstants>
6346

6447
<DefineConstants Condition="'$(ProfilingSupportedBuild)' == 'true'">$(DefineConstants);PROFILING_SUPPORTED</DefineConstants>
65-
<DefineConstants Condition="'$(FeatureProfAttach)' == 'true'">$(DefineConstants);FEATURE_PROFAPI_ATTACH_DETACH</DefineConstants>
6648
</PropertyGroup>
6749
</Project>

src/coreclr/clrdefinitions.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGE
203203
add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
204204
endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64 OR CLR_CMAKE_TARGET_ARCH_RISCV64)
205205

206-
if(NOT CLR_CMAKE_TARGET_UNIX)
207-
add_definitions(-DFEATURE_WIN32_REGISTRY)
208-
endif(NOT CLR_CMAKE_TARGET_UNIX)
209206
add_definitions(-D_SECURE_SCL=0)
210207
add_definitions(-DUNICODE)
211208
add_definitions(-D_UNICODE)

src/coreclr/debug/ee/debugger.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3892,8 +3892,6 @@ HANDLE OpenWin32EventOrThrow(
38923892
// Returns true if the specified IL offset has a special meaning (eg. prolog, etc.)
38933893
bool DbgIsSpecialILOffset(DWORD offset);
38943894

3895-
#if !defined(TARGET_X86)
38963895
void FixupDispatcherContext(T_DISPATCHER_CONTEXT* pDispatcherContext, T_CONTEXT* pContext, PEXCEPTION_ROUTINE pUnwindPersonalityRoutine = NULL);
3897-
#endif
38983896

38993897
#endif /* DEBUGGER_H_ */

src/coreclr/inc/clrnt.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,7 @@ RtlpGetFunctionEndAddress (
223223
#define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf, addr) do { (prf)->UnwindData = (addr); } while(0)
224224

225225
#ifdef HOST_X86
226-
EXTERN_C
227-
NTSYSAPI
228226
PEXCEPTION_ROUTINE
229-
NTAPI
230227
RtlVirtualUnwind (
231228
_In_ DWORD HandlerType,
232229
_In_ DWORD ImageBase,

src/coreclr/inc/daccess.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,6 @@ struct COR_ILMETHOD* DacGetIlMethod(TADDR methAddr);
806806
struct _UNWIND_INFO * DacGetUnwindInfo(TADDR taUnwindInfo);
807807

808808
// virtually unwind a CONTEXT out-of-process
809-
struct _KNONVOLATILE_CONTEXT_POINTERS;
810809
BOOL DacUnwindStackFrame(T_CONTEXT * pContext, T_KNONVOLATILE_CONTEXT_POINTERS* pContextPointers);
811810
#endif // FEATURE_EH_FUNCLETS
812811

@@ -2433,7 +2432,7 @@ typedef DPTR(IMAGE_TLS_DIRECTORY) PTR_IMAGE_TLS_DIRECTORY;
24332432
#endif
24342433

24352434
#ifndef NATIVEAOT
2436-
#if defined(TARGET_X86) && defined(TARGET_UNIX)
2435+
#if defined(TARGET_X86) && defined(FEATURE_EH_FUNCLETS)
24372436
typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO;
24382437
#endif
24392438

src/coreclr/unwinder/i386/unwinder.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ BOOL OOPStackUnwinderX86::Unwind(T_CONTEXT* pContextRecord, T_KNONVOLATILE_CONTE
3737
dac_cast<PTR_CBYTE>(gcInfoToken.Info) + hdrInfoSize,
3838
PTR_CBYTE(codeInfo.GetJitManager()->GetFuncletStartAddress(&codeInfo)),
3939
codeInfo.IsFunclet(),
40-
UpdateAllRegs))
40+
true))
4141
{
4242
return FALSE;
4343
}
@@ -193,10 +193,7 @@ BOOL DacUnwindStackFrame(T_CONTEXT* pContextRecord, T_KNONVOLATILE_CONTEXT_POINT
193193
// language specific exception handler is returned. Otherwise, NULL is
194194
// returned.
195195
//
196-
EXTERN_C
197-
NTSYSAPI
198196
PEXCEPTION_ROUTINE
199-
NTAPI
200197
RtlVirtualUnwind (
201198
_In_ DWORD HandlerType,
202199
_In_ DWORD ImageBase,

src/coreclr/vm/.vscode/c_cpp_properties.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"FEATURE_USE_ASM_GC_WRITE_BARRIERS",
7272
"FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP",
7373
"FEATURE_UTF8STRING=1",
74-
"FEATURE_WIN32_REGISTRY",
7574
"TARGET_WINDOWS=1",
7675
"PROFILING_SUPPORTED_DATA",
7776
"UNICODE",

src/coreclr/vm/codeman.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,21 +2619,20 @@ class EECodeInfo
26192619
PTR_RUNTIME_FUNCTION GetFunctionEntry();
26202620
BOOL IsFunclet() { WRAPPER_NO_CONTRACT; return GetJitManager()->IsFunclet(this); }
26212621
EECodeInfo GetMainFunctionInfo();
2622-
ULONG GetFixedStackSize();
2623-
2624-
#if defined(TARGET_AMD64)
2625-
BOOL HasFrameRegister();
2626-
#endif // TARGET_AMD64
2622+
#endif // FEATURE_EH_FUNCLETS
26272623

2628-
#else // FEATURE_EH_FUNCLETS
2624+
#if defined(TARGET_X86)
26292625
ULONG GetFixedStackSize()
26302626
{
26312627
WRAPPER_NO_CONTRACT;
26322628
return GetCodeManager()->GetFrameSize(GetGCInfoToken());
26332629
}
2634-
#endif // FEATURE_EH_FUNCLETS
2630+
#endif // TARGET_X86
26352631

26362632
#if defined(TARGET_AMD64)
2633+
BOOL HasFrameRegister();
2634+
ULONG GetFixedStackSize();
2635+
26372636
void GetOffsetsFromUnwindInfo(ULONG* pRSPOffset, ULONG* pRBPOffset);
26382637
ULONG GetFrameOffsetFromUnwindInfo();
26392638
#if defined(_DEBUG) && defined(HAVE_GCCOVER)

src/coreclr/vm/eetwain.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,6 @@ OBJECTREF EECodeManager::GetInstance( PREGDISPLAY pContext,
16501650
hdrInfo info;
16511651
unsigned stackDepth;
16521652
TADDR taArgBase;
1653-
unsigned count;
16541653

16551654
/* Extract the necessary information from the info block header */
16561655

@@ -1709,7 +1708,7 @@ OBJECTREF EECodeManager::GetInstance( PREGDISPLAY pContext,
17091708
/* The 'this' pointer can never be located in the untracked table */
17101709
/* as we only allow pinned and byrefs in the untracked table */
17111710

1712-
count = info.untrackedCnt;
1711+
unsigned count = info.untrackedCnt;
17131712
while (count-- > 0)
17141713
{
17151714
fastSkipSigned(table);

0 commit comments

Comments
 (0)