Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ namespace Internal.Runtime.CompilerServices
[ReflectionBlocked]
public struct OpenMethodResolver : IEquatable<OpenMethodResolver>
{
// Lazy initialized to point to the type loader method when the first `GVMResolve` resolver is created
private static unsafe delegate*<object, RuntimeMethodHandle, nint> s_lazyGvmLookupForSlot;

public const short DispatchResolve = 0;
public const short GVMResolve = 1;
public const short OpenNonVirtualResolve = 2;
Expand Down Expand Up @@ -52,6 +55,9 @@ public unsafe OpenMethodResolver(RuntimeTypeHandle declaringTypeOfSlot, RuntimeM
_handle = handle;
_readerGCHandle = readerGCHandle;
_nonVirtualOpenInvokeCodePointer = IntPtr.Zero;

if (s_lazyGvmLookupForSlot == null)
s_lazyGvmLookupForSlot = &TypeLoaderExports.GVMLookupForSlot;
}

public OpenMethodResolver(RuntimeTypeHandle declaringType, IntPtr codePointer, GCHandle readerGCHandle, int handle)
Expand Down Expand Up @@ -151,7 +157,7 @@ private unsafe IntPtr ResolveMethod(object thisObject)
}
else if (_resolveType == GVMResolve)
{
return TypeLoaderExports.GVMLookupForSlot(thisObject, GVMMethodHandle);
return s_lazyGvmLookupForSlot(thisObject, GVMMethodHandle);
}
else
{
Expand Down