Skip to content

Commit

Permalink
Cleanup mscorlib references under src\coreclr\src (dotnet#39994)
Browse files Browse the repository at this point in the history
* s/MscorlibBinder/CoreLibBinder/

* s/g_Mscorlib/g_CoreLib/

* Remaining mscorlib->corelib renames

* Delete unreachable FNV NGen string
  • Loading branch information
jkotas authored and Jacksondr5 committed Aug 10, 2020
1 parent 78750fc commit a7a55c6
Show file tree
Hide file tree
Showing 167 changed files with 1,140 additions and 1,271 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PropertyGroup>
<_ILLinkRuntimeRootDescriptorFilePath>$(ILLinkTrimXml)</_ILLinkRuntimeRootDescriptorFilePath>
<_NamespaceFilePath Condition=" '$(_NamespaceFilePath)' == '' ">$(MSBuildThisFileDirectory)..\vm\namespace.h</_NamespaceFilePath>
<_MscorlibFilePath Condition=" '$(_MscorlibFilePath)' == '' ">$(MSBuildThisFileDirectory)..\vm\mscorlib.h</_MscorlibFilePath>
<_MscorlibFilePath Condition=" '$(_MscorlibFilePath)' == '' ">$(MSBuildThisFileDirectory)..\vm\corelib.h</_MscorlibFilePath>
<_CortypeFilePath Condition=" '$(_CortypeFilePath)' == '' ">$(MSBuildThisFileDirectory)..\inc\cortypeinfo.h</_CortypeFilePath>
<_RexcepFilePath Condition=" '$(_RexcepFilePath)' == '' ">$(MSBuildThisFileDirectory)..\vm\rexcep.h</_RexcepFilePath>
<_ILLinkDescriptorsIntermediatePath>$(IntermediateOutputPath)ILLink.Descriptors.Combined.xml</_ILLinkDescriptorsIntermediatePath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ public static string[] GetCommandLineArgs()
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern int GetProcessorCount();

// If you change this method's signature then you must change the code that calls it
// in excep.cpp and probably you will have to visit mscorlib.h to add the new signature
// as well as metasig.h to create the new signature type
// Used by VM
internal static string? GetResourceStringLocal(string key) => SR.GetResourceString(key);

public static string StackTrace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ private string? SerializationStackTraceString
}

// This piece of infrastructure exists to help avoid deadlocks
// between parts of mscorlib that might throw an exception while
// holding a lock that are also used by mscorlib's ResourceManager
// between parts of CoreLib that might throw an exception while
// holding a lock that are also used by CoreLib's ResourceManager
// instance. As a special case of code that may throw while holding
// a lock, we also need to fix our asynchronous exceptions to use
// Win32 resources as well (assuming we ever call a managed
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/System.Private.CoreLib/src/System/GC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public static int GetGeneration(WeakReference wo)

public static void WaitForPendingFinalizers()
{
// QCalls can not be exposed from mscorlib directly, need to wrap it.
// QCalls can not be exposed directly, need to wrap it.
_WaitForPendingFinalizers();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,7 @@ namespace System.Runtime.Versioning
{
internal static class CompatibilitySwitch
{
/* This class contains 3 sets of api:
* 1. internal apis : These apis are supposed to be used by mscorlib.dll and other assemblies which use the <runtime> section in config
* These apis query for the value of quirk not only in windows quirk DB but also in runtime section of config files,
* registry and environment vars.
* 2. public apis : These apis are supposed to be used by FX assemblies which do not read the runtime section of config files and have
* have their own section in config files or do not use configs at all.
*
* 3. specialized apis: These apis are defined in order to retrieve a specific value defined in CLR Config. That value can have specific look-up rules
* for the order and location of the config sources used.
*
* These apis are for internal use only for FX assemblies. It has not been decided if they can be used by OOB components due to EULA restrictions
*/
internal static string? GetValueInternal(string compatibilitySwitchName)
{
return GetValueInternalCall(compatibilitySwitchName, false);
}

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string? GetValueInternalCall(string compatibilitySwitchName, bool onlyDB);
internal static extern string? GetValueInternal(string compatibilitySwitchName);
}
}
10 changes: 5 additions & 5 deletions src/coreclr/src/binder/assemblybinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,25 +447,25 @@ namespace BINDER_SPACE
// Satellite assembly's path:
// * Absolute path when looking for a file on disk
// * Bundle-relative path when looking within the single-file bundle.
StackSString sMscorlibSatellite;
StackSString sCoreLibSatellite;

BinderTracing::PathSource pathSource = BinderTracing::PathSource::Bundle;
BundleFileLocation bundleFileLocation = Bundle::ProbeAppBundle(relativePath, /*pathIsBundleRelative */ true);
if (!bundleFileLocation.IsValid())
{
sMscorlibSatellite.Set(systemDirectory);
sCoreLibSatellite.Set(systemDirectory);
pathSource = BinderTracing::PathSource::ApplicationAssemblies;
}
CombinePath(sMscorlibSatellite, relativePath, sMscorlibSatellite);
CombinePath(sCoreLibSatellite, relativePath, sCoreLibSatellite);

ReleaseHolder<Assembly> pSystemAssembly;
IF_FAIL_GO(AssemblyBinder::GetAssembly(sMscorlibSatellite,
IF_FAIL_GO(AssemblyBinder::GetAssembly(sCoreLibSatellite,
TRUE /* fIsInGAC */,
FALSE /* fExplicitBindToNativeImage */,
&pSystemAssembly,
NULL /* szMDAssemblyPath */,
bundleFileLocation));
BinderTracing::PathProbed(sMscorlibSatellite, pathSource, hr);
BinderTracing::PathProbed(sCoreLibSatellite, pathSource, hr);

*ppSystemAssembly = pSystemAssembly.Extract();

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/binder/assemblyname.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ namespace BINDER_SPACE
return ulRef;
}

BOOL AssemblyName::IsMscorlib()
BOOL AssemblyName::IsCoreLib()
{
// TODO: Is this simple comparison enough?
return EqualsCaseInsensitive(GetSimpleName(), g_BinderVariables->mscorlib);
return EqualsCaseInsensitive(GetSimpleName(), g_BinderVariables->corelib);
}

ULONG AssemblyName::Hash(DWORD dwIncludeFlags)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/binder/bindertracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ namespace BinderTracing

// ActivityTracker or EventSource may have triggered the system satellite load.
// Don't track system satellite binding to avoid potential infinite recursion.
m_ignoreBind = m_bindRequest.AssemblySpec->IsMscorlibSatellite();
m_ignoreBind = m_bindRequest.AssemblySpec->IsCoreLibSatellite();
m_checkedIgnoreBind = true;
return m_ignoreBind;
}
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ HRESULT CLRPrivBinderAssemblyLoadContext::BindAssemblyByNameWorker(BINDER_SPACE:
HRESULT hr = S_OK;

#ifdef _DEBUG
// MSCORLIB should be bound using BindToSystem
_ASSERTE(!pAssemblyName->IsMscorlib());
// CoreLib should be bound using BindToSystem
_ASSERTE(!pAssemblyName->IsCoreLib());
#endif

// Do we have the assembly already loaded in the context of the current binder?
Expand Down Expand Up @@ -145,7 +145,7 @@ HRESULT CLRPrivBinderAssemblyLoadContext::BindUsingPEImage( /* in */ PEImage *pP

// Disallow attempt to bind to the core library. Aside from that,
// the LoadContext can load any assembly (even if it was in a different LoadContext like TPA).
if (pAssemblyName->IsMscorlib())
if (pAssemblyName->IsCoreLib())
{
IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
}
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/src/binder/clrprivbindercoreclr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ HRESULT CLRPrivBinderCoreCLR::BindAssemblyByNameWorker(BINDER_SPACE::AssemblyNam
HRESULT hr = S_OK;

#ifdef _DEBUG
// MSCORLIB should be bound using BindToSystem
_ASSERTE(!pAssemblyName->IsMscorlib());
// CoreLib should be bound using BindToSystem
_ASSERTE(!pAssemblyName->IsCoreLib());
#endif

hr = AssemblyBinder::BindAssembly(&m_appContext,
Expand Down Expand Up @@ -155,8 +155,8 @@ HRESULT CLRPrivBinderCoreCLR::BindUsingPEImage( /* in */ PEImage *pPEImage,
IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_BAD_FORMAT));
}

// Easy out for mscorlib
if (pAssemblyName->IsMscorlib())
// Easy out for CoreLib
if (pAssemblyName->IsCoreLib())
{
IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/binder/inc/assemblyname.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace BINDER_SPACE

inline void SetHave(DWORD dwIdentityFlags);

BOOL IsMscorlib();
BOOL IsCoreLib();

ULONG Hash(/* in */ DWORD dwIncludeFlags);
BOOL Equals(/* in */ AssemblyName *pAssemblyName,
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/binder/inc/variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace BINDER_SPACE

// AssemblyName string constants
SString cultureNeutral;
SString mscorlib;
SString corelib;
};

extern Variables *g_BinderVariables;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/binder/variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace BINDER_SPACE

// AssemblyName string constants
cultureNeutral.SetLiteral(W("neutral"));
mscorlib.SetLiteral(CoreLibName_W);
corelib.SetLiteral(CoreLibName_W);
}
EX_CATCH_HRESULT(hr);

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/src/classlibnative/bcltype/varargsnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ VarArgsNative::GetNextArgHelper(
value->data = (BYTE*)origArgPtr + (sizeof(void*)-1);
}
#endif
value->type = MscorlibBinder::GetElementType(elemType);
value->type = CoreLibBinder::GetElementType(elemType);
break;

case ELEMENT_TYPE_I2:
Expand All @@ -513,7 +513,7 @@ VarArgsNative::GetNextArgHelper(
value->data = (BYTE*)origArgPtr + (sizeof(void*)-2);
}
#endif
value->type = MscorlibBinder::GetElementType(elemType);
value->type = CoreLibBinder::GetElementType(elemType);
break;

case ELEMENT_TYPE_I4:
Expand All @@ -522,13 +522,13 @@ VarArgsNative::GetNextArgHelper(
case ELEMENT_TYPE_STRING:
case ELEMENT_TYPE_I:
case ELEMENT_TYPE_U:
value->type = MscorlibBinder::GetElementType(elemType);
value->type = CoreLibBinder::GetElementType(elemType);
break;

case ELEMENT_TYPE_I8:
case ELEMENT_TYPE_U8:
case ELEMENT_TYPE_R8:
value->type = MscorlibBinder::GetElementType(elemType);
value->type = CoreLibBinder::GetElementType(elemType);
#if !defined(HOST_64BIT) && (DATA_ALIGNMENT > 4)
if ( fData && origArgPtr == value->data ) {
// allocate an aligned copy of the value
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2399,7 +2399,7 @@ TypeHandle DacDbiInterfaceImpl::FindLoadedElementType(CorElementType elementType
// Lookup operations run the class loader in non-load mode.
ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE();

MethodTable * pMethodTable = (&g_Mscorlib)->GetElementType(elementType);
MethodTable * pMethodTable = (&g_CoreLib)->GetElementType(elementType);

return TypeHandle(pMethodTable);
} // DacDbiInterfaceImpl::FindLoadedElementType
Expand Down Expand Up @@ -7264,7 +7264,7 @@ HRESULT DacDbiInterfaceImpl::GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT *pLa
if (mt->IsString())
{
COR_TYPEID token;
token.token1 = MscorlibBinder::GetElementType(ELEMENT_TYPE_CHAR).GetAddr();
token.token1 = CoreLibBinder::GetElementType(ELEMENT_TYPE_CHAR).GetAddr();
token.token2 = 0;

pLayout->componentID = token;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/debug/daccess/enummem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
}
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pEEDbgInterfaceImpl.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_CORDebuggerControlFlags.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_Mscorlib.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_CoreLib.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pPredefinedArrayTypes[ELEMENT_TYPE_OBJECT].EnumMemoryRegions(flags); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( StubManager::EnumMemoryRegions(flags); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pFinalizerThread.EnumMem(); )
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/debug/daccess/inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ GetTypeFieldValueFlags(TypeHandle typeHandle,
// Perform extra checks to identify well-known classes.
//

if ((&g_Mscorlib)->IsClass(typeHandle.GetMethodTable(), CLASS__STRING))
if ((&g_CoreLib)->IsClass(typeHandle.GetMethodTable(), CLASS__STRING))
{
otherFlags |= CLRDATA_VALUE_IS_STRING;
}
Expand Down
Loading

0 comments on commit a7a55c6

Please sign in to comment.