// This function is known to the compiler. protected void InitializeClosedInstanceWithGVMResolution(object firstParameter, RuntimeMethodHandle tokenOfGenericVirtualMethod) { if (firstParameter == null) { throw new ArgumentException(SR.Arg_DlgtNullInst); } IntPtr functionResolution = TypeLoaderExports.GVMLookupForSlot(firstParameter, tokenOfGenericVirtualMethod); if (functionResolution == IntPtr.Zero) { // TODO! What to do when GVM resolution fails. Should never happen throw new InvalidOperationException(); } if (!FunctionPointerOps.IsGenericMethodPointer(functionResolution)) { m_functionPointer = functionResolution; m_firstParameter = firstParameter; } else { m_firstParameter = this; m_functionPointer = GetThunk(ClosedInstanceThunkOverGenericMethod); m_extraFunctionPointerOrData = functionResolution; m_helperObject = firstParameter; } return; }
unsafe private IntPtr ResolveMethod(object thisObject) { if (_resolveType == DispatchResolve) { return(RuntimeImports.RhResolveDispatch(thisObject, _declaringType, (ushort)_methodHandleOrSlotOrCodePointer.ToInt32())); } else if (_resolveType == GVMResolve) { return(TypeLoaderExports.GVMLookupForSlot(thisObject, GVMMethodHandle)); } else { throw new NotSupportedException(); // Should never happen, in this case, the dispatch should be resolved in the other ResolveMethod function } }
unsafe private IntPtr ResolveMethod(object thisObject) { if (_resolveType == DispatchResolve) { return(RuntimeImports.RhResolveDispatch(thisObject, _declaringType.EEType, (ushort)_methodHandleOrSlotOrCodePointer.ToInt32())); } else if (_resolveType == GVMResolve) { return(TypeLoaderExports.GVMLookupForSlot(thisObject, GVMMethodHandle)); } else { return(_methodHandleOrSlotOrCodePointer); } }