use of com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator 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);
}
use of com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator in project openj9 by eclipse.
the class SegmentTree method setSegmentList.
protected void setSegmentList(J9MemorySegmentListPointer segmentList) {
ArrayList<J9MemorySegmentPointer> segments = new ArrayList<J9MemorySegmentPointer>();
try {
// Batch up the entries
GCSegmentIterator iterator = GCSegmentIterator.fromJ9MemorySegmentList(segmentList, 0);
while (iterator.hasNext()) {
segments.add(iterator.next());
}
} catch (CorruptDataException e) {
EventManager.raiseCorruptDataEvent("Corrupted segment in list", e, false);
cache = new J9MemorySegmentPointer[0];
}
// And sort them
Collections.sort(segments, new Comparator<J9MemorySegmentPointer>() {
public int compare(J9MemorySegmentPointer seg1, J9MemorySegmentPointer seg2) {
try {
return seg1.eq(seg2) ? 0 : seg1.heapBase().lt(seg2.heapBase()) ? -1 : 1;
} catch (CorruptDataException e) {
EventManager.raiseCorruptDataEvent("Corrupted segment in list", e, false);
return -1;
}
}
});
cache = segments.toArray(new J9MemorySegmentPointer[segments.size()]);
}
Aggregations