Search in sources :

Example 6 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class ObjectMonitor_V1 method getBlockedThreads.

private static List<J9VMThreadPointer> getBlockedThreads(J9ObjectPointer blockingObject) throws CorruptDataException {
    // Do a single walk and cache all the results.
    if (blockedThreadsCache == null) {
        blockedThreadsCache = new HashMap<J9ObjectPointer, List<J9VMThreadPointer>>();
        GCVMThreadListIterator iterator = GCVMThreadListIterator.from();
        while (iterator.hasNext()) {
            J9VMThreadPointer vmThread = iterator.next();
            if (vmThread.publicFlags().allBitsIn(J9Consts.J9_PUBLIC_FLAGS_THREAD_BLOCKED)) {
                J9ObjectPointer object = vmThread.blockingEnterObject();
                if (object.notNull()) {
                    List<J9VMThreadPointer> list = blockedThreadsCache.get(object);
                    if (list == null) {
                        list = new ArrayList<J9VMThreadPointer>();
                        blockedThreadsCache.put(object, list);
                    }
                    list.add(vmThread);
                }
            }
        }
    }
    return blockedThreadsCache.get(blockingObject);
}
Also used : GCVMThreadListIterator(com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) ArrayList(java.util.ArrayList) List(java.util.List) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 7 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class GCVMThreadListIterator method next.

public J9VMThreadPointer next() {
    try {
        if (hasNext()) {
            J9VMThreadPointer next;
            next = currentVMThread;
            currentVMThread = currentVMThread.linkNext();
            if (currentVMThread.equals(initialVMThread)) {
                currentVMThread = J9VMThreadPointer.NULL;
            }
            return next;
        } else {
            throw new NoSuchElementException("There are no more items available through this iterator");
        }
    } catch (CorruptDataException cde) {
        // link to next vm thread is broken, terminate iterator
        currentVMThread = J9VMThreadPointer.NULL;
        raiseCorruptDataEvent("Error getting next item", cde, false);
        return null;
    }
}
Also used : J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 8 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class TerseStackWalkerCallbacks method frameWalkFunction.

public FrameCallbackResult frameWalkFunction(J9VMThreadPointer walkThread, WalkState walkState) {
    try {
        if (walkState.method.notNull()) {
            J9MethodPointer method = walkState.method;
            J9UTF8Pointer className = StackWalkerUtils.UNTAGGED_METHOD_CP(method).ramClass().romClass().className();
            J9ROMMethodPointer romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
            J9UTF8Pointer name = romMethod.nameAndSignature().name();
            J9UTF8Pointer sig = romMethod.nameAndSignature().signature();
            StackWalkerUtils.swPrintf(walkState, 0, "\t!j9method {3}   {0}.{1}{2}", J9UTF8Helper.stringValue(className), J9UTF8Helper.stringValue(name), J9UTF8Helper.stringValue(sig), walkState.method.getHexAddress());
            return FrameCallbackResult.KEEP_ITERATING;
        }
        if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_JNI_NATIVE_METHOD) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        Native method frame");
        } else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_GENERIC_SPECIAL) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        Generic special frame");
        } else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_METHODTYPE) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        MethodType frame");
        } else {
            if (walkState.pc.getAddress() > J9SF_MAX_SPECIAL_FRAME_TYPE) {
                if (walkState.pc.getAddress() == walkState.walkThread.javaVM().callInReturnPC().getAddress() || walkState.pc.getAddress() == (walkState.walkThread.javaVM().callInReturnPC().getAddress() + 3)) {
                    StackWalkerUtils.swPrintf(walkState, 0, "\t                        JNI call-in frame");
                } else {
                    StackWalkerUtils.swPrintf(walkState, 0, "\t                        unknown frame type {0} *{1}", walkState.pc, walkState.pc.getHexAddress());
                }
            } else {
                StackWalkerUtils.swPrintf(walkState, 0, "\t                        known but unhandled frame type {0}", walkState.pc);
            }
        }
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
    return FrameCallbackResult.KEEP_ITERATING;
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 9 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class J9ThreadHelper method getVMThread.

public static J9VMThreadPointer getVMThread(J9ThreadPointer threadPointer) throws CorruptDataException {
    J9VMThreadPointer vmThread = null;
    OMR_VMThreadPointer omrVmThread = OMR_VMThreadPointer.cast(getTLS(threadPointer, J9RASHelper.getVM(DataType.getJ9RASPointer()).omrVM()._vmThreadKey()));
    if (omrVmThread.isNull()) {
        vmThread = J9VMThreadPointer.NULL;
    } else {
        vmThread = J9VMThreadPointer.cast(omrVmThread._language_vmthread());
    }
    return vmThread;
}
Also used : OMR_VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.OMR_VMThreadPointer) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)

Example 10 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class ThreadsCommand method debugEventData.

private void debugEventData(PrintStream out) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9VMThreadPointer mainThread = vm.mainThread();
        if (mainThread.notNull()) {
            J9VMThreadPointer threadCursor = vm.mainThread();
            do {
                // 
                out.append(String.format("    !j9vmthread 0x%s %s %s %s %s %s %s %s %s", Long.toHexString(threadCursor.getAddress()), Long.toHexString(threadCursor.debugEventData1().longValue()), Long.toHexString(threadCursor.debugEventData2().longValue()), Long.toHexString(threadCursor.debugEventData3().longValue()), Long.toHexString(threadCursor.debugEventData4().longValue()), Long.toHexString(threadCursor.debugEventData5().longValue()), Long.toHexString(threadCursor.debugEventData6().longValue()), Long.toHexString(threadCursor.debugEventData7().longValue()), Long.toHexString(threadCursor.debugEventData8().longValue())));
                out.append(nl);
                threadCursor = threadCursor.linkNext();
            } while (!threadCursor.eq(mainThread));
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)39 CorruptDataException (com.ibm.j9ddr.CorruptDataException)28 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)15 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)13 J9ThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer)9 WalkState (com.ibm.j9ddr.vm29.j9.stackwalker.WalkState)7 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)6 UDATA (com.ibm.j9ddr.vm29.types.UDATA)6 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)5 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)5 StackWalkResult (com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)4 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)4 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)4 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)3 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)3 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)3 J9ThreadLibraryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadLibraryPointer)3 LinkedList (java.util.LinkedList)3 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)2