Beispiel #1
0
        public static tAsyncCall *GetGenericArguments(tJITCallNative *pCallNative, byte *pThis_, byte *pParams, byte *pReturnValue)
        {
            tMD_TypeDef *      pType = ((tRuntimeType *)pThis_)->pTypeDef;
            tMD_TypeDef *      pCoreType;
            uint               i, argCount = 0;
            /*HEAP_PTR*/ byte *ret;

            pCoreType = pType->pGenericDefinition;
            if (pCoreType != null)
            {
                // Find the core instantiation of this type
                tGenericInstance *pInst = pCoreType->pGenericInstances;
                while (pInst != null)
                {
                    if (pInst->pInstanceTypeDef == pType)
                    {
                        // Found it!
                        argCount = pInst->numTypeArgs;
                    }
                    pInst = pInst->pNext;
                }
            }

            ret = System_Array.NewVector(Type.types[Type.TYPE_SYSTEM_ARRAY_TYPE], argCount);
            // Allocate to return value straight away, so it cannot be GCed
            *(/*HEAP_PTR*/ byte **)pReturnValue = ret;

            for (i = 0; i < argCount; i++)
            {
                /*HEAP_PTR*/ byte *argType = Type.GetTypeObject(pType->ppClassTypeArgs[i]);
                System_Array.StoreElement(ret, i, (byte *)&argType);
            }

            return(null);
        }
Beispiel #2
0
        public static void GetHeapRoots(tHeapRoots *pHeapRoots, tMD_TypeDef *pTypeDef)
        {
            tGenericInstance *pInst = pTypeDef->pGenericInstances;

            while (pInst != null)
            {
                tMD_TypeDef *pInstTypeDef = pInst->pInstanceTypeDef;
                if (pInstTypeDef->staticFieldSize > 0)
                {
                    Heap.SetRoots(pHeapRoots, pInstTypeDef->pStaticFields, pInstTypeDef->staticFieldSize);
                }
                pInst = pInst->pNext;
            }
        }