Search in sources :

Example 46 with J9ClassPointer

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

the class RootScanner method scanClasses.

protected void scanClasses() throws CorruptDataException {
    J9ClassLoaderPointer sysClassLoader = _vm.systemClassLoader();
    J9ClassLoaderPointer appClassLoader = J9ClassLoaderPointer.cast(_vm.applicationClassLoader());
    GCSegmentIterator segmentIterator = GCSegmentIterator.fromJ9MemorySegmentList(_vm.classMemorySegments(), J9MemorySegment.MEMORY_TYPE_RAM_CLASS);
    while (segmentIterator.hasNext()) {
        J9MemorySegmentPointer segment = segmentIterator.next();
        GCClassHeapIterator classHeapIterator = GCClassHeapIterator.fromJ9MemorySegment(segment);
        while (classHeapIterator.hasNext()) {
            J9ClassPointer clazz = classHeapIterator.next();
            Reachability reachability;
            if (J9BuildFlags.gc_dynamicClassUnloading) {
                long dynamicClassUnloadingFlag = _extensions.dynamicClassUnloading();
                if (MM_GCExtensions$DynamicClassUnloading.DYNAMIC_CLASS_UNLOADING_NEVER == dynamicClassUnloadingFlag) {
                    reachability = Reachability.STRONG;
                } else {
                    if (clazz.classLoader().eq(sysClassLoader) || clazz.classLoader().eq(appClassLoader)) {
                        reachability = Reachability.STRONG;
                    } else {
                        reachability = Reachability.WEAK;
                    }
                }
            } else {
                reachability = Reachability.STRONG;
            }
            setReachability(reachability);
            doClass(clazz);
        }
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ClassLoaderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) GCClassHeapIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator) GCSegmentIterator(com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)

Example 47 with J9ClassPointer

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

the class GCClassLocalInterfaceIterator method next.

public J9ClassPointer next() {
    if (hasNext()) {
        J9ClassPointer next;
        try {
            next = iTable.interfaceClass();
            iTable = iTable.next();
            return next;
        } catch (CorruptDataException e) {
            // can try to recover from this
            raiseCorruptDataEvent("Error getting next item", e, false);
            return null;
        }
    } else {
        throw new NoSuchElementException("There are no more items available through this iterator");
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 48 with J9ClassPointer

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

the class GCClassSuperclassesIterator method next.

public J9ClassPointer next() {
    if (hasNext()) {
        try {
            J9ClassPointer next = J9ClassPointer.cast(superclasses.at(index));
            index = index.add(1);
            return next;
        } catch (CorruptDataException e) {
            // can try to recover from this
            raiseCorruptDataEvent("Error getting next item", e, false);
            return null;
        }
    } else {
        throw new NoSuchElementException("There are no more items available through this iterator");
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 49 with J9ClassPointer

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

the class ClassIterator method next.

public J9ClassPointer next() {
    if (next == null) {
        setNextItem();
    }
    if (hasNext()) {
        J9ClassPointer ptr = next;
        setNextItem();
        return ptr;
    }
    throw new NoSuchElementException();
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 50 with J9ClassPointer

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

the class J9IndexableObjectHelper method getDataAsString.

public static String getDataAsString(J9IndexableObjectPointer array, int dumpLimit, int characterDumpLimit) throws CorruptDataException {
    StringWriter buf = new StringWriter();
    J9ClassPointer clazz = J9ObjectHelper.clazz(J9ObjectPointer.cast(array));
    char typeChar = J9ClassHelper.getName(clazz).charAt(1);
    int length = J9IndexableObjectHelper.size(array).intValue();
    int limit = 0;
    if (typeChar != 'C') {
        limit = dumpLimit;
    } else {
        limit = characterDumpLimit;
    }
    buf.write("{ ");
    int i;
    for (i = 0; i < Math.min(length, limit); i++) {
        Object data = J9IndexableObjectHelper.getData(array);
        switch(typeChar) {
            case 'B':
                buf.write("0x");
                buf.write(Integer.toHexString(((byte[]) data)[i]));
                break;
            case 'C':
                char ch = ((char[]) data)[i];
                if (ch > 31 && ch < 127) {
                    buf.write(ch);
                } else {
                    buf.write('?');
                }
                break;
            case 'D':
                buf.write(Double.toString(((double[]) data)[i]));
                break;
            case 'F':
                buf.write(Float.toString(((float[]) data)[i]));
                break;
            case 'I':
                buf.write("0x");
                buf.write(Integer.toHexString(((int[]) data)[i]));
                break;
            case 'J':
                buf.write("0x");
                buf.write(Long.toHexString(((long[]) data)[i]));
                break;
            case 'S':
                buf.write("0x");
                buf.write(Integer.toHexString(((short[]) data)[i]));
                break;
            case 'Z':
                buf.write(((boolean[]) data)[i] ? "true" : "false");
                break;
            case 'L':
            case '[':
                {
                    J9ObjectPointer item = ((J9ObjectPointer[]) data)[i];
                    if (null == item) {
                        buf.write("null");
                    } else {
                        buf.write("0x");
                        buf.write(Long.toHexString(item.longValue()));
                    }
                    break;
                }
            default:
                buf.write("?");
        }
        if (typeChar != 'C' && (i != length - 1)) {
            /* We aren't printing out a character and we aren't the last element */
            buf.write(", ");
        }
    }
    if (i != length) {
        /* We hit the limit */
        buf.write("... ");
    }
    buf.write(" }");
    return buf.toString();
}
Also used : StringWriter(java.io.StringWriter) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Aggregations

J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)67 CorruptDataException (com.ibm.j9ddr.CorruptDataException)34 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)13 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)13 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)12 UDATA (com.ibm.j9ddr.vm29.types.UDATA)12 U32 (com.ibm.j9ddr.vm29.types.U32)11 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)9 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)9 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)8 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)8 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)7 NoSuchElementException (java.util.NoSuchElementException)7 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)6 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)6 GCClassHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator)5 GCSegmentIterator (com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)5 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)5 J9ITablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ITablePointer)5