Search in sources :

Example 1 with J9HashTablePointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer 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 2 with J9HashTablePointer

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

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

the class StringTable method search.

public J9ObjectPointer search(J9ObjectPointer objectPointer) throws CorruptDataException {
    UDATA hashCode = _hashFn.hash(PointerPointer.cast(objectPointer));
    UDATA tableIndex = getTableIndex(hashCode);
    J9HashTablePointer hashTablePtr = getTable(tableIndex);
    HashTable<J9ObjectPointer> currentHashTable = HashTable.fromJ9HashTable(hashTablePtr, false, J9ObjectPointer.class, new StringTable.StringHashFunction<J9ObjectPointer>(), new StringTable.StringComparatorFunction<J9ObjectPointer>());
    J9ObjectPointer result = currentHashTable.find(objectPointer);
    return result;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) MM_StringTable(com.ibm.j9ddr.vm29.structure.MM_StringTable) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 4 with J9HashTablePointer

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

the class ClassIterator method fromJ9Classloader.

public static Iterator<J9ClassPointer> fromJ9Classloader(J9ClassLoaderPointer loader) throws CorruptDataException {
    J9HashTablePointer table = loader.classHashTable();
    Iterator<J9ClassPointer> iterator = null;
    if (table.listNodePool().notNull()) {
        iterator = new ClassIterator(Pool.fromJ9Pool(table.listNodePool(), J9ClassPointer.class, false).iterator());
    } else {
        iterator = new ArrayIterator<J9ClassPointer>(J9ClassPointer.class, table.tableSize().intValue(), table.nodes()).iterator();
    }
    return new ClassIterator(iterator);
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer)

Example 5 with J9HashTablePointer

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

the class DumpContendedLoadTable method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    if (0 != args.length) {
        String argument = args[0];
        if (argument.equalsIgnoreCase("help")) {
            help(out);
            return;
        }
    }
    try {
        J9JavaVMPointer javaVM = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9HashTablePointer contTable = javaVM.contendedLoadTable();
        J9PoolPointer poolPtr = contTable.listNodePool();
        Pool<J9ContendedLoadTableEntryPointer> pool = Pool.fromJ9Pool(poolPtr, J9ContendedLoadTableEntryPointer.class);
        SlotIterator<J9ContendedLoadTableEntryPointer> poolIterator = pool.iterator();
        if (poolIterator.hasNext()) {
            out.println("Active class loads:");
            while (poolIterator.hasNext()) {
                J9ContendedLoadTableEntryPointer entryPointer = poolIterator.next();
                String ldStatus = loadingStatusValues.get(entryPointer.status().longValue());
                if (null == ldStatus) {
                    ldStatus = "ILLEGAL VALUE: " + entryPointer.status();
                }
                J9VMThreadPointer loadingThread = entryPointer.thread();
                out.print(String.format("\tClassname: %s;\n\t\tLoader:  %s; Loading thread: %s %s\n\t\tStatus: %s; Table entry hash 0x%X\n", entryPointer.className().getCStringAtOffset(0, entryPointer.classNameLength().longValue()), entryPointer.classLoader().formatShortInteractive(), J9VMThreadHelper.getName(loadingThread), loadingThread.formatShortInteractive(), ldStatus, entryPointer.hashValue().longValue()));
            }
            MonitorIterator iterator = new MonitorIterator(javaVM);
            while (iterator.hasNext()) {
                Object current = iterator.next();
                if (current instanceof J9ThreadMonitorPointer) {
                    // System Monitor
                    SystemMonitor monitor = SystemMonitor.fromJ9ThreadMonitor((J9ThreadMonitorPointer) current);
                    final String monitorName = monitor.getName();
                    if (monitorName.matches(".*VM class table.*")) {
                        List<J9ThreadPointer> waitingThreads = monitor.getWaitingThreads();
                        if (!waitingThreads.isEmpty()) {
                            out.print("Waiting threads:\n");
                            for (J9ThreadPointer tp : waitingThreads) {
                                J9VMThreadPointer vmThread = J9ThreadHelper.getVMThread(tp);
                                if (vmThread.notNull()) {
                                    out.print(String.format("\t%s\t%s\n", vmThread.formatShortInteractive(), J9VMThreadHelper.getName(vmThread)));
                                } else {
                                    out.print(String.format("\t%s\t%s\n", tp.formatShortInteractive(), "[osthread]"));
                                }
                            }
                        }
                        break;
                    }
                }
            }
        } else {
            out.println("No active class loads");
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9ThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9ThreadMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) J9PoolPointer(com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer) MonitorIterator(com.ibm.j9ddr.vm29.j9.walkers.MonitorIterator) SystemMonitor(com.ibm.j9ddr.vm29.j9.SystemMonitor) J9ContendedLoadTableEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ContendedLoadTableEntryPointer) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)

Aggregations

J9HashTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer)7 CorruptDataException (com.ibm.j9ddr.CorruptDataException)5 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)4 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)2 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)2 MM_StringTablePointer (com.ibm.j9ddr.vm29.pointer.generated.MM_StringTablePointer)2 StringTable (com.ibm.j9ddr.vm29.j9.StringTable)1 SystemMonitor (com.ibm.j9ddr.vm29.j9.SystemMonitor)1 GCClassLoaderIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator)1 MonitorIterator (com.ibm.j9ddr.vm29.j9.walkers.MonitorIterator)1 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)1 J9AVLTreeNodePointer (com.ibm.j9ddr.vm29.pointer.generated.J9AVLTreeNodePointer)1 J9AVLTreePointer (com.ibm.j9ddr.vm29.pointer.generated.J9AVLTreePointer)1 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)1 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)1 J9ContendedLoadTableEntryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ContendedLoadTableEntryPointer)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)1 J9PoolPuddlePointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddlePointer)1 J9ThreadMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer)1