Search in sources :

Example 21 with PointerPointer

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

the class HashTable_V1 method hashTableFindNodeInTree.

private VoidPointer hashTableFindNodeInTree(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
    J9AVLTreePointer tree = avlTreeUntag(head.at(0));
    AVLTree avlTree = AVLTree.fromJ9AVLTreePointer(tree, _avlTreeComparatorFunction);
    J9AVLTreeNodePointer searchResult = avlTree.search(UDATA.cast(entry));
    if (searchResult.notNull()) {
        return avlNodeToData(searchResult);
    } else {
        return VoidPointer.NULL;
    }
}
Also used : J9AVLTreePointer(com.ibm.j9ddr.vm29.pointer.generated.J9AVLTreePointer) J9AVLTreeNodePointer(com.ibm.j9ddr.vm29.pointer.generated.J9AVLTreeNodePointer)

Example 22 with PointerPointer

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

the class HashTable_V1 method hashTableFindNodeInList.

private VoidPointer hashTableFindNodeInList(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
    /* Look through the list looking for the correct key */
    VoidPointer node = head.at(0);
    StructType currentStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
    while ((!node.isNull()) && (!_equalFunctionWrapper.equal(currentStruct, entry))) {
        node = nextEA(node).at(0);
        currentStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
    }
    return VoidPointer.cast(currentStruct);
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer)

Example 23 with PointerPointer

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

the class Pool_29_V0 method hasNext.

@SuppressWarnings("unchecked")
public boolean hasNext() {
    // prevents multiple calls to hasNext() walking the pool further.
    if (nextStruct != null) {
        return true;
    }
    try {
        // any handlers are likely to have been installed.
        if (!inited) {
            // start the pool walk
            nextItem = pool_startDo();
        } else {
            // continue the pool walk
            nextItem = pool_nextDo();
        }
    } catch (CorruptDataException e) {
        // cannot try to recover from this
        raiseCorruptDataEvent("Error creating iterator", e, true);
        // make the pool look empty
        nextItem = null;
    } finally {
        // make sure we don't do this again
        inited = true;
    }
    while ((nextItem != null) && nextItem.notNull()) {
        try {
            if (!isInline) {
                PointerPointer ptr = PointerPointer.cast(nextItem);
                nextItem = ptr.at(0);
            }
            nextStruct = (StructType) DataType.getStructure(structType, nextItem.getAddress());
        } catch (CorruptDataException e) {
            // may be able to recover from this
            raiseCorruptDataEvent("Error getting next pool item", e, false);
        }
        if (nextStruct != null) {
            // Found an item, move on.
            break;
        } else {
            // the next item in the pool.
            try {
                // continue the pool walk
                nextItem = pool_nextDo();
            } catch (CorruptDataException e) {
                // cannot try to recover from this
                raiseCorruptDataEvent("Error creating iterator", e, true);
                // make the pool look empty
                nextItem = null;
            }
        }
    }
    return nextStruct != null;
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 24 with PointerPointer

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

the class MonitorTableList method initializeCaches.

private static synchronized void initializeCaches() throws CorruptDataException {
    if (!initialized) {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        PointerPointer cursor = vm.monitorTables();
        int count = vm.monitorTableCount().intValue();
        monitorTables = new MonitorTable[count];
        for (int i = 0; i < count; i++) {
            J9MonitorTableListEntryPointer entries = vm.monitorTableList();
            while (entries.notNull()) {
                if (entries.monitorTable().eq(cursor.at(i))) {
                    monitorTables[i] = MonitorTable.from(entries);
                    break;
                }
                entries = entries.next();
            }
        }
        initialized = true;
    }
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) J9MonitorTableListEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer)

Example 25 with PointerPointer

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

the class StringTable method cacheIterator.

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

        private UDATA cacheTableIndex;

        private UDATA cacheSize;

        private PointerPointer cache;

        {
            // Instance initialiser
            cacheTableIndex = new UDATA(0);
            try {
                cacheSize = getCacheSize();
                cache = _stringTable._cacheEA();
            } catch (CorruptDataException e) {
                raiseCorruptDataEvent("Error getting next item", e, false);
                cacheSize = new UDATA(0);
            }
        }

        public boolean hasNext() {
            while (cacheTableIndex.lt(cacheSize)) {
                try {
                    if (cache.at(cacheTableIndex).notNull()) {
                        return true;
                    }
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                }
                cacheTableIndex = cacheTableIndex.add(1);
            }
            return false;
        }

        public J9ObjectPointer next() {
            if (hasNext()) {
                try {
                    J9ObjectPointer cachedString = J9ObjectPointer.cast(cache.at(cacheTableIndex));
                    cacheTableIndex = cacheTableIndex.add(1);
                    return cachedString;
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                    return null;
                }
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public VoidPointer nextAddress() {
            if (hasNext()) {
                VoidPointer address = VoidPointer.cast(cache.add(cacheTableIndex));
                cacheTableIndex = cacheTableIndex.add(1);
                return address;
            } 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 : UDATA(com.ibm.j9ddr.vm29.types.UDATA) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

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