Symptom
========
The VM runs into the following assertion:
# Internal Error (jdk/src/hotspot/cpu/ppc/frame_ppc.inline.hpp:80), pid=32736, tid=32774
# assert(_on_heap || (is_aligned(_sp, alignment_in_bytes) || is_interpreted_frame()) && is_aligned(_fp, alignment_in_bytes)) failed: invalid alignment ... fp:0xfffffffffffffffe (which matches "badAddress")
Stack:
V [libjvm.so+0x6976d8] frame::setup()+0x3b0 (frame_ppc.inline.hpp:80)
V [libjvm.so+0x6978b8] frame::frame(long*, unsigned char*, long*, long*, CodeBlob*)+0x9c (frame_ppc.inline.hpp:97)
V [libjvm.so+0xac5f34] frame::patch_pc(Thread*, unsigned char*)+0x45c (frame_ppc.cpp:266)
V [libjvm.so+0xab748c] frame::deoptimize(JavaThread*)+0x228 (frame.cpp:350)
V [libjvm.so+0x8eedbc] ThawBase::recurse_thaw_compiled_frame(frame const&, frame&, int, bool)+0x838 (continuationFreezeThaw.cpp:2241)
V [libjvm.so+0x8ed8b4] ThawBase::recurse_thaw(frame const&, frame&, int, bool)+0x29c (continuationFreezeThaw.cpp:2018)
V [libjvm.so+0x8fe4a8] bool ThawBase::recurse_thaw_java_frame<ContinuationHelper::InterpretedFrame>(frame&, int)+0x2b4 (continuationFreezeThaw.cpp:2046)
V [libjvm.so+0x8edf94] ThawBase::recurse_thaw_interpreted_frame(frame const&, frame&, int)+0xf0 (continuationFreezeThaw.cpp:2135)
V [libjvm.so+0x8ed8d0] ThawBase::recurse_thaw(frame const&, frame&, int, bool)+0x2b8 (continuationFreezeThaw.cpp:2020)
V [libjvm.so+0x8ed4ec] ThawBase::thaw_slow(stackChunkOopDesc*, bool)+0x2ec (continuationFreezeThaw.cpp:1994)
V [libjvm.so+0x90df1c] Thaw<Config<(oop_kind)0, CardTableBarrierSet> >::thaw(Continuation::thaw_kind)+0x24c (continuationFreezeThaw.cpp:1788)
V [libjvm.so+0x904908] long* thaw_internal<Config<(oop_kind)0, CardTableBarrierSet> >(JavaThread*, Continuation::thaw_kind)+0x3c4 (continuationFreezeThaw.cpp:2392)
V [libjvm.so+0x9034a0] Config<(oop_kind)0, CardTableBarrierSet>::thaw(JavaThread*, Continuation::thaw_kind)+0x38 (continuationFreezeThaw.cpp:270)
V [libjvm.so+0x8f1050] long* thaw<Config<(oop_kind)0, CardTableBarrierSet> >(JavaThread*, int)+0x74 (continuationFreezeThaw.cpp:247)
v ~BufferBlob::StubRoutines (3) 0x0000200010376844
J 489 c1 jdk.internal.vm.Continuation.run()V java.base@21-internal (586 bytes) @ 0x0000200010d93084 [0x0000200010d92e80+0x0000000000000204]
Issue is reproducible (not always, but most of the time) with JDK 20 and 21:
make run-test TEST="serviceability/jvmti/stress/StackTrace/Suspended/GetStackTraceSuspendedStressTest.java" JTREG="VM_OPTIONS=-XX:TieredStopAtLevel=1"
JDK-8286302 uses "patch_callee_link(hf, (intptr_t*)badAddress);" which doesn't work for the usage given by the stack trace.
Analysis
========
- The frame that get's deoptimized is not fully initialized.
- The backlink will be initialized later because it is not yet known if the frame will be extended for its callee
- The backlink was set to `badAddress` (0xfffffffffffffffe) when the frame was frozen
- `badAddress` is not 16 byte aligned which causes the assertion
- can be reproduce with the following command
make test TEST=serviceability/jvmti/stress/StackTrace/Suspended/GetStackTraceSuspendedStressTest.java \
TEST_VM_OPTS="-Xcomp -XX:CompileCommand=compileonly,GetStackTraceSuspendedStressTest::*"