Search in sources :

Example 6 with GCClassHeapIterator

use of com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator in project openj9 by eclipse.

the class VmCheckCommand method checkJ9ROMClassSanity.

/*
	 *  Based on vmchk/checkromclasses.c r1.5
	 * 
	 *	J9ROMClass sanity:
	 *		SRP check:
	 *			Ensure J9ROMClass->interfaces SRP is in the same segment if J9ROMClass->interfaceCount != 0.
	 *			Ensure J9ROMClass->romMethods SRP is in the same segment if J9ROMClass->romMethodCount != 0.
	 *			Ensure J9ROMClass->romFields SRP is in the same segment if J9ROMClass->romFieldCount != 0.
	 *			Ensure J9ROMClass->innerClasses SRP is in the same segment if J9ROMClass->innerClasseCount != 0.
	 *			Ensure cpShapeDescription in the same segment.
	 *			Ensure all SRPs are in range on 64 bit platforms (including className, superclassName, and outerClassName).
	 *
	 *		ConstantPool count check:
	 *			Ensure ramConstantPoolCount <= romConstantPoolCount
	 */
private void checkJ9ROMClassSanity(J9JavaVMPointer vm, PrintStream out) throws CorruptDataException {
    reportMessage(out, "Checking ROM classes");
    // Stolen from RootScaner.scanClasses()
    // GCClassLoaderIterator gcClassLoaderIterator =
    // GCClassLoaderIterator.from();
    GCSegmentIterator segmentIterator = GCSegmentIterator.fromJ9MemorySegmentList(vm.classMemorySegments(), J9MemorySegment.MEMORY_TYPE_RAM_CLASS);
    int count = 0;
    while (segmentIterator.hasNext()) {
        J9MemorySegmentPointer segment = segmentIterator.next();
        GCClassHeapIterator classHeapIterator = GCClassHeapIterator.fromJ9MemorySegment(segment);
        while (classHeapIterator.hasNext()) {
            J9ClassPointer clazz = classHeapIterator.next();
            verifyJ9ROMClass(out, vm, clazz);
            count++;
        }
    }
    reportMessage(out, "Checking %d ROM classes done", count);
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) GCClassHeapIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator) GCSegmentIterator(com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)

Aggregations

GCClassHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator)6 GCSegmentIterator (com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)6 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)6 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)5 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)2 CorruptDataException (com.ibm.j9ddr.CorruptDataException)1