Search in sources :

Example 6 with J9HashTablePointer

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

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

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

the class DumpAllClassloadersCommand method run.

/**
 * Run method for !dumpallclassloaders extension.
 *
 * @param command  !dumpallclassloaders
 * @param args	!dumpallclassloaders extension accepts no args
 * @param context Context
 * @param out PrintStream
 * @throws DDRInteractiveCommandException
 */
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    if (args.length != 0) {
        printUsage(out);
        return;
    }
    try {
        if (J9BuildFlags.env_data64) {
            out.append("+------------------------------------------------------------------------- \n");
            out.append("|    ClassLoader    | SharedLibraries | ClassHashTable  |   jniIDs Pool   |\n");
            out.append("|                   |      Pool       |                 |                 |\n");
            out.append("|                   |-----------------+-----------------+-----------------| \n");
            out.append("|      Address      | used | capacity | used | capacity | used | capacity |\n");
            out.append("+-------------------+-----------------+-----------------+----------------- \n");
        } else {
            out.append("+----------------------------------------------------------------- \n");
            out.append("|ClassLoader| SharedLibraries | ClassHashTable  |   jniIDs Pool   |\n");
            out.append("|           |      Pool       |                 |                 |\n");
            out.append("|           |-----------------+-----------------+-----------------| \n");
            out.append("| Address   | used | capacity | used | capacity | used | capacity |\n");
            out.append("+-----------+-----------------+-----------------+----------------- \n");
        }
        GCClassLoaderIterator iterator = GCClassLoaderIterator.from();
        J9ClassLoaderPointer classLoaderPointer;
        String classLoaderAddress;
        long sharedLibPoolNumOfelements;
        long sharedLibPoolCapacity;
        long classHashTableNumOfelements;
        long classHashTableCapacity;
        long jniIDsPoolNumOfelements;
        long jniIDsPoolCapacity;
        while (iterator.hasNext()) {
            classLoaderPointer = iterator.next();
            classLoaderAddress = classLoaderPointer.getHexAddress();
            J9PoolPointer sharedLibraries = classLoaderPointer.sharedLibraries();
            if (!sharedLibraries.isNull()) {
                Pool<J9PoolPuddlePointer> pool = Pool.fromJ9Pool(sharedLibraries, J9PoolPuddlePointer.class);
                sharedLibPoolNumOfelements = pool.numElements();
                sharedLibPoolCapacity = pool.capacity();
            } else {
                sharedLibPoolNumOfelements = 0;
                sharedLibPoolCapacity = 0;
            }
            J9HashTablePointer classHashTable = classLoaderPointer.classHashTable();
            if (!classHashTable.isNull()) {
                if (!classHashTable.listNodePool().isNull()) {
                    J9PoolPointer listNodePool = classHashTable.listNodePool();
                    Pool<J9PoolPuddlePointer> pool = Pool.fromJ9Pool(listNodePool, J9PoolPuddlePointer.class);
                    classHashTableNumOfelements = pool.numElements();
                    classHashTableCapacity = pool.capacity();
                } else {
                    classHashTableNumOfelements = classHashTable.numberOfNodes().longValue();
                    classHashTableCapacity = classHashTable.tableSize().longValue();
                }
            } else {
                classHashTableNumOfelements = 0;
                classHashTableCapacity = 0;
            }
            J9PoolPointer jniIDs = classLoaderPointer.jniIDs();
            if (!jniIDs.isNull()) {
                Pool<J9PoolPuddlePointer> pool = Pool.fromJ9Pool(jniIDs, J9PoolPuddlePointer.class);
                jniIDsPoolNumOfelements = pool.numElements();
                jniIDsPoolCapacity = pool.capacity();
            } else {
                jniIDsPoolNumOfelements = 0;
                jniIDsPoolCapacity = 0;
            }
            String output = format(classLoaderAddress, sharedLibPoolNumOfelements, sharedLibPoolCapacity, classHashTableNumOfelements, classHashTableCapacity, jniIDsPoolNumOfelements, jniIDsPoolCapacity);
            out.println(output);
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9PoolPointer(com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer) GCClassLoaderIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator) J9ClassLoaderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) J9PoolPuddlePointer(com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddlePointer)

Example 9 with J9HashTablePointer

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

the class CheckStringTable method check.

@Override
public void check() {
    // TODO : wouldn't it be easier to use the iterator?
    try {
        MM_StringTablePointer stringTable = getGCExtensions().stringTable();
        long tableCount = stringTable._tableCount().longValue();
        for (long tableIndex = 0; tableIndex < tableCount; tableIndex++) {
            J9HashTablePointer hashTable = J9HashTablePointer.cast(stringTable._table().at(tableIndex));
            SlotIterator<PointerPointer> stringTableIterator = HashTable.fromJ9HashTable(hashTable, true, PointerPointer.class, new StringTable.StringHashFunction<PointerPointer>(), new StringTable.StringComparatorFunction<PointerPointer>()).iterator();
            while (stringTableIterator.hasNext()) {
                PointerPointer slot = stringTableIterator.next();
                if (slot.notNull()) {
                    if (_engine.checkSlotPool(slot, VoidPointer.cast(hashTable)) != J9MODRON_SLOT_ITERATOR_OK) {
                        return;
                    }
                }
            }
        }
    } catch (CorruptDataException e) {
    // TODO: handle exception
    }
// TODO : what about the cache?
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) MM_StringTablePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_StringTablePointer)

Example 10 with J9HashTablePointer

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

the class CheckStringTable method print.

@Override
public void print() {
    // TODO : wouldn't it be easier to use the iterator?
    try {
        MM_StringTablePointer stringTable = getGCExtensions().stringTable();
        long tableCount = stringTable._tableCount().longValue();
        ScanFormatter formatter = new ScanFormatter(this, "StringTable", stringTable);
        for (long tableIndex = 0; tableIndex < tableCount; tableIndex++) {
            J9HashTablePointer hashTablePtr = J9HashTablePointer.cast(stringTable._table().at(tableIndex));
            HashTable<PointerPointer> hashTable = HashTable.fromJ9HashTable(hashTablePtr, true, PointerPointer.class, new StringTable.StringHashFunction<PointerPointer>(), new StringTable.StringComparatorFunction<PointerPointer>());
            SlotIterator<PointerPointer> stringTableIterator = hashTable.iterator();
            while (stringTableIterator.hasNext()) {
                PointerPointer slot = stringTableIterator.next();
                if (slot.notNull()) {
                    formatter.entry(slot.at(0));
                }
            }
        }
        formatter.end("StringTable", stringTable);
    } catch (CorruptDataException e) {
    // TODO: handle exception
    }
// TODO : what about the cache?
}
Also used : StringTable(com.ibm.j9ddr.vm29.j9.StringTable) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) MM_StringTablePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_StringTablePointer)

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