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);
}
}
}
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");
}
}
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");
}
}
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();
}
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();
}
Aggregations