Search in sources :

Example 1 with VoidPointer

use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.

the class HashTable_V1 method find.

// find by pointer value
@Override
public StructType find(StructType entry) throws CorruptDataException {
    UDATA hash = _hashFn.hash(entry).mod(_table.tableSize());
    PointerPointer head = _table.nodes().add(hash);
    VoidPointer findNode = VoidPointer.NULL;
    if (_table.listNodePool().isNull()) {
        PointerPointer node = hashTableFindNodeSpaceOpt(_table, entry, head);
        if (node.at(0).notNull()) {
            findNode = VoidPointer.cast(node);
        } else {
            findNode = VoidPointer.NULL;
        }
    } else if (head.at(0).isNull()) {
        findNode = VoidPointer.NULL;
    } else if (isAVLTreeTagged(head.at(0))) {
        findNode = hashTableFindNodeInTree(_table, entry, head);
    } else {
        findNode = hashTableFindNodeInList(_table, entry, head);
    }
    if (!_isInline && findNode.notNull()) {
        findNode = PointerPointer.cast(findNode).at(0);
    }
    StructType node = (StructType) DataType.getStructure(_structType, findNode.getAddress());
    return node;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer)

Example 2 with VoidPointer

use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.

the class StringTable method iterator.

public SlotIterator<J9ObjectPointer> iterator() {
    return new SlotIterator<J9ObjectPointer>() {

        private SlotIterator<PointerPointer> hashTableIterator = null;

        private long currentIndex = 0;

        public boolean hasNext() {
            while (true) {
                // Is the current iterator good?
                if (hashTableIterator != null) {
                    // Are there still entries?
                    if (hashTableIterator.hasNext()) {
                        return true;
                    }
                    // Move to the next hash table
                    currentIndex++;
                }
                // Are there more hash tables?
                if (currentIndex >= _tableCount) {
                    hashTableIterator = null;
                    return false;
                }
                // Get the next hash table iterator
                try {
                    J9HashTablePointer hashTable = J9HashTablePointer.cast(_stringTable._table().at(currentIndex));
                    HashTable<PointerPointer> currentHashTable = HashTable.fromJ9HashTable(hashTable, false, PointerPointer.class, _hashFn, new StringComparatorFunction<PointerPointer>());
                    hashTableIterator = currentHashTable.iterator();
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                // Keep trying
                }
            }
        }

        public J9ObjectPointer next() {
            if (hasNext()) {
                PointerPointer next = hashTableIterator.next();
                return J9ObjectPointer.cast(next);
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public VoidPointer nextAddress() {
            if (hasNext()) {
                return VoidPointer.cast(hashTableIterator.nextAddress());
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public void remove() {
            throw new UnsupportedOperationException("The image is read only and cannot be modified.");
        }
    };
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) NoSuchElementException(java.util.NoSuchElementException)

Example 3 with VoidPointer

use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.

the class Pool_29_V0 method pool_startDo.

private VoidPointer pool_startDo() throws CorruptDataException {
    slot = 0;
    J9PoolPuddleListPointer puddleList = J9PoolPuddleListPointer.cast(pool.puddleList());
    return poolPuddle_startDo(puddleList.nextPuddle(), true);
}
Also used : J9PoolPuddleListPointer(com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddleListPointer)

Example 4 with VoidPointer

use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.

the class Pool_29_V0 method poolPuddle_startDo.

private VoidPointer poolPuddle_startDo(J9PoolPuddlePointer currentPuddle, boolean followNextPointers) throws CorruptDataException {
    UDATAPointer currAddr = null;
    if (pool.isNull() || currentPuddle.isNull()) {
        return null;
    }
    if (currentPuddle.usedElements().longValue() == 0) {
        if ((currentPuddle.nextPuddle().notNull()) && followNextPointers) {
            return poolPuddle_startDo(currentPuddle.nextPuddle(), followNextPointers);
        } else {
            return null;
        }
    }
    while (isPuddleSlotFree(currentPuddle)) {
        slot++;
    }
    currAddr = UDATAPointer.cast(currentPuddle.firstElementAddress().getAddress() + (elementSize * slot));
    state.currentPuddle = currentPuddle;
    state.lastSlot = slot;
    state.leftToDo = currentPuddle.usedElements().intValue() - 1;
    state.flags = 0;
    if (followNextPointers) {
        // TODO find out where this is set
        state.flags |= POOLSTATE_FOLLOW_NEXT_POINTERS;
    }
    if (state.leftToDo == 0) {
        if (followNextPointers) {
            state.currentPuddle = state.currentPuddle.nextPuddle();
            state.lastSlot = -1;
        } else {
            state.currentPuddle = null;
        }
    }
    logger.fine(String.format("Next pool item 0x%016x", currAddr.getAddress()));
    if (logger.isLoggable(Level.FINER)) {
        logger.finer(state.toString());
    }
    return VoidPointer.cast(currAddr);
}
Also used : UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer)

Example 5 with VoidPointer

use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.

the class GCConstantPoolSlotIterator method initializeSlots_V1.

protected void initializeSlots_V1(J9ClassPointer clazz, boolean returnClassSlots, boolean returnObjectSlots) throws CorruptDataException {
    U32Pointer cpDescriptionSlots = clazz.romClass().cpShapeDescription();
    PointerPointer cpEntry = PointerPointer.cast(clazz.ramConstantPool());
    long cpDescription = 0;
    long cpEntryCount = clazz.romClass().ramConstantPoolCount().longValue();
    long cpDescriptionIndex = 0;
    ArrayList<AbstractPointer> slots = new ArrayList<AbstractPointer>();
    ArrayList<VoidPointer> addresses = new ArrayList<VoidPointer>();
    while (cpEntryCount > 0) {
        if (0 == cpDescriptionIndex) {
            // Load a new description word
            cpDescription = cpDescriptionSlots.at(0).longValue();
            cpDescriptionSlots = cpDescriptionSlots.add(1);
            cpDescriptionIndex = J9_CP_DESCRIPTIONS_PER_U32;
        }
        long slotType = cpDescription & J9_CP_DESCRIPTION_MASK;
        if ((slotType == J9CPTYPE_STRING) || (slotType == J9CPTYPE_ANNOTATION_UTF8)) {
            if (returnObjectSlots) {
                J9RAMStringRefPointer ref = J9RAMStringRefPointer.cast(cpEntry);
                J9ObjectPointer slot = ref.stringObject();
                if (slot.notNull()) {
                    slots.add(slot);
                    addresses.add(VoidPointer.cast(ref.stringObjectEA()));
                }
            }
        } else if (slotType == J9CPTYPE_METHOD_TYPE) {
            if (returnObjectSlots) {
                J9RAMMethodTypeRefPointer ref = J9RAMMethodTypeRefPointer.cast(cpEntry);
                J9ObjectPointer slot = ref.type();
                if (slot.notNull()) {
                    slots.add(slot);
                    addresses.add(VoidPointer.cast(ref.typeEA()));
                }
            }
        } else if (slotType == J9CPTYPE_METHODHANDLE) {
            if (returnObjectSlots) {
                J9RAMMethodHandleRefPointer ref = J9RAMMethodHandleRefPointer.cast(cpEntry);
                J9ObjectPointer slot = ref.methodHandle();
                if (slot.notNull()) {
                    slots.add(slot);
                    addresses.add(VoidPointer.cast(ref.methodHandleEA()));
                }
            }
        } else if (slotType == J9CPTYPE_CLASS) {
            if (returnClassSlots) {
                J9RAMClassRefPointer ref = J9RAMClassRefPointer.cast(cpEntry);
                J9ClassPointer slot = ref.value();
                if (slot.notNull()) {
                    slots.add(slot);
                    addresses.add(VoidPointer.cast(ref.valueEA()));
                }
            }
        }
        cpEntry = cpEntry.addOffset(J9RAMConstantPoolItem.SIZEOF);
        cpEntryCount -= 1;
        cpDescription >>= J9_CP_BITS_PER_DESCRIPTION;
        cpDescriptionIndex -= 1;
    }
    slotIterator = slots.iterator();
    addressIterator = addresses.iterator();
}
Also used : AbstractPointer(com.ibm.j9ddr.vm29.pointer.AbstractPointer) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) J9RAMClassRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9RAMClassRefPointer) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) ArrayList(java.util.ArrayList) J9RAMMethodTypeRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9RAMMethodTypeRefPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) J9RAMStringRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9RAMStringRefPointer) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer) J9RAMMethodHandleRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9RAMMethodHandleRefPointer)

Aggregations

VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)48 CorruptDataException (com.ibm.j9ddr.CorruptDataException)37 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)15 NoSuchElementException (java.util.NoSuchElementException)13 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)9 UDATA (com.ibm.j9ddr.vm29.types.UDATA)9 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)5 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)3 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)3 CorruptData (com.ibm.dtfj.image.CorruptData)2 JavaObject (com.ibm.dtfj.java.JavaObject)2 J9DDRCorruptData (com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)2 MonitorTable (com.ibm.j9ddr.vm29.j9.MonitorTable)2 GCJNIGlobalReferenceIterator (com.ibm.j9ddr.vm29.j9.gc.GCJNIGlobalReferenceIterator)2 GCJNIWeakGlobalReferenceIterator (com.ibm.j9ddr.vm29.j9.gc.GCJNIWeakGlobalReferenceIterator)2 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)2 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)2