Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,10 @@ private void blackenStackRoots() {
*/
continue;
}
if (VMThreads.SafepointBehavior.isCrashedThread(vmThread)) {
/* The Java frame anchors or the values on the stack may be corrupt. */
continue;
}
if (JavaStackWalker.initWalk(walk, vmThread)) {
walkStack(walk);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public static boolean verifyAllThreads() {
if (vmThread == CurrentIsolate.getCurrentThread()) {
continue;
}
if (VMThreads.SafepointBehavior.isCrashedThread(vmThread)) {
/* The Java frame anchors or the values on the stack may be corrupt. */
continue;
}
JavaStackWalker.walkThread(vmThread, STACK_FRAME_VISITOR);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ static void disableAndFlushForAllThreads() {

if (SubstrateOptions.MultiThreaded.getValue()) {
for (IsolateThread vmThread = VMThreads.firstThread(); vmThread.isNonNull(); vmThread = VMThreads.nextThread(vmThread)) {
if (VMThreads.SafepointBehavior.isCrashedThread(vmThread)) {
/* Ignore crashed threads because the TLAB can be corrupt. */
continue;
}
disableAndFlushForThread(vmThread);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ protected void operate() {
/* Skip the signal handler stack */
continue;
}
if (VMThreads.SafepointBehavior.isCrashedThread(vmThread)) {
/* The Java frame anchors or the values on the stack may be corrupt. */
continue;
}
try {
dumpStack(log, vmThread);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,10 @@ public void printDiagnostics(Log log, ErrorContext context, int maxDiagnosticLev
if (vmThread == CurrentIsolate.getCurrentThread()) {
continue;
}
if (VMThreads.SafepointBehavior.isCrashedThread(vmThread)) {
/* The Java frame anchors or the values on the stack may be corrupt. */
continue;
}
if (printed >= MAX_THREADS_TO_PRINT) {
log.string("... (truncated)").newline();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ public boolean verify(CodeInfo info) {
if (vmThread == CurrentIsolate.getCurrentThread()) {
continue;
}
if (VMThreads.SafepointBehavior.isCrashedThread(vmThread)) {
/* The Java frame anchors or the values on the stack may be corrupt. */
continue;
}
JavaStackWalker.walkThread(vmThread, this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ private static void deoptimizeInRangeOperation(CodePointer fromIp, CodePointer t
if (vmThread == CurrentIsolate.getCurrentThread()) {
continue;
}
if (VMThreads.SafepointBehavior.isCrashedThread(vmThread)) {
/* The Java frame anchors or the values on the stack may be corrupt. */
continue;
}
StackFrameVisitor deoptVisitor = getStackFrameVisitor((Pointer) fromIp, (Pointer) toIp, deoptAll, vmThread);
JavaStackWalker.walkThread(vmThread, deoptVisitor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,11 @@ private static class GetAllThreadsOperation extends JavaVMOperation {
@Override
protected void operate() {
for (IsolateThread cur = VMThreads.firstThread(); cur.isNonNull(); cur = VMThreads.nextThread(cur)) {
if (VMThreads.SafepointBehavior.isCrashedThread(cur)) {
/* The Java frame anchors or the values on the stack may be corrupt. */
continue;
}

Thread thread = PlatformThreads.fromVMThread(cur);
if (thread != null) {
result.add(thread);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,13 +869,11 @@ public static int getSafepointBehaviorVolatile(IsolateThread vmThread) {
* thread status).
*
* NOTE: Be careful with this method and make sure that this thread does not allocate any
* Java objects as this could result deadlocks. This method will only work prevent
* safepoints reliably if it is called from a thread with
* {@link StatusSupport#STATUS_IN_JAVA}.
* Java objects as this could result deadlocks. This method will only prevent safepoints
* reliably if it is called from a thread with {@link StatusSupport#STATUS_IN_JAVA}.
*/
@Uninterruptible(reason = "Called from uninterruptible code.", callerMustBe = true)
public static void preventSafepoints() {
// It would be nice if we could retire the TLAB here but that wouldn't work reliably.
safepointBehaviorTL.setVolatile(PREVENT_VM_FROM_REACHING_SAFEPOINT);
}

Expand All @@ -898,6 +896,11 @@ public static void markThreadAsCrashed() {
safepointBehaviorTL.setVolatile(THREAD_CRASHED);
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static boolean isCrashedThread(IsolateThread thread) {
return safepointBehaviorTL.getVolatile(thread) == THREAD_CRASHED;
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static String toString(int safepointBehavior) {
switch (safepointBehavior) {
Expand Down