Skip to content

Commit 6f50c6d

Browse files
committed
8339386: Assertion on AIX - original PC must be in the main code section of the compiled method
Reviewed-by: rrich Backport-of: 9a25f822fb2529c1cae3ae909761381789d7b7b1
1 parent 6c4a327 commit 6f50c6d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/hotspot/cpu/ppc/frame_ppc.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ bool frame::safe_for_sender(JavaThread *thread) {
114114
return false;
115115
}
116116

117-
abi_minframe* sender_abi = (abi_minframe*) fp;
117+
volatile abi_minframe* sender_abi = (abi_minframe*) fp; // May get updated concurrently by deoptimization!
118118
intptr_t* sender_sp = (intptr_t*) fp;
119-
address sender_pc = (address) sender_abi->lr;;
119+
address sender_pc = (address) sender_abi->lr;
120120

121121
// We must always be able to find a recognizable pc.
122122
CodeBlob* sender_blob = CodeCache::find_blob_unsafe(sender_pc);
@@ -129,9 +129,20 @@ bool frame::safe_for_sender(JavaThread *thread) {
129129
return false;
130130
}
131131

132+
intptr_t* unextended_sender_sp = is_interpreted_frame() ? (intptr_t*)get_ijava_state()->sender_sp : sender_sp;
133+
132134
// It should be safe to construct the sender though it might not be valid.
133135

134-
frame sender(sender_sp, sender_pc);
136+
// JDK-8339386 is different than the upstream version:
137+
// The frame constructor doesn't check sanity of a deopt pc, but determines it.
138+
// Other accessors for reading it are not available in 17u.
139+
frame sender(sender_sp, sender_pc, unextended_sender_sp);
140+
// If the sender is a deoptimized nmethod we need to check if the original pc is valid.
141+
nmethod* sender_nm = sender_blob->as_nmethod_or_null();
142+
if (sender_nm != nullptr && sender._deopt_state == is_deoptimized) {
143+
address orig_pc = sender.pc();
144+
if (!sender_nm->insts_contains_inclusive(orig_pc)) return false;
145+
}
135146

136147
// Do we have a valid fp?
137148
address sender_fp = (address) sender.fp();

0 commit comments

Comments
 (0)