Skip to content

Commit 948770a

Browse files
authored
Remove CROSSGEN_COMPILE define usage (#57697)
* Remove basic usages with unifdef. * Manually remove the rest of the occurances that unifdef didn't catch due to complexity or if the file contains assembly. * Undo deletion of some #if 0 blocks that unifdef removed.
1 parent df3a899 commit 948770a

File tree

148 files changed

+236
-1515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+236
-1515
lines changed

src/coreclr/binder/applicationcontext.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ namespace BINDER_SPACE
8686
{
8787
HRESULT hr = S_OK;
8888

89-
#ifndef CROSSGEN_COMPILE
9089
CRITSEC_Holder contextLock(fAcquireLock ? GetCriticalSectionCookie() : NULL);
91-
#endif
9290
if (m_pTrustedPlatformAssemblyMap != nullptr)
9391
{
9492
GO_WITH_HRESULT(S_OK);
@@ -183,12 +181,10 @@ namespace BINDER_SPACE
183181
break;
184182
}
185183

186-
#ifndef CROSSGEN_COMPILE
187184
if (Path::IsRelative(pathName))
188185
{
189186
GO_WITH_HRESULT(E_INVALIDARG);
190187
}
191-
#endif
192188

193189
m_platformResourceRoots.Append(pathName);
194190
}
@@ -208,12 +204,10 @@ namespace BINDER_SPACE
208204
break;
209205
}
210206

211-
#ifndef CROSSGEN_COMPILE
212207
if (Path::IsRelative(pathName))
213208
{
214209
GO_WITH_HRESULT(E_INVALIDARG);
215210
}
216-
#endif
217211

218212
m_appPaths.Append(pathName);
219213
}

src/coreclr/binder/assemblybindercommon.cpp

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian
2929
#endif
3030

31-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
31+
#if !defined(DACCESS_COMPILE)
3232
#include "defaultassemblybinder.h"
3333
// Helper function in the VM, invoked by the Binder, to invoke the host assembly resolver
3434
extern HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin,
3535
BINDER_SPACE::AssemblyName *pAssemblyName,
3636
DefaultAssemblyBinder *pTPABinder,
3737
BINDER_SPACE::Assembly **ppLoadedAssembly);
3838

39-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
39+
#endif // !defined(DACCESS_COMPILE)
4040

4141
namespace BINDER_SPACE
4242
{
@@ -154,7 +154,6 @@ namespace BINDER_SPACE
154154
return hr;
155155
}
156156

157-
#ifndef CROSSGEN_COMPILE
158157
HRESULT CreateImageAssembly(IMDInternalImport *pIMetaDataAssemblyImport,
159158
PEKIND PeKind,
160159
PEImage *pPEImage,
@@ -179,7 +178,6 @@ namespace BINDER_SPACE
179178
Exit:
180179
return hr;
181180
}
182-
#endif // !CROSSGEN_COMPILE
183181
};
184182

185183
HRESULT AssemblyBinderCommon::TranslatePEToArchitectureType(DWORD *pdwPAFlags, PEKIND *PeKind)
@@ -267,12 +265,10 @@ namespace BINDER_SPACE
267265
// Tracing happens outside the binder lock to avoid calling into managed code within the lock
268266
BinderTracing::ResolutionAttemptedOperation tracer{pAssemblyName, pBinder, 0 /*managedALC*/, hr};
269267

270-
#ifndef CROSSGEN_COMPILE
271268
Retry:
272269
{
273270
// Lock the binding application context
274271
CRITSEC_Holder contextLock(pApplicationContext->GetCriticalSectionCookie());
275-
#endif
276272

277273
if (szCodeBase == NULL)
278274
{
@@ -309,16 +305,13 @@ namespace BINDER_SPACE
309305
// Remember the post-bind version
310306
kContextVersion = pApplicationContext->GetVersion();
311307

312-
#ifndef CROSSGEN_COMPILE
313308
} // lock(pApplicationContext)
314-
#endif
315309

316310
Exit:
317311
tracer.TraceBindResult(bindResult);
318312

319313
if (bindResult.HaveResult())
320314
{
321-
#ifndef CROSSGEN_COMPILE
322315
BindResult hostBindResult;
323316

324317
hr = RegisterAndGetHostChosen(pApplicationContext,
@@ -338,17 +331,12 @@ namespace BINDER_SPACE
338331
{
339332
*ppAssembly = hostBindResult.GetAssembly(TRUE /* fAddRef */);
340333
}
341-
#else // CROSSGEN_COMPILE
342-
343-
*ppAssembly = bindResult.GetAssembly(TRUE /* fAddRef */);
344-
345-
#endif // CROSSGEN_COMPILE
346334
}
347335

348336
return hr;
349337
}
350338

351-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
339+
#if !defined(DACCESS_COMPILE)
352340
/* static */
353341
HRESULT AssemblyBinderCommon::BindToSystem(BINDER_SPACE::Assembly** ppSystemAssembly, bool fBindToNativeImage)
354342
{
@@ -370,7 +358,7 @@ namespace BINDER_SPACE
370358

371359
return hr;
372360
}
373-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
361+
#endif // !defined(DACCESS_COMPILE)
374362

375363
/* static */
376364
HRESULT AssemblyBinderCommon::BindToSystem(SString &systemDirectory,
@@ -673,7 +661,6 @@ namespace BINDER_SPACE
673661
HRESULT hr = S_OK;
674662

675663
bool isTpaListProvided = pApplicationContext->IsTpaListProvided();
676-
#ifndef CROSSGEN_COMPILE
677664
ContextEntry *pContextEntry = NULL;
678665
hr = FindInExecutionContext(pApplicationContext, pAssemblyName, &pContextEntry);
679666

@@ -705,7 +692,6 @@ namespace BINDER_SPACE
705692
pBindResult->SetResult(pContextEntry);
706693
}
707694
else
708-
#endif // !CROSSGEN_COMPILE
709695
if (isTpaListProvided)
710696
{
711697
// BindByTpaList handles setting attempt results on the bind result
@@ -734,7 +720,6 @@ namespace BINDER_SPACE
734720
return hr;
735721
}
736722

737-
#ifndef CROSSGEN_COMPILE
738723
/* static */
739724
HRESULT AssemblyBinderCommon::FindInExecutionContext(ApplicationContext *pApplicationContext,
740725
AssemblyName *pAssemblyName,
@@ -763,7 +748,6 @@ namespace BINDER_SPACE
763748
return pContextEntry != NULL ? S_OK : S_FALSE;
764749
}
765750

766-
#endif //CROSSGEN_COMPILE
767751

768752
//
769753
// Tests whether a candidate assembly's name matches the requested.
@@ -1300,7 +1284,6 @@ namespace BINDER_SPACE
13001284
return hr;
13011285
}
13021286

1303-
#ifndef CROSSGEN_COMPILE
13041287

13051288
/* static */
13061289
HRESULT AssemblyBinderCommon::Register(ApplicationContext *pApplicationContext,
@@ -1416,9 +1399,8 @@ namespace BINDER_SPACE
14161399
return hr;
14171400
}
14181401

1419-
#endif //CROSSGEN_COMPILE
14201402

1421-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
1403+
#if !defined(DACCESS_COMPILE)
14221404
HRESULT AssemblyBinderCommon::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin,
14231405
/* in */ AssemblyName *pAssemblyName,
14241406
/* in */ DefaultAssemblyBinder *pTPABinder,
@@ -1622,7 +1604,7 @@ HRESULT AssemblyBinderCommon::GetAssemblyIdentity(LPCSTR szTextualIdentity,
16221604
return hr;
16231605
}
16241606

1625-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
1607+
#endif // !defined(DACCESS_COMPILE)
16261608
};
16271609

16281610

src/coreclr/binder/bindertracing.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ namespace
8888
return;
8989
}
9090

91-
#ifdef CROSSGEN_COMPILE
92-
alcName.Set(W("Custom"));
93-
#else // CROSSGEN_COMPILE
9491
OBJECTREF *alc = reinterpret_cast<OBJECTREF *>(managedALC);
9592

9693
GCX_COOP();
@@ -108,7 +105,6 @@ namespace
108105
gc.alcName->GetSString(alcName);
109106

110107
GCPROTECT_END();
111-
#endif // CROSSGEN_COMPILE
112108
}
113109

114110
void GetAssemblyLoadContextNameFromBindContext(AssemblyBinder *bindContext, AppDomain *domain, /*out*/ SString &alcName)
@@ -121,13 +117,9 @@ namespace
121117
}
122118
else
123119
{
124-
#ifdef CROSSGEN_COMPILE
125-
GetAssemblyLoadContextNameFromManagedALC(0, alcName);
126-
#else // CROSSGEN_COMPILE
127120
CustomAssemblyBinder* alcBinder = static_cast<CustomAssemblyBinder*>(bindContext);
128121

129122
GetAssemblyLoadContextNameFromManagedALC(alcBinder->GetManagedAssemblyLoadContext(), alcName);
130-
#endif // CROSSGEN_COMPILE
131123
}
132124
}
133125

src/coreclr/binder/customassemblybinder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "defaultassemblybinder.h"
77
#include "customassemblybinder.h"
88

9-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
9+
#if !defined(DACCESS_COMPILE)
1010

1111
using namespace BINDER_SPACE;
1212

@@ -201,7 +201,7 @@ HRESULT CustomAssemblyBinder::SetupContext(DefaultAssemblyBinder *pTPABinder,
201201
pBinder->m_pAssemblyLoaderAllocator = pLoaderAllocator;
202202
pBinder->m_loaderAllocatorHandle = loaderAllocatorHandle;
203203

204-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
204+
#if !defined(DACCESS_COMPILE)
205205
if (pLoaderAllocator != NULL)
206206
{
207207
((AssemblyLoaderAllocator*)pLoaderAllocator)->RegisterBinder(pBinder);
@@ -268,5 +268,5 @@ void CustomAssemblyBinder::ReleaseLoadContext()
268268
m_ptrManagedAssemblyLoadContext = NULL;
269269
}
270270

271-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
271+
#endif // !defined(DACCESS_COMPILE)
272272

src/coreclr/binder/defaultassemblybinder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ HRESULT DefaultAssemblyBinder::BindUsingAssemblyName(BINDER_SPACE::AssemblyName
5454

5555
hr = BindAssemblyByNameWorker(pAssemblyName, &pCoreCLRFoundAssembly, false /* excludeAppPaths */);
5656

57-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
57+
#if !defined(DACCESS_COMPILE)
5858
if ((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) ||
5959
(hr == FUSION_E_APP_DOMAIN_LOCKED) || (hr == FUSION_E_REF_DEF_MISMATCH))
6060
{
@@ -102,7 +102,7 @@ HRESULT DefaultAssemblyBinder::BindUsingAssemblyName(BINDER_SPACE::AssemblyName
102102
}
103103
}
104104
}
105-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
105+
#endif // !defined(DACCESS_COMPILE)
106106

107107
IF_FAIL_GO(hr);
108108

@@ -113,7 +113,7 @@ Exit:;
113113
return hr;
114114
}
115115

116-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
116+
#if !defined(DACCESS_COMPILE)
117117
HRESULT DefaultAssemblyBinder::BindUsingPEImage( /* in */ PEImage *pPEImage,
118118
/* in */ BOOL fIsNativeImage,
119119
/* [retval][out] */ BINDER_SPACE::Assembly **ppAssembly)
@@ -185,7 +185,7 @@ Exit:;
185185

186186
return hr;
187187
}
188-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
188+
#endif // !defined(DACCESS_COMPILE)
189189

190190
HRESULT DefaultAssemblyBinder::SetupBindingPaths(SString &sTrustedPlatformAssemblies,
191191
SString &sPlatformResourceRoots,

src/coreclr/binder/inc/assembly.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
#include "defaultassemblybinder.h"
2323

24-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
24+
#if !defined(DACCESS_COMPILE)
2525
#include "customassemblybinder.h"
26-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
26+
#endif // !defined(DACCESS_COMPILE)
2727

2828
#include "bundle.h"
2929

@@ -131,9 +131,9 @@ namespace BINDER_SPACE
131131

132132
friend class ::DefaultAssemblyBinder;
133133

134-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
134+
#if !defined(DACCESS_COMPILE)
135135
friend class ::CustomAssemblyBinder;
136-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
136+
#endif // !defined(DACCESS_COMPILE)
137137
};
138138

139139
#include "assembly.inl"

src/coreclr/binder/inc/assemblybindercommon.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace BINDER_SPACE
6060
/* in */ LPCTSTR szMDAssemblyPath = NULL,
6161
/* in */ BundleFileLocation bundleFileLocation = BundleFileLocation::Invalid());
6262

63-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
63+
#if !defined(DACCESS_COMPILE)
6464
static HRESULT BindUsingHostAssemblyResolver (/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin,
6565
/* in */ AssemblyName *pAssemblyName,
6666
/* in */ DefaultAssemblyBinder *pTPABinder,
@@ -72,7 +72,7 @@ namespace BINDER_SPACE
7272
/* in */ PEKIND peKind,
7373
/* in */ IMDInternalImport *pIMetaDataAssemblyImport,
7474
/* [retval] [out] */ Assembly **ppAssembly);
75-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
75+
#endif // !defined(DACCESS_COMPILE)
7676

7777
static HRESULT TranslatePEToArchitectureType(DWORD *pdwPAFlags, PEKIND *PeKind);
7878

src/coreclr/binder/inc/customassemblybinder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "applicationcontext.hpp"
99
#include "defaultassemblybinder.h"
1010

11-
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
11+
#if !defined(DACCESS_COMPILE)
1212

1313
class AssemblyLoaderAllocator;
1414
class PEImage;
@@ -63,5 +63,5 @@ class CustomAssemblyBinder final : public AssemblyLoadContext
6363
void* m_loaderAllocatorHandle;
6464
};
6565

66-
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
66+
#endif // !defined(DACCESS_COMPILE)
6767
#endif // __CUSTOM_ASSEMBLY_BINDER_H__

src/coreclr/binder/utils.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,10 @@ namespace BINDER_SPACE
198198
return S_FALSE;
199199
}
200200

201-
#ifndef CROSSGEN_COMPILE
202201
if (Path::IsRelative(outPath))
203202
{
204203
GO_WITH_HRESULT(E_INVALIDARG);
205204
}
206-
#endif
207205

208206
{
209207
// Find the beginning of the simple name

0 commit comments

Comments
 (0)