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);
}
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;
}
}
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;
}
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;
}
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);
}
}
Aggregations