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