use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer in project openj9 by eclipse.
the class VmCheckCommand method verifyJ9ROMClass.
private void verifyJ9ROMClass(PrintStream out, J9JavaVMPointer vm, J9ClassPointer clazz) throws CorruptDataException {
J9ROMClassPointer romClass = clazz.romClass();
J9ClassLoaderPointer classLoader = clazz.classLoader();
J9MemorySegmentPointer segment = findSegmentInClassLoaderForAddress(classLoader, romClass);
if (!segment.isNull()) {
long address;
if (romClass.interfaceCount().longValue() != 0) {
address = romClass.interfaces().getAddress();
verifyAddressInSegment(out, vm, segment, address, "romClass->interfaces");
}
if (romClass.romMethodCount().longValue() != 0) {
address = romClass.romMethods().longValue();
verifyAddressInSegment(out, vm, segment, address, "romClass->romMethods");
}
if (romClass.romFieldCount().longValue() != 0) {
address = romClass.romFields().longValue();
verifyAddressInSegment(out, vm, segment, address, "romClass->romFields");
}
if (romClass.innerClassCount().longValue() != 0) {
address = romClass.innerClasses().longValue();
verifyAddressInSegment(out, vm, segment, address, "romClass->innerClasses");
}
U32Pointer cpShapeDescription = romClass.cpShapeDescription();
/* TODO: is !isNull() check required or not? */
if (!cpShapeDescription.isNull()) {
address = cpShapeDescription.getAddress();
verifyAddressInSegment(out, vm, segment, address, "romClass->cpShapeDescription");
}
}
{
J9UTF8Pointer className = romClass.className();
J9UTF8Pointer superclassName = romClass.superclassName();
J9UTF8Pointer outerClassName = romClass.outerClassName();
if (className.isNull() || !verifyUTF8(className)) {
reportError(out, "invalid className=0x%s utf8 for romClass=0x%s", Long.toHexString(className.getAddress()), Long.toHexString(romClass.getAddress()));
}
if (!superclassName.isNull() && !verifyUTF8(superclassName)) {
reportError(out, "invalid superclassName=0x%s utf8 for romClass=0x%s", Long.toHexString(superclassName.getAddress()), Long.toHexString(romClass.getAddress()));
}
if (!outerClassName.isNull() && !verifyUTF8(outerClassName)) {
reportError(out, "invalid outerclassName=0x%s utf8 for romClass=0x%s", Long.toHexString(outerClassName.getAddress()), Long.toHexString(romClass.getAddress()));
}
}
U32 ramConstantPoolCount = romClass.ramConstantPoolCount();
U32 romConstantPoolCount = romClass.romConstantPoolCount();
if (ramConstantPoolCount.gt(romConstantPoolCount)) {
reportError(out, "ramConstantPoolCount=%d > romConstantPoolCount=%d for romClass=0x%s", ramConstantPoolCount.longValue(), romConstantPoolCount.longValue(), Long.toHexString(romClass.getAddress()));
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer in project openj9 by eclipse.
the class VmCheckCommand method checkLocalInternTableSanity.
/*
* Based on vmchk/checkinterntable.c r1.3
*
* J9LocalInternTableSanity sanity:
* if J9JavaVM->dynamicLoadBuffers != NULL
* invariantInternTree check:
* For each J9InternHashTableEntry
* Ensure J9InternHashTableEntry->utf8 is valid
* Ensure J9InternHashTableEntry->classLoader is valid
*/
private void checkLocalInternTableSanity(J9JavaVMPointer vm, PrintStream out) throws CorruptDataException {
int count = 0;
reportMessage(out, "Checking ROM intern string nodes");
J9TranslationBufferSetPointer dynamicLoadBuffers = vm.dynamicLoadBuffers();
if (!dynamicLoadBuffers.isNull()) {
J9DbgROMClassBuilderPointer romClassBuilder = J9DbgROMClassBuilderPointer.cast(dynamicLoadBuffers.romClassBuilder());
J9DbgStringInternTablePointer stringInternTable = romClassBuilder.stringInternTable();
J9InternHashTableEntryPointer node = stringInternTable.headNode();
while (!node.isNull()) {
J9UTF8Pointer utf8 = node.utf8();
J9ClassLoaderPointer classLoader = node.classLoader();
if (!verifyUTF8(utf8)) {
reportError(out, "invalid utf8=0x%s for node=0x%s", Long.toHexString(utf8.getAddress()), Long.toHexString(node.getAddress()));
}
if (!verifyJ9ClassLoader(vm, classLoader)) {
reportError(out, "invalid classLoader=0x%s for node=0x%s", Long.toHexString(classLoader.getAddress()), Long.toHexString(node.getAddress()));
}
count++;
node = node.nextNode();
}
}
reportMessage(out, "Checking %d ROM intern string nodes done", count);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer in project openj9 by eclipse.
the class DTFJJavaRuntime method getJavaClassLoaders.
@SuppressWarnings("rawtypes")
public Iterator getJavaClassLoaders() {
if (classLoaders != null) {
// return cached set of class loaders
return classLoaders.iterator();
}
classLoaders = new LinkedList<Object>();
GCClassLoaderIterator classLoaderIterator;
try {
classLoaderIterator = GCClassLoaderIterator.from();
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
classLoaders.add(cd);
return classLoaders.iterator();
}
AddCorruptionToListListener corruptionListener = new AddCorruptionToListListener(classLoaders);
register(corruptionListener);
try {
while (!corruptionListener.fatalCorruption() && classLoaderIterator.hasNext()) {
J9ClassLoaderPointer next = classLoaderIterator.next();
if (next != null) {
classLoaders.add(new DTFJJavaClassloader(next));
}
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
classLoaders.add(cd);
}
unregister(corruptionListener);
return classLoaders.iterator();
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer in project openj9 by eclipse.
the class RootScanner method scanClassLoaders.
protected void scanClassLoaders() throws CorruptDataException {
J9ClassLoaderPointer sysClassLoader = _vm.systemClassLoader();
J9ClassLoaderPointer appClassLoader = J9ClassLoaderPointer.cast(_vm.applicationClassLoader());
GCClassLoaderIterator classLoaderIterator = GCClassLoaderIterator.from();
while (classLoaderIterator.hasNext()) {
J9ClassLoaderPointer loader = classLoaderIterator.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 (loader.eq(sysClassLoader) || loader.eq(appClassLoader)) {
reachability = Reachability.STRONG;
} else {
reachability = Reachability.WEAK;
}
}
} else {
reachability = Reachability.STRONG;
}
setReachability(reachability);
doClassLoader(loader);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer 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);
}
}
}
Aggregations