Search in sources :

Example 16 with CorruptData

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();
}
Also used : JavaClass(com.ibm.dtfj.java.JavaClass) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) CorruptData(com.ibm.dtfj.image.j9.CorruptData)

Example 17 with CorruptData

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;
}
Also used : Iterator(java.util.Iterator) JavaThread(com.ibm.dtfj.java.JavaThread) CorruptData(com.ibm.dtfj.image.j9.CorruptData) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Example 18 with CorruptData

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");
    }
}
Also used : DataUnavailable(com.ibm.dtfj.image.DataUnavailable) CorruptData(com.ibm.dtfj.image.j9.CorruptData) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) MemoryAccessException(com.ibm.dtfj.image.MemoryAccessException)

Aggregations

CorruptData (com.ibm.dtfj.image.j9.CorruptData)18 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)17 MemoryAccessException (com.ibm.dtfj.image.MemoryAccessException)10 JavaClass (com.ibm.dtfj.java.JavaClass)8 Iterator (java.util.Iterator)8 ImagePointer (com.ibm.dtfj.image.ImagePointer)7 JavaObject (com.ibm.dtfj.java.JavaObject)6 ArrayList (java.util.ArrayList)4 Vector (java.util.Vector)3 List (java.util.List)2 DataUnavailable (com.ibm.dtfj.image.DataUnavailable)1 ImageSection (com.ibm.dtfj.image.j9.ImageSection)1 JavaThread (com.ibm.dtfj.java.JavaThread)1