Beispiel #1
0
        public static void GetHeapRoots(tHeapRoots *pHeapRoots, tMetaData *pMetaData)
        {
            uint i, top;

            // Go through all Type.types, getting their static variables.

            top = pMetaData->tables.numRows[MetaDataTable.MD_TABLE_TYPEDEF];
            for (i = 1; i <= top; i++)
            {
                tMD_TypeDef *pTypeDef;

                pTypeDef = (tMD_TypeDef *)MetaData.GetTableRow(pMetaData, MetaData.MAKE_TABLE_INDEX(MetaDataTable.MD_TABLE_TYPEDEF, i));
                if (pTypeDef->isGenericDefinition != 0)
                {
                    Generics.GetHeapRoots(pHeapRoots, pTypeDef);
                }
                else
                {
                    if (pTypeDef->staticFieldSize > 0)
                    {
                        Heap.SetRoots(pHeapRoots, pTypeDef->pStaticFields, pTypeDef->staticFieldSize);
                    }
                }
            }
        }
Beispiel #2
0
        public static void GetHeapRoots(tHeapRoots *pHeapRoots)
        {
            tFilesLoaded *pFile;

            pFile = pFilesLoaded;
            while (pFile != null)
            {
                MetaData.GetHeapRoots(pHeapRoots, pFile->pCLIFile->pMetaData);
                pFile = pFile->pNext;
            }
        }
Beispiel #3
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;
            }
        }
Beispiel #4
0
        public static void SetRoots(tHeapRoots *pHeapRoots, void *pRoots, uint sizeInBytes)
        {
            tHeapRootEntry *pRootEntry;

            System.Diagnostics.Debug.Assert((sizeInBytes & 0x3) == 0);
            if (pHeapRoots->num >= pHeapRoots->capacity)
            {
                pHeapRoots->capacity   <<= 1;
                pHeapRoots->pHeapEntries = (tHeapRootEntry *)Mem.realloc(pHeapRoots->pHeapEntries, (SIZE_T)(pHeapRoots->capacity * sizeof(tHeapRootEntry)));
            }
            pRootEntry = &pHeapRoots->pHeapEntries[pHeapRoots->num++];
            pRootEntry->numPointers = sizeInBytes >> 2;
            pRootEntry->pMem        = (void **)pRoots;
        }
Beispiel #5
0
        public static void GetHeapRoots(tHeapRoots *pHeapRoots)
        {
            tThread *pThread;

            pThread = pAllThreads;
            while (pThread != null)
            {
                tMethodState *pMethodState;

                pMethodState = pThread->pCurrentMethodState;
                while (pMethodState != null)
                {
                    // Put the evaluation stack on the roots
                    Heap.SetRoots(pHeapRoots, pMethodState->pEvalStack, pMethodState->pMethod->pJITted->maxStack);
                    // Put the params/locals on the roots
                    Heap.SetRoots(pHeapRoots, pMethodState->pParamsLocals,
                                  pMethodState->pMethod->parameterStackSize + pMethodState->pMethod->pJITted->localsStackSize);

                    pMethodState = pMethodState->pCaller;
                }

                pThread = pThread->pNextThread;
            }
        }