Exemplo n.º 1
0
unsigned int GameScriptParser::getIDOfPointerOrAdd(void *pPointer, UserPointerData::Types type) {
    if (containsPointer(pPointer)) {
        return getIDOfPointer(pPointer);
    }
    else {
        return addPointerToMap(pPointer, type);
    }
}
Exemplo n.º 2
0
void GarbageCollector::updatePointer(Oop *pointer)
{
    // I only can update reference objects.
    if(!pointer->isPointer())
        return;

    // Is this a weak reference that was collected?
    if(pointer->header->gcColor == White)
    {
        *pointer = Oop();
        return;
    }

    // Is this object in the heap?
    auto heap = memoryManager->getHeap();
    if(!heap->containsPointer(pointer->pointer))
        return;

    // Use the forwarding pointer.
    uint8_t **forwardingPointer = reinterpret_cast<uint8_t**> (pointer->pointer - sizeof(uint8_t*));
    pointer->pointer = *forwardingPointer;
}