Skip to content

Commit 0720de0

Browse files
authored
Rename ManagedAssemblyLoadContext to AssemblyLoadContext (#118227)
There is no unmanaged assembly load context, so the "Managed" prefix is superfluous.
1 parent 2611ca5 commit 0720de0

File tree

23 files changed

+82
-82
lines changed

23 files changed

+82
-82
lines changed

docs/design/datacontracts/Loader.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ TargetPointer GetStubHeap(TargetPointer loaderAllocatorPointer);
109109
| `Assembly` | `Level` | File load level of the assembly |
110110
| `PEAssembly` | `PEImage` | Pointer to the PEAssembly's PEImage |
111111
| `PEAssembly` | `AssemblyBinder` | Pointer to the PEAssembly's binder |
112-
| `AssemblyBinder` | `ManagedAssemblyLoadContext` | Pointer to the AssemblyBinder's ManagedAssemblyLoadContext |
112+
| `AssemblyBinder` | `AssemblyLoadContext` | Pointer to the AssemblyBinder's AssemblyLoadContext |
113113
| `PEImage` | `LoadedImageLayout` | Pointer to the PEImage's loaded PEImageLayout |
114114
| `PEImage` | `ProbeExtensionResult` | PEImage's ProbeExtensionResult |
115115
| `ProbeExtensionResult` | `Type` | Type of ProbeExtensionResult |

src/coreclr/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,35 +110,35 @@ internal Assembly LoadFromInMemoryModule(IntPtr moduleHandle)
110110

111111
// This method is invoked by the VM to resolve a satellite assembly reference
112112
// after trying assembly resolution via Load override without success.
113-
private static RuntimeAssembly? ResolveSatelliteAssembly(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
113+
private static RuntimeAssembly? ResolveSatelliteAssembly(IntPtr gchAssemblyLoadContext, AssemblyName assemblyName)
114114
{
115-
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchManagedAssemblyLoadContext).Target)!;
115+
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchAssemblyLoadContext).Target)!;
116116

117117
// Invoke the ResolveSatelliteAssembly method
118118
return context.ResolveSatelliteAssembly(assemblyName);
119119
}
120120

121121
// This method is invoked by the VM when using the host-provided assembly load context
122122
// implementation.
123-
private static IntPtr ResolveUnmanagedDll(string unmanagedDllName, IntPtr gchManagedAssemblyLoadContext)
123+
private static IntPtr ResolveUnmanagedDll(string unmanagedDllName, IntPtr gchAssemblyLoadContext)
124124
{
125-
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchManagedAssemblyLoadContext).Target)!;
125+
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchAssemblyLoadContext).Target)!;
126126
return context.LoadUnmanagedDll(unmanagedDllName);
127127
}
128128

129129
// This method is invoked by the VM to resolve a native library using the ResolvingUnmanagedDll event
130130
// after trying all other means of resolution.
131-
private static IntPtr ResolveUnmanagedDllUsingEvent(string unmanagedDllName, Assembly assembly, IntPtr gchManagedAssemblyLoadContext)
131+
private static IntPtr ResolveUnmanagedDllUsingEvent(string unmanagedDllName, Assembly assembly, IntPtr gchAssemblyLoadContext)
132132
{
133-
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchManagedAssemblyLoadContext).Target)!;
133+
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchAssemblyLoadContext).Target)!;
134134
return context.GetResolvedUnmanagedDll(assembly, unmanagedDllName);
135135
}
136136

137137
// This method is invoked by the VM to resolve an assembly reference using the Resolving event
138138
// after trying assembly resolution via Load override and TPA load context without success.
139-
private static RuntimeAssembly? ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
139+
private static RuntimeAssembly? ResolveUsingResolvingEvent(IntPtr gchAssemblyLoadContext, AssemblyName assemblyName)
140140
{
141-
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchManagedAssemblyLoadContext).Target)!;
141+
AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchAssemblyLoadContext).Target)!;
142142
// Invoke the AssemblyResolve event callbacks if wired up
143143
return context.ResolveUsingEvent(assemblyName);
144144
}

src/coreclr/binder/assemblybindercommon.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#if !defined(DACCESS_COMPILE)
2828
#include "defaultassemblybinder.h"
2929
// Helper function in the VM, invoked by the Binder, to invoke the host assembly resolver
30-
extern HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin,
30+
extern HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pAssemblyLoadContextToBindWithin,
3131
BINDER_SPACE::AssemblyName *pAssemblyName,
3232
DefaultAssemblyBinder *pDefaultBinder,
3333
AssemblyBinder *pBinder,
@@ -1147,19 +1147,19 @@ namespace BINDER_SPACE
11471147

11481148

11491149
#if !defined(DACCESS_COMPILE)
1150-
HRESULT AssemblyBinderCommon::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin,
1150+
HRESULT AssemblyBinderCommon::BindUsingHostAssemblyResolver(/* in */ INT_PTR pAssemblyLoadContextToBindWithin,
11511151
/* in */ AssemblyName *pAssemblyName,
11521152
/* in */ DefaultAssemblyBinder *pDefaultBinder,
11531153
/* in */ AssemblyBinder *pBinder,
11541154
/* out */ Assembly **ppAssembly)
11551155
{
11561156
HRESULT hr = E_FAIL;
11571157

1158-
_ASSERTE(pManagedAssemblyLoadContextToBindWithin != (INT_PTR)NULL);
1158+
_ASSERTE(pAssemblyLoadContextToBindWithin != (INT_PTR)NULL);
11591159

11601160
// RuntimeInvokeHostAssemblyResolver will perform steps 2-4 of CustomAssemblyBinder::BindAssemblyByName.
11611161
BINDER_SPACE::Assembly *pLoadedAssembly = NULL;
1162-
hr = RuntimeInvokeHostAssemblyResolver(pManagedAssemblyLoadContextToBindWithin,
1162+
hr = RuntimeInvokeHostAssemblyResolver(pAssemblyLoadContextToBindWithin,
11631163
pAssemblyName, pDefaultBinder, pBinder, &pLoadedAssembly);
11641164
if (SUCCEEDED(hr))
11651165
{
@@ -1297,7 +1297,7 @@ HRESULT AssemblyBinderCommon::CreateDefaultBinder(DefaultAssemblyBinder** ppDefa
12971297
hr = pApplicationContext->Init();
12981298
if (SUCCEEDED(hr))
12991299
{
1300-
pBinder->SetManagedAssemblyLoadContext((INT_PTR)NULL);
1300+
pBinder->SetAssemblyLoadContext((INT_PTR)NULL);
13011301
*ppDefaultBinder = pBinder.Extract();
13021302
}
13031303
}

src/coreclr/binder/customassemblybinder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ HRESULT CustomAssemblyBinder::BindUsingAssemblyName(BINDER_SPACE::AssemblyName*
7272
// of what to do next. The host-overridden binder can either fail the bind or return reference to an existing assembly
7373
// that has been loaded.
7474
//
75-
hr = AssemblyBinderCommon::BindUsingHostAssemblyResolver(GetManagedAssemblyLoadContext(), pAssemblyName,
75+
hr = AssemblyBinderCommon::BindUsingHostAssemblyResolver(GetAssemblyLoadContext(), pAssemblyName,
7676
m_pDefaultBinder, this, &pCoreCLRFoundAssembly);
7777
if (SUCCEEDED(hr))
7878
{
@@ -178,7 +178,7 @@ HRESULT CustomAssemblyBinder::SetupContext(DefaultAssemblyBinder *pDefaultBinder
178178

179179
// Save the reference to the IntPtr for GCHandle for the managed
180180
// AssemblyLoadContext instance
181-
pBinder->SetManagedAssemblyLoadContext(ptrAssemblyLoadContext);
181+
pBinder->SetAssemblyLoadContext(ptrAssemblyLoadContext);
182182

183183
if (pLoaderAllocator != NULL)
184184
{
@@ -247,16 +247,16 @@ CustomAssemblyBinder::CustomAssemblyBinder()
247247

248248
void CustomAssemblyBinder::ReleaseLoadContext()
249249
{
250-
VERIFY(GetManagedAssemblyLoadContext() != (INT_PTR)NULL);
250+
VERIFY(GetAssemblyLoadContext() != (INT_PTR)NULL);
251251
VERIFY(m_ptrManagedStrongAssemblyLoadContext != (INT_PTR)NULL);
252252

253253
// This method is called to release the weak and strong handles on the managed AssemblyLoadContext
254254
// once the Unloading event has been fired
255-
OBJECTHANDLE handle = reinterpret_cast<OBJECTHANDLE>(GetManagedAssemblyLoadContext());
255+
OBJECTHANDLE handle = reinterpret_cast<OBJECTHANDLE>(GetAssemblyLoadContext());
256256
DestroyLongWeakHandle(handle);
257257
handle = reinterpret_cast<OBJECTHANDLE>(m_ptrManagedStrongAssemblyLoadContext);
258258
DestroyHandle(handle);
259-
SetManagedAssemblyLoadContext((INT_PTR)NULL);
259+
SetAssemblyLoadContext((INT_PTR)NULL);
260260

261261
// The AssemblyLoaderAllocator is in a process of shutdown and should not be used
262262
// after this point.

src/coreclr/binder/defaultassemblybinder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ HRESULT DefaultAssemblyBinder::BindUsingAssemblyName(BINDER_SPACE::AssemblyName
6262
//
6363
// Attempt to resolve the assembly via managed ALC instance. This can either fail the bind or return reference to an existing
6464
// assembly that has been loaded
65-
INT_PTR pManagedAssemblyLoadContext = GetManagedAssemblyLoadContext();
66-
if (pManagedAssemblyLoadContext == (INT_PTR)NULL)
65+
INT_PTR pAssemblyLoadContext = GetAssemblyLoadContext();
66+
if (pAssemblyLoadContext == (INT_PTR)NULL)
6767
{
6868
// For satellite assemblies, the managed ALC has additional resolution logic (defined by the runtime) which
6969
// should be run even if the managed default ALC has not yet been used. (For non-satellite assemblies, any
@@ -77,14 +77,14 @@ HRESULT DefaultAssemblyBinder::BindUsingAssemblyName(BINDER_SPACE::AssemblyName
7777
DECLARE_ARGHOLDER_ARRAY(args, 0);
7878
CALL_MANAGED_METHOD_NORET(args)
7979

80-
pManagedAssemblyLoadContext = GetManagedAssemblyLoadContext();
81-
_ASSERTE(pManagedAssemblyLoadContext != (INT_PTR)NULL);
80+
pAssemblyLoadContext = GetAssemblyLoadContext();
81+
_ASSERTE(pAssemblyLoadContext != (INT_PTR)NULL);
8282
}
8383
}
8484

85-
if (pManagedAssemblyLoadContext != (INT_PTR)NULL)
85+
if (pAssemblyLoadContext != (INT_PTR)NULL)
8686
{
87-
hr = AssemblyBinderCommon::BindUsingHostAssemblyResolver(pManagedAssemblyLoadContext, pAssemblyName,
87+
hr = AssemblyBinderCommon::BindUsingHostAssemblyResolver(pAssemblyLoadContext, pAssemblyName,
8888
NULL, this, &pCoreCLRFoundAssembly);
8989
if (SUCCEEDED(hr))
9090
{

src/coreclr/binder/inc/assemblybindercommon.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace BINDER_SPACE
4747
/* in */ ProbeExtensionResult probeExtensionResult = ProbeExtensionResult::Invalid());
4848

4949
#if !defined(DACCESS_COMPILE)
50-
static HRESULT BindUsingHostAssemblyResolver (/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin,
50+
static HRESULT BindUsingHostAssemblyResolver (/* in */ INT_PTR pAssemblyLoadContextToBindWithin,
5151
/* in */ AssemblyName *pAssemblyName,
5252
/* in */ DefaultAssemblyBinder *pDefaultBinder,
5353
/* in */ AssemblyBinder *pBinder,

src/coreclr/debug/daccess/request.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5024,15 +5024,15 @@ HRESULT ClrDataAccess::GetAssemblyLoadContext(CLRDATA_ADDRESS methodTable, CLRDA
50245024
PTR_PEAssembly pPEAssembly = pModule->GetPEAssembly();
50255025
PTR_AssemblyBinder pBinder = pPEAssembly->GetAssemblyBinder();
50265026

5027-
INT_PTR managedAssemblyLoadContextHandle = pBinder->GetManagedAssemblyLoadContext();
5027+
INT_PTR AssemblyLoadContextHandle = pBinder->GetAssemblyLoadContext();
50285028

5029-
TADDR managedAssemblyLoadContextAddr = 0;
5030-
if (managedAssemblyLoadContextHandle != 0)
5029+
TADDR AssemblyLoadContextAddr = 0;
5030+
if (AssemblyLoadContextHandle != 0)
50315031
{
5032-
DacReadAll(managedAssemblyLoadContextHandle,&managedAssemblyLoadContextAddr,sizeof(TADDR),true);
5032+
DacReadAll(AssemblyLoadContextHandle,&AssemblyLoadContextAddr,sizeof(TADDR),true);
50335033
}
50345034

5035-
*assemblyLoadContext = TO_CDADDR(managedAssemblyLoadContextAddr);
5035+
*assemblyLoadContext = TO_CDADDR(AssemblyLoadContextAddr);
50365036

50375037
SOSDacLeave();
50385038
return hr;

src/coreclr/debug/runtimeinfo/datadescriptor.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ CDAC_TYPE_END(PEAssembly)
271271

272272
CDAC_TYPE_BEGIN(AssemblyBinder)
273273
CDAC_TYPE_INDETERMINATE(AssemblyBinder)
274-
CDAC_TYPE_FIELD(AssemblyBinder, /*pointer*/, ManagedAssemblyLoadContext, cdac_data<AssemblyBinder>::ManagedAssemblyLoadContext)
274+
CDAC_TYPE_FIELD(AssemblyBinder, /*pointer*/, AssemblyLoadContext, cdac_data<AssemblyBinder>::AssemblyLoadContext)
275275
CDAC_TYPE_END(AssemblyBinder)
276276

277277
CDAC_TYPE_BEGIN(PEImage)

src/coreclr/vm/appdomain.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4084,7 +4084,7 @@ AppDomain::AssemblyIterator::Next_Unlocked(
40844084
#if !defined(DACCESS_COMPILE)
40854085

40864086
// Returns S_OK if the assembly was successfully loaded
4087-
HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin, BINDER_SPACE::AssemblyName *pAssemblyName, DefaultAssemblyBinder *pDefaultBinder, AssemblyBinder *pBinder, BINDER_SPACE::Assembly **ppLoadedAssembly)
4087+
HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pAssemblyLoadContextToBindWithin, BINDER_SPACE::AssemblyName *pAssemblyName, DefaultAssemblyBinder *pDefaultBinder, AssemblyBinder *pBinder, BINDER_SPACE::Assembly **ppLoadedAssembly)
40884088
{
40894089
CONTRACTL
40904090
{
@@ -4114,7 +4114,7 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToB
41144114
BINDER_SPACE::Assembly *pResolvedAssembly = NULL;
41154115

41164116
bool fResolvedAssembly = false;
4117-
BinderTracing::ResolutionAttemptedOperation tracer{pAssemblyName, 0 /*binderID*/, pManagedAssemblyLoadContextToBindWithin, hr};
4117+
BinderTracing::ResolutionAttemptedOperation tracer{pAssemblyName, 0 /*binderID*/, pAssemblyLoadContextToBindWithin, hr};
41184118

41194119
// Allocate an AssemblyName managed object
41204120
_gcRefs.oRefAssemblyName = (ASSEMBLYNAMEREF) AllocateObject(CoreLibBinder::GetClass(CLASS__ASSEMBLY_NAME));
@@ -4138,7 +4138,7 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToB
41384138
// Setup the arguments for the call
41394139
ARG_SLOT args[2] =
41404140
{
4141-
PtrToArgSlot(pManagedAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
4141+
PtrToArgSlot(pAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
41424142
ObjToArgSlot(_gcRefs.oRefAssemblyName), // AssemblyName instance
41434143
};
41444144

@@ -4185,7 +4185,7 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToB
41854185
// Setup the arguments for the call
41864186
ARG_SLOT args[2] =
41874187
{
4188-
PtrToArgSlot(pManagedAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
4188+
PtrToArgSlot(pAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
41894189
ObjToArgSlot(_gcRefs.oRefAssemblyName), // AssemblyName instance
41904190
};
41914191

@@ -4214,7 +4214,7 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToB
42144214
// Setup the arguments for the call
42154215
ARG_SLOT args[2] =
42164216
{
4217-
PtrToArgSlot(pManagedAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
4217+
PtrToArgSlot(pAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
42184218
ObjToArgSlot(_gcRefs.oRefAssemblyName), // AssemblyName instance
42194219
};
42204220

src/coreclr/vm/assemblybinder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void AssemblyBinder::AddLoadedAssembly(Assembly* loadedAssembly)
168168

169169
void AssemblyBinder::GetNameForDiagnosticsFromManagedALC(INT_PTR managedALC, /* out */ SString& alcName)
170170
{
171-
if (managedALC == GetAppDomain()->GetDefaultBinder()->GetManagedAssemblyLoadContext())
171+
if (managedALC == GetAppDomain()->GetDefaultBinder()->GetAssemblyLoadContext())
172172
{
173173
alcName.Set(W("Default"));
174174
return;
@@ -205,7 +205,7 @@ void AssemblyBinder::GetNameForDiagnostics(/*out*/ SString& alcName)
205205
}
206206
else
207207
{
208-
GetNameForDiagnosticsFromManagedALC(GetManagedAssemblyLoadContext(), alcName);
208+
GetNameForDiagnosticsFromManagedALC(GetAssemblyLoadContext(), alcName);
209209
}
210210
}
211211

0 commit comments

Comments
 (0)