|
26 | 26 |
|
27 | 27 | import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;
|
28 | 28 |
|
29 |
| -import com.oracle.svm.core.deopt.DeoptimizationSlotPacking; |
30 |
| -import jdk.graal.compiler.word.Word; |
31 | 29 | import org.graalvm.nativeimage.CurrentIsolate;
|
32 | 30 | import org.graalvm.nativeimage.IsolateThread;
|
33 | 31 | import org.graalvm.nativeimage.Platform;
|
|
46 | 44 | import com.oracle.svm.core.code.CodeInfoTable;
|
47 | 45 | import com.oracle.svm.core.code.UntetheredCodeInfo;
|
48 | 46 | import com.oracle.svm.core.config.ConfigurationValues;
|
| 47 | +import com.oracle.svm.core.deopt.DeoptimizationSlotPacking; |
49 | 48 | import com.oracle.svm.core.deopt.DeoptimizedFrame;
|
50 | 49 | import com.oracle.svm.core.deopt.Deoptimizer;
|
51 | 50 | import com.oracle.svm.core.heap.RestrictHeapAccess;
|
|
61 | 60 |
|
62 | 61 | import jdk.graal.compiler.api.replacements.Fold;
|
63 | 62 | import jdk.graal.compiler.core.common.NumUtil;
|
| 63 | +import jdk.graal.compiler.word.Word; |
64 | 64 |
|
65 | 65 | /**
|
66 | 66 | * Provides methods to iterate over the physical Java stack frames of a thread (native stack frames
|
@@ -203,14 +203,24 @@ public static void initializeForContinuation(JavaStackWalk walk, StoredContinuat
|
203 | 203 |
|
204 | 204 | @Uninterruptible(reason = "Prevent deoptimization of stack frames while in this method.", callerMustBe = true)
|
205 | 205 | private static void initializeFromFrameAnchor(JavaStackWalk walk, IsolateThread thread, Pointer endSP) {
|
| 206 | + assert thread.isNonNull(); |
206 | 207 | assert thread != CurrentIsolate.getCurrentThread() : "Walking the stack without specifying a start SP is only allowed when walking other threads";
|
| 208 | + assert VMOperation.isInProgressAtSafepoint() : "Walking the stack of another thread is only safe when that thread is stopped at a safepoint"; |
207 | 209 |
|
208 | 210 | JavaFrameAnchor frameAnchor = JavaFrameAnchors.getFrameAnchor(thread);
|
209 |
| - if (frameAnchor.isNull()) { |
210 |
| - /* Threads that do not have a frame anchor at a safepoint are not walkable. */ |
| 211 | + if (frameAnchor.isNull() || SafepointBehavior.isCrashedThread(thread)) { |
| 212 | + /* |
| 213 | + * Threads that do not have a frame anchor at a safepoint are not walkable. This can for |
| 214 | + * example happen for attached threads that do not have any Java frames at the moment. |
| 215 | + * Threads that are marked as crashed are also not walkable because they may no longer |
| 216 | + * have a stack. For such threads, we must not access any data in the frame anchor (as |
| 217 | + * it is a stack allocated struct). |
| 218 | + */ |
211 | 219 | markAsNotWalkable(walk);
|
212 | 220 | } else {
|
213 |
| - initWalk(walk, thread, frameAnchor.getLastJavaSP(), endSP, frameAnchor.getLastJavaIP(), frameAnchor.getPreviousAnchor()); |
| 221 | + Pointer startSP = frameAnchor.getLastJavaSP(); |
| 222 | + assert startSP.isNonNull(); |
| 223 | + initWalk0(walk, startSP, endSP, frameAnchor.getLastJavaIP(), frameAnchor.getPreviousAnchor()); |
214 | 224 | }
|
215 | 225 | }
|
216 | 226 |
|
|
0 commit comments