Search in sources :

Example 1 with J9DbgStringInternTablePointer

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

the class VmCheckCommand method checkLocalInternTableSanity.

/*
	 *  Based on vmchk/checkinterntable.c r1.3
	 * 
	 *	J9LocalInternTableSanity sanity:
	 *		if J9JavaVM->dynamicLoadBuffers != NULL
	 *			invariantInternTree check:
	 *				For each J9InternHashTableEntry
	 *					Ensure J9InternHashTableEntry->utf8 is valid
	 *					Ensure J9InternHashTableEntry->classLoader is valid
	 */
private void checkLocalInternTableSanity(J9JavaVMPointer vm, PrintStream out) throws CorruptDataException {
    int count = 0;
    reportMessage(out, "Checking ROM intern string nodes");
    J9TranslationBufferSetPointer dynamicLoadBuffers = vm.dynamicLoadBuffers();
    if (!dynamicLoadBuffers.isNull()) {
        J9DbgROMClassBuilderPointer romClassBuilder = J9DbgROMClassBuilderPointer.cast(dynamicLoadBuffers.romClassBuilder());
        J9DbgStringInternTablePointer stringInternTable = romClassBuilder.stringInternTable();
        J9InternHashTableEntryPointer node = stringInternTable.headNode();
        while (!node.isNull()) {
            J9UTF8Pointer utf8 = node.utf8();
            J9ClassLoaderPointer classLoader = node.classLoader();
            if (!verifyUTF8(utf8)) {
                reportError(out, "invalid utf8=0x%s for node=0x%s", Long.toHexString(utf8.getAddress()), Long.toHexString(node.getAddress()));
            }
            if (!verifyJ9ClassLoader(vm, classLoader)) {
                reportError(out, "invalid classLoader=0x%s for node=0x%s", Long.toHexString(classLoader.getAddress()), Long.toHexString(node.getAddress()));
            }
            count++;
            node = node.nextNode();
        }
    }
    reportMessage(out, "Checking %d ROM intern string nodes done", count);
}
Also used : J9TranslationBufferSetPointer(com.ibm.j9ddr.vm29.pointer.generated.J9TranslationBufferSetPointer) J9ClassLoaderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer) J9DbgStringInternTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9DbgStringInternTablePointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer) J9DbgROMClassBuilderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9DbgROMClassBuilderPointer) J9InternHashTableEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9InternHashTableEntryPointer)

Example 2 with J9DbgStringInternTablePointer

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

the class WalkInternTableCommand method walkLocalTable.

/**
 * Walks through the local string intern table nodes and prints the info about them on each line.
 * @param out
 * @throws CorruptDataException
 * @return void
 */
private void walkLocalTable(PrintStream out) throws CorruptDataException {
    int totalWeight = 0;
    J9DbgStringInternTablePointer stringInternTablePtr = getRomClassBuilderPtr(out);
    if (stringInternTablePtr.isNull()) {
        out.append("StringInternTable is null" + nl);
        return;
    }
    J9InternHashTableEntryPointer currentEntryPtr = stringInternTablePtr.headNode();
    if (currentEntryPtr.isNull()) {
        out.append("HeadNode is null" + nl);
        return;
    }
    int counter = 1;
    out.append("=================================================================================" + nl);
    out.append(tab(2) + "WALKING LOCAL INTERN HASHTABLE (stringInternTable )" + stringInternTablePtr.getHexAddress() + ")" + nl);
    out.append(tab(2) + "FROM: MRU (MOST RECENTLY USED)" + nl);
    out.append(tab(2) + "TO: LRU (LEAST RECENTLY USED)" + nl);
    out.append("=================================================================================" + nl);
    while (!currentEntryPtr.isNull()) {
        out.append(counter + "." + tab + "Local Table Entry < !J9InternHashTableEntry " + currentEntryPtr.getHexAddress() + " Flags: " + currentEntryPtr.flags().getHexValue() + " IWeight: " + currentEntryPtr.internWeight().longValue() + " ClassLoader: " + "!J9ClassLoader " + currentEntryPtr.classLoader().getHexAddress() + ">" + tab + "UTF8 <Add: " + currentEntryPtr.utf8().getHexAddress() + " Data: \"" + J9UTF8Helper.stringValue(currentEntryPtr.utf8()) + "\">" + nl);
        totalWeight += currentEntryPtr.internWeight().longValue();
        currentEntryPtr = currentEntryPtr.nextNode();
        counter++;
    }
    out.append("Total Weight = " + totalWeight + nl);
    out.append("=================================================================================" + nl);
    out.append(tab(2) + "WALKING LOCAL INTERN HASHTABLE COMPLETED" + nl);
    out.append("=================================================================================" + nl);
}
Also used : J9DbgStringInternTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9DbgStringInternTablePointer) J9InternHashTableEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9InternHashTableEntryPointer)

Example 3 with J9DbgStringInternTablePointer

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

the class WalkInternTableCommand method getRomClassBuilderPtr.

/**
 * This method is used to get the pointer to the RomClassBuilder
 * @param out	PrintStream
 * @return void
 * @throws CorruptDataException
 */
private J9DbgStringInternTablePointer getRomClassBuilderPtr(PrintStream out) throws CorruptDataException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        if (vm.isNull()) {
            out.append("VM can not be found " + nl);
            return null;
        }
        J9TranslationBufferSetPointer translationBufferSetPtr = vm.dynamicLoadBuffers();
        if (translationBufferSetPtr.isNull()) {
            out.append("J9TranslationBufferSet can not be found " + nl);
            return null;
        }
        J9DbgROMClassBuilderPointer romClassBuilderPtr = J9DbgROMClassBuilderPointer.cast(translationBufferSetPtr.romClassBuilder());
        if (romClassBuilderPtr.isNull()) {
            out.append("romClassBuilderPtr can not be found " + nl);
            return null;
        }
        return romClassBuilderPtr.stringInternTable();
    } catch (CorruptDataException e) {
        throw e;
    }
}
Also used : J9TranslationBufferSetPointer(com.ibm.j9ddr.vm29.pointer.generated.J9TranslationBufferSetPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9DbgROMClassBuilderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9DbgROMClassBuilderPointer)

Aggregations

J9DbgROMClassBuilderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9DbgROMClassBuilderPointer)2 J9DbgStringInternTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9DbgStringInternTablePointer)2 J9InternHashTableEntryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9InternHashTableEntryPointer)2 J9TranslationBufferSetPointer (com.ibm.j9ddr.vm29.pointer.generated.J9TranslationBufferSetPointer)2 CorruptDataException (com.ibm.j9ddr.CorruptDataException)1 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9UTF8Pointer (com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)1