Search in sources :

Example 1 with J9VMThreadPointer

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

the class GCVMThreadStackSlotIterator method scanSlots.

static void scanSlots(J9VMThreadPointer walkThread, IStackWalkerCallbacks stackWalkerCallbacks, boolean includeStackFrameClassReferences, boolean trackVisibleFrameDepth) {
    WalkState walkState = new WalkState();
    walkState.flags = J9_STACKWALK_ITERATE_O_SLOTS | J9_STACKWALK_DO_NOT_SNIFF_AND_WHACK;
    walkState.walkThread = walkThread;
    walkState.callBacks = stackWalkerCallbacks;
    if (trackVisibleFrameDepth) {
        walkState.skipCount = 0;
        walkState.flags |= J9_STACKWALK_VISIBLE_ONLY;
    } else {
        walkState.flags |= J9_STACKWALK_SKIP_INLINES;
    }
    if (includeStackFrameClassReferences) {
        walkState.flags |= J9_STACKWALK_ITERATE_METHOD_CLASS_SLOTS;
    }
    StackWalkResult result = StackWalkResult.STACK_CORRUPT;
    result = StackWalker.walkStackFrames(walkState);
    if (StackWalkResult.NONE != result) {
        /* Explicitly raising a corrupt data event here since returning StackWalkResult.STACK_CORRUPT is fairly common if a core is not taken at a safe gc point */
        CorruptDataException corruptDataException = new CorruptDataException("Stack walk returned: " + result + " for vmThread: " + walkThread.getHexAddress());
        EventManager.raiseCorruptDataEvent("", corruptDataException, false);
    }
}
Also used : WalkState(com.ibm.j9ddr.vm29.j9.stackwalker.WalkState) CorruptDataException(com.ibm.j9ddr.CorruptDataException) StackWalkResult(com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)

Example 2 with J9VMThreadPointer

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

the class ObjectMonitor_V1 method initializeWaitingThreads.

private void initializeWaitingThreads() throws CorruptDataException {
    waitingThreads = new ArrayList<J9VMThreadPointer>();
    if (!isInflated) {
        return;
    }
    J9ThreadPointer thread = monitor.waiting();
    while (thread.notNull()) {
        J9VMThreadPointer vmThread = J9ThreadHelper.getVMThread(thread);
        if (vmThread.notNull()) {
            waitingThreads.add(vmThread);
        }
        thread = thread.next();
    }
}
Also used : J9ThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)

Example 3 with J9VMThreadPointer

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

the class StackRoots method walkStacks.

private void walkStacks() throws CorruptDataException {
    GCVMThreadListIterator threadIterator = GCVMThreadListIterator.from();
    while (threadIterator.hasNext()) {
        J9VMThreadPointer next = threadIterator.next();
        WalkState walkState = new WalkState();
        walkState.walkThread = next;
        walkState.flags = J9_STACKWALK_SKIP_INLINES | J9_STACKWALK_ITERATE_O_SLOTS | J9_STACKWALK_ITERATE_METHOD_CLASS_SLOTS;
        walkState.callBacks = new StackWalkerCallbacks();
        StackWalkResult result = StackWalkResult.STACK_CORRUPT;
        result = StackWalker.walkStackFrames(walkState);
        if (StackWalkResult.NONE != result) {
            throw new UnsupportedOperationException("Failed to walk stack");
        }
    }
}
Also used : GCVMThreadListIterator(com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator) IStackWalkerCallbacks(com.ibm.j9ddr.vm29.j9.stackwalker.IStackWalkerCallbacks) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) WalkState(com.ibm.j9ddr.vm29.j9.stackwalker.WalkState) StackWalkResult(com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)

Example 4 with J9VMThreadPointer

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

the class RootScanner method scanMonitorLookupCaches.

protected void scanMonitorLookupCaches() throws CorruptDataException {
    setReachability(Reachability.WEAK);
    GCVMThreadListIterator vmThreadListIterator = GCVMThreadListIterator.from();
    while (vmThreadListIterator.hasNext()) {
        J9VMThreadPointer walkThread = vmThreadListIterator.next();
        if (J9BuildFlags.thr_lockNursery) {
            ObjectMonitorReferencePointer objectMonitorLookupCache = walkThread.objectMonitorLookupCacheEA();
            for (long cacheIndex = 0; cacheIndex < J9VMThread.J9VMTHREAD_OBJECT_MONITOR_CACHE_SIZE; cacheIndex++) {
                ObjectMonitorReferencePointer slotAddress = objectMonitorLookupCache.add(cacheIndex);
                doMonitorLookupCacheSlot(slotAddress.at(0), slotAddress);
            }
        } else {
            /* Can't implement this because walkThread.cachedMonitor field does not exist as we've never had a vm29 spec yet with the condition: 
				 * (!J9BuildFlags.thr_lockNursery && !J9BuildFlags.opt_realTimeLockingSupport)
				 * 
				 * // This cast is ugly but is technically what the c-code is doing 
				 * ObjectMonitorReferencePointer cachedMonitorSlot = ObjectMonitorReferencePointer.cast(walkThread.cachedMonitorEA());
				 * doMonitorLookupCacheSlot(walkThread.cachedMonitor(), cachedMonitorSlot);
				 */
            throw new UnsupportedOperationException("Not implemented");
        }
    }
}
Also used : ObjectMonitorReferencePointer(com.ibm.j9ddr.vm29.pointer.ObjectMonitorReferencePointer) GCVMThreadListIterator(com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)

Example 5 with J9VMThreadPointer

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

the class ObjectMonitor_V1 method initializeBlockedThreads.

private void initializeBlockedThreads() throws CorruptDataException {
    blockedThreads = new ArrayList<J9VMThreadPointer>();
    if (isInflated) {
        if (OmrBuildFlags.OMR_THR_THREE_TIER_LOCKING) {
            J9ThreadPointer thread = monitor.blocking();
            while (thread.notNull()) {
                J9VMThreadPointer vmThread = J9ThreadHelper.getVMThread(thread);
                if (vmThread.notNull()) {
                    blockedThreads.add(vmThread);
                }
                thread = thread.next();
            }
        } else {
            List<J9VMThreadPointer> list = getBlockedThreads(object);
            if (list != null) {
                blockedThreads.addAll(list);
            }
        }
    } else {
        // For consistency we walk the thread list and check for blocking objects
        // rather than do lockword.allBitsIn(OBJECT_HEADER_LOCK_FLC); as the lockword
        // is set slightly later (the thread may spin first). See: CMVC 201473
        List<J9VMThreadPointer> list = getBlockedThreads(object);
        if (list != null) {
            blockedThreads.addAll(list);
        }
    }
}
Also used : J9ThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)

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