public static void SetSignature(GCHeader* headerPtr) { headerPtr->Sig1 = 0x5C0EADE2U; headerPtr->Sig2 = 0x5C0EADE2U; headerPtr->Checksum = 0xB81D5BC4U; }
private static void RemoveObjectToCleanup(GCHeader* objHeaderPtr) { EnterCritical("RemoveObjectToCleanup"); try { ObjectToCleanup* currObjToCleanupPtr = CleanupList; while (currObjToCleanupPtr != null) { if (currObjToCleanupPtr->objHeaderPtr == objHeaderPtr) { RemoveObjectToCleanup(currObjToCleanupPtr); return; } currObjToCleanupPtr = currObjToCleanupPtr->prevPtr; } } finally { ExitCritical(); } }
public static unsafe bool CheckSignature(GCHeader* headerPtr) { bool OK = headerPtr->Sig1 == 0x5C0EADE2U; OK = OK && headerPtr->Sig2 == 0x5C0EADE2U; OK = OK && headerPtr->Checksum == 0xB81D5BC4U; return OK; }
private static void AddObjectToCleanup(GCHeader* objHeaderPtr, void* objPtr) { EnterCritical("AddObjectToCleanup"); try { ObjectToCleanup* newObjToCleanupPtr = (ObjectToCleanup*)Heap.AllocZeroed((uint)sizeof(ObjectToCleanup), "GC : AddObjectToCleanup"); newObjToCleanupPtr->objHeaderPtr = objHeaderPtr; newObjToCleanupPtr->objPtr = objPtr; if (CleanupList != null) { newObjToCleanupPtr->prevPtr = CleanupList; CleanupList->nextPtr = newObjToCleanupPtr; } else { newObjToCleanupPtr->prevPtr = null; newObjToCleanupPtr->nextPtr = null; } CleanupList = newObjToCleanupPtr; } finally { ExitCritical(); } }