private static void CctorHelper() { s_resolveCallOnReferenceTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnReferenceTypeDel)ResolveCallOnReferenceType); s_resolveCallOnValueTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnValueTypeDel)ResolveCallOnValueType); s_resolveCallOnReferenceTypeCacheMissFunc = RuntimeAugments.RegisterResolutionFunctionWithRuntimeCache( Intrinsics.AddrOf((RuntimeCacheFuncSignatureDel)ResolveCallOnReferenceTypeCacheMiss)); }
/// <summary> /// Get the thunk that can represent all finalizers of metadata represented objects. /// </summary> public static IntPtr GetFinalizerThunk() { // Here we take advantage of the detail that the calling convention abi for a static function // that returns no values, and takes a single object parameter matches that of a // instance function that takes no parameters return(Intrinsics.AddrOf(new Action <object>(FinalizeThunk))); }
/// <summary> /// Initialize module info and construct per-module metadata reader. /// </summary> /// <param name="moduleHandle">Handle (address) of module to initialize</param> internal ModuleInfo(TypeManagerHandle moduleHandle, ModuleType moduleType) { Handle = moduleHandle; ModuleType = moduleType; DynamicModule *dynamicModulePtr = (DynamicModule *)MemoryHelpers.AllocateMemory(sizeof(DynamicModule)); dynamicModulePtr->CbSize = DynamicModule.DynamicModuleSize; Debug.Assert(sizeof(DynamicModule) >= dynamicModulePtr->CbSize); if ((moduleType == ModuleType.ReadyToRun) || (moduleType == ModuleType.Ecma)) { // Dynamic type load modules utilize dynamic type resolution dynamicModulePtr->DynamicTypeSlotDispatchResolve = Intrinsics.AddrOf( (Func <IntPtr, IntPtr, ushort, IntPtr>)ResolveTypeSlotDispatch); } else { Debug.Assert(moduleType == ModuleType.Eager); // Pre-generated modules do not dynamicModulePtr->DynamicTypeSlotDispatchResolve = IntPtr.Zero; } dynamicModulePtr->GetRuntimeException = Intrinsics.AddrOf( (Func <ExceptionIDs, Exception>)RuntimeExceptionHelpers.GetRuntimeException); DynamicModulePtr = dynamicModulePtr; }
private static void CctorHelper() { s_resolveCallOnReferenceTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnReferenceTypeDel)ResolveCallOnReferenceType); s_resolveCallOnValueTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnValueTypeDel)ResolveCallOnValueType); s_resolveDirectConstrainedCallFuncPtr = Intrinsics.AddrOf((Func <IntPtr, IntPtr, IntPtr>)ResolveDirectConstrainedCall); s_boxAndToStringFuncPtr = Intrinsics.AddrOf((BoxAndCallDel <string>)BoxAndToString); s_boxAndGetHashCodeFuncPtr = Intrinsics.AddrOf((BoxAndCallDel <int>)BoxAndGetHashCode); s_boxAndEqualsFuncPtr = Intrinsics.AddrOf((BoxAndCallDel2 <bool>)BoxAndEquals); }
private static void CctorHelper() { s_resolveCallOnReferenceTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnReferenceTypeDel)ResolveCallOnReferenceType); s_resolveCallOnValueTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnValueTypeDel)ResolveCallOnValueType); s_resolveDirectConstrainedCallFuncPtr = Intrinsics.AddrOf((Func <IntPtr, IntPtr, IntPtr>)ResolveDirectConstrainedCall); s_boxAndToStringFuncPtr = Intrinsics.AddrOf((BoxAndCallDel <string>)BoxAndToString); s_boxAndGetHashCodeFuncPtr = Intrinsics.AddrOf((BoxAndCallDel <int>)BoxAndGetHashCode); s_boxAndEqualsFuncPtr = Intrinsics.AddrOf((BoxAndCallDel2 <bool>)BoxAndEquals); s_resolveCallOnReferenceTypeCacheMissFunc = RuntimeAugments.RegisterResolutionFunctionWithRuntimeCache( Intrinsics.AddrOf((RuntimeCacheFuncSignatureDel)ResolveCallOnReferenceTypeCacheMiss)); }
/// <summary> /// Build initial array of vtable thunks. These thunks are the ones directly embedded in /// the typeloader codebase instead of being dynamically generated out of the thunk pool. /// </summary> private static IntPtr[] InitialThunks() { IntPtr firstResolverThunk; int thunkCount; int thunkSize = VTableResolver_Init(out firstResolverThunk, Intrinsics.AddrOf(new Func <IntPtr, IntPtr, IntPtr>(VTableResolveThunk)), RuntimeAugments.GetUniversalTransitionThunk(), out thunkCount); IntPtr[] initialThunks = new IntPtr[thunkCount]; for (int i = 0; i < thunkCount; i++) { unsafe { initialThunks[i] = (IntPtr)(((byte *)firstResolverThunk) + (thunkSize * i)); } } return(initialThunks); }
/// <summary> /// Initialize module info and construct per-module metadata reader. /// </summary> /// <param name="moduleHandle">Handle (address) of module to initialize</param> internal ModuleInfo(IntPtr moduleHandle, ModuleType moduleType) { Handle = moduleHandle; ModuleType = moduleType; byte *pBlob; uint cbBlob; if (RuntimeAugments.FindBlob(moduleHandle, (int)ReflectionMapBlob.EmbeddedMetadata, new IntPtr(&pBlob), new IntPtr(&cbBlob))) { MetadataReader = new MetadataReader((IntPtr)pBlob, (int)cbBlob); } DynamicModule *dynamicModulePtr = (DynamicModule *)MemoryHelpers.AllocateMemory(sizeof(DynamicModule)); dynamicModulePtr->CbSize = DynamicModule.DynamicModuleSize; Debug.Assert(sizeof(DynamicModule) >= dynamicModulePtr->CbSize); #if SUPPORTS_R2R_LOADING if (moduleType == ModuleType.ReadyToRun) { // ReadyToRun modules utilize dynamic type resolution dynamicModulePtr->DynamicTypeSlotDispatchResolve = Intrinsics.AddrOf( (Func <IntPtr, IntPtr, ushort, IntPtr>)ReadyToRunCallbacks.ResolveTypeSlotDispatch); } else #endif { Debug.Assert(moduleType == ModuleType.Eager); // Pre-generated modules do not dynamicModulePtr->DynamicTypeSlotDispatchResolve = IntPtr.Zero; } dynamicModulePtr->GetRuntimeException = Intrinsics.AddrOf( (Func <ExceptionIDs, Exception>)RuntimeExceptionHelpers.GetRuntimeException); DynamicModulePtr = dynamicModulePtr; }
private static IntPtr SetupMethodEntrypoints() { return(MethodEntrypointStubs_SetupPointers(RuntimeAugments.GetUniversalTransitionThunk(), Intrinsics.AddrOf <Func <IntPtr, IntPtr, IntPtr> >(EntrypointThunk))); }
private static void CctorHelper() { s_resolveCallOnReferenceTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnReferenceTypeDel)ResolveCallOnReferenceType); s_resolveCallOnValueTypeFuncPtr = Intrinsics.AddrOf((ResolveCallOnValueTypeDel)ResolveCallOnValueType); }