Search in sources :

Example 46 with J9JavaVMPointer

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

the class VmCheckCommand method verifyObsoleteJ9Class.

private boolean verifyObsoleteJ9Class(J9JavaVMPointer javaVM, PrintStream out, J9ClassPointer classPointer) throws CorruptDataException {
    boolean passed = true;
    J9ClassPointer replacedClass;
    J9ClassPointer currentClass = J9ClassHelper.currentClass(classPointer);
    verifyJ9ClassHeader(javaVM, out, currentClass);
    replacedClass = currentClass.replacedClass();
    while (!replacedClass.isNull()) {
        if (replacedClass.eq(classPointer)) {
            /* Expected case: found classPointer in the list. */
            break;
        }
        replacedClass = replacedClass.replacedClass();
    }
    if (replacedClass.isNull()) {
        reportError(out, "obsolete class=0x%s is not in replaced list on currentClass=0x%s", Long.toHexString(classPointer.getAddress()), Long.toHexString(currentClass.getAddress()));
        passed = false;
    }
    return passed;
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)

Example 47 with J9JavaVMPointer

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

the class GCCheckRunner method run.

@SuppressWarnings("unchecked")
public void run(IVMData vmData, Object[] userData) {
    List<String> argList = ((List<String>) userData[0]);
    String[] args = argList.toArray(new String[argList.size()]);
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        run(vm, args, System.out);
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
}
Also used : J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 48 with J9JavaVMPointer

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

the class J9ObjectFieldOffsetIterator_V1 method copyHiddenInstanceFieldsList.

// Based on fieldOffsetsStartDo in resolvefield.cpp
private LinkedList<HiddenInstanceField> copyHiddenInstanceFieldsList(J9JavaVMPointer vm) throws CorruptDataException {
    LinkedList<HiddenInstanceField> list = new LinkedList<HiddenInstanceField>();
    J9HiddenInstanceFieldPointer fieldPointer = vm.hiddenInstanceFields();
    while (!fieldPointer.isNull()) {
        list.add(new HiddenInstanceField(fieldPointer));
        fieldPointer = fieldPointer.next();
    }
    return list;
}
Also used : J9HiddenInstanceFieldPointer(com.ibm.j9ddr.vm29.pointer.generated.J9HiddenInstanceFieldPointer) LinkedList(java.util.LinkedList)

Example 49 with J9JavaVMPointer

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

the class JavaLangClassLoaderHelper method getParent.

public static J9ObjectPointer getParent(J9ObjectPointer loader) throws CorruptDataException {
    if (loader.isNull()) {
        return J9ObjectPointer.NULL;
    }
    if (parentOffset == null) {
        // Iterate through all the fields of Ljava/lang/ClassLoader; until you find "parent"
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9ClassPointer javaLangClassLoader = J9ClassLoaderHelper.findClass(vm.systemClassLoader(), "Ljava/lang/ClassLoader;");
        Iterator<J9ObjectFieldOffset> fieldIterator = J9ClassHelper.getFieldOffsets(javaLangClassLoader);
        while (fieldIterator.hasNext()) {
            Object nextField = fieldIterator.next();
            if (nextField instanceof J9ObjectFieldOffset) {
                J9ObjectFieldOffset offset = (J9ObjectFieldOffset) nextField;
                if ("parent".equals(offset.getName())) {
                    parentOffset = offset;
                    break;
                }
            }
        }
    }
    if (parentOffset != null) {
        return J9ObjectHelper.getObjectField(loader, parentOffset);
    } else {
        throw new CorruptDataException("Unable to find field offset for the 'parent' field");
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 50 with J9JavaVMPointer

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

the class ObjectHash method getSalt.

private static U32 getSalt(J9JavaVMPointer vm, UDATA objectPointer) throws CorruptDataException {
    /* set up the default salt */
    U32 salt = (new U32(1421595292)).bitXor(new U32(UDATA.cast(vm)));
    J9IdentityHashDataPointer hashData = vm.identityHashData();
    UDATA saltPolicy = hashData.hashSaltPolicy();
    /* Replacing case statement in C with an if-else if statements since case expressions must use constant */
    if (saltPolicy.eq(J9IdentityHashData.J9_IDENTITY_HASH_SALT_POLICY_STANDARD)) {
        /* Gencon/optavgpause/optthruput use the default salt for non heap and
			 * tenure space but they use a table salt for the nursery.
			 *
			 * hashData->hashData1 is nursery base
			 * hashData->hashData2 is nursery top
			 */
        if (objectPointer.gte(hashData.hashData1())) {
            if (objectPointer.lt(hashData.hashData2())) {
                /* Object is in the nursery */
                salt = hashData.hashSaltTableEA().at(0);
            } else {
            /* not in the heap so use default salt */
            }
        } else {
        /* not in the nursery so use default salt */
        }
    } else if (saltPolicy.eq(J9IdentityHashData.J9_IDENTITY_HASH_SALT_POLICY_REGION)) {
        if (objectPointer.gte(hashData.hashData1())) {
            if (objectPointer.lt(hashData.hashData2())) {
                UDATA heapDelta = objectPointer.sub(hashData.hashData1());
                UDATA index = heapDelta.rightShift(hashData.hashData3());
                salt = hashData.hashSaltTableEA().at(index);
            } else {
            /* not in the heap so use default salt */
            }
        } else {
        /* not in the heap so use default salt */
        }
    } else if (saltPolicy.eq(J9IdentityHashData.J9_IDENTITY_HASH_SALT_POLICY_NONE)) {
    /* Use default salt */
    } else {
        /* Unrecognized salt policy.  Should assert but we are in util */
        throw new CorruptDataException("Invalid salt policy");
    }
    return salt;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9IdentityHashDataPointer(com.ibm.j9ddr.vm29.pointer.generated.J9IdentityHashDataPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)57 CorruptDataException (com.ibm.j9ddr.CorruptDataException)49 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)39 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)23 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)17 UDATA (com.ibm.j9ddr.vm29.types.UDATA)13 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)10 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)8 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)8 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)6 PatternString (com.ibm.j9ddr.util.PatternString)5 MonitorIterator (com.ibm.j9ddr.vm29.j9.walkers.MonitorIterator)5 ROMClassesIterator (com.ibm.j9ddr.vm29.j9.walkers.ROMClassesIterator)5 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)5 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)5 MM_HeapRegionManagerPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer)5 Table (com.ibm.j9ddr.tools.ddrinteractive.Table)4 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)4 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)4 J9ThreadMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer)4