use of com.ibm.dtfj.image.j9.CorruptData in project openj9 by eclipse.
the class JavaClassLoader method getCachedClasses.
/* (non-Javadoc)
* @see com.ibm.dtfj.java.JavaClassLoader#getCachedClasses()
*/
public Iterator getCachedClasses() {
if (null == _cached) {
// a cached class is any class known to the loader
Iterator ids = _classIDs.iterator();
_cached = new ArrayList();
while (ids.hasNext()) {
long oneID = ((Long) ids.next()).longValue();
JavaClass oneClass = _javaVM.getClassForID(oneID);
if (null == oneClass) {
_cached.add(new CorruptData("Cache reference to unknown class " + oneID, null));
} else {
_cached.add(oneClass);
}
}
}
return _cached.iterator();
}
use of com.ibm.dtfj.image.j9.CorruptData in project openj9 by eclipse.
the class JavaMonitor method getOwner.
/* (non-Javadoc)
* @see com.ibm.dtfj.java.JavaMonitor#getOwner()
*/
public JavaThread getOwner() throws CorruptDataException {
JavaThread owningThread = null;
Iterator allThreads = _javaVM.getThreads();
while (allThreads.hasNext()) {
JavaThread oneThread = (JavaThread) allThreads.next();
if (oneThread.getJNIEnv().getAddress() == _owningThreadID) {
owningThread = oneThread;
break;
}
}
if ((null == owningThread) && (0 != _owningThreadID)) {
// we have an owner but we couldn't find it. That implies that the XML is corrupt
throw new CorruptDataException(new CorruptData("Monitor owner not found", _javaVM.pointerInAddressSpace(_owningThreadID)));
}
return owningThread;
}
use of com.ibm.dtfj.image.j9.CorruptData in project openj9 by eclipse.
the class JavaObject method getPersistentHashcode.
/* (non-Javadoc)
* @see com.ibm.dtfj.java.JavaObject#getPersistentHashcode()
*/
public long getPersistentHashcode() throws DataUnavailable, CorruptDataException {
// this is a terrible way to do this since we know that it _will_ _break_ in the future. It is, however, the best that we can do
if (_javaVM.objectShouldInferHash()) {
try {
int flags = ((com.ibm.dtfj.java.j9.JavaAbstractClass) getJavaClass()).readFlagsFromInstance(this);
// now mask out the non-hash bits, shift and return
// high 15 bits, omitting most significant
int twoBytes = flags & 0x7FFF0000;
long hash = (twoBytes >> 16) | twoBytes;
return hash;
} catch (MemoryAccessException e) {
// if we can't access the memory, the core must be corrupt
throw new CorruptDataException(new CorruptData("Address in object header but unreadable", _basePointer));
}
} else {
throw new DataUnavailable("Unknown hash strategy for this VM version");
}
}
Aggregations