Search in sources :

Example 1 with PointerPointer

use of com.ibm.j9ddr.vm29.pointer.PointerPointer 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 PointerPointer

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

the class HashTable_V1 method hashTableFindNodeSpaceOpt.

private PointerPointer hashTableFindNodeSpaceOpt(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
    PointerPointer node = head;
    StructType nodeStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
    while ((node.at(0).notNull()) && (!_equalFunctionWrapper.equal(nodeStruct, entry))) {
        node = node.add(1);
        if (node == table.nodes().add(table.tableSize())) {
            node = table.nodes();
        }
        nodeStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
    }
    return node;
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer)

Example 3 with PointerPointer

use of com.ibm.j9ddr.vm29.pointer.PointerPointer 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 4 with PointerPointer

use of com.ibm.j9ddr.vm29.pointer.PointerPointer 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)

Example 5 with PointerPointer

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

the class StackWalkerUtils method WALK_NAMED_INDIRECT_O_SLOT.

public static void WALK_NAMED_INDIRECT_O_SLOT(WalkState walkState, PointerPointer objectSlot, VoidPointer indirectSlot, String tag) throws CorruptDataException {
    UDATA value;
    value = UDATAPointer.cast(objectSlot).at(0);
    if (indirectSlot.notNull()) {
        swPrintf(walkState, 4, "\t\t{0}[{1} -> {2}] = {3}", (tag != null ? tag : "O-Slot"), indirectSlot.getHexAddress(), objectSlot.getHexAddress(), value.getHexValue());
    } else {
        swPrintf(walkState, 4, "\t\t{0}[{1}] = {2}", (tag != null ? tag : "O-Slot"), objectSlot.getHexAddress(), value.getHexValue());
    }
    walkState.callBacks.objectSlotWalkFunction(walkState.walkThread, walkState, objectSlot, VoidPointer.cast(objectSlot));
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Aggregations

PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)31 CorruptDataException (com.ibm.j9ddr.CorruptDataException)22 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)10 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)9 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)6 UDATA (com.ibm.j9ddr.vm29.types.UDATA)5 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)4 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)3 J9HashTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer)3 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)3 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)3 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)3 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)2 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)2 WalkState (com.ibm.j9ddr.vm29.j9.stackwalker.WalkState)2 AbstractPointer (com.ibm.j9ddr.vm29.pointer.AbstractPointer)2 J9ConstantPoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ConstantPoolPointer)2 J9RAMClassRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RAMClassRefPointer)2 J9RAMMethodHandleRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RAMMethodHandleRefPointer)2 J9RAMMethodTypeRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RAMMethodTypeRefPointer)2