Skip to content

Commit 9a25f82

Browse files
committedOct 5, 2024
8339386: Assertion on AIX - original PC must be in the main code section of the compiled method
Reviewed-by: rrich, lucy
1 parent df763cd commit 9a25f82

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

‎src/hotspot/cpu/ppc/frame_ppc.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ bool frame::safe_for_sender(JavaThread *thread) {
117117
return false;
118118
}
119119

120-
common_abi* sender_abi = (common_abi*) fp;
120+
volatile common_abi* sender_abi = (common_abi*) fp; // May get updated concurrently by deoptimization!
121121
intptr_t* sender_sp = (intptr_t*) fp;
122-
address sender_pc = (address) sender_abi->lr;;
122+
address sender_pc = (address) sender_abi->lr;
123123

124124
if (Continuation::is_return_barrier_entry(sender_pc)) {
125125
// If our sender_pc is the return barrier, then our "real" sender is the continuation entry
@@ -134,9 +134,18 @@ bool frame::safe_for_sender(JavaThread *thread) {
134134
return false;
135135
}
136136

137+
intptr_t* unextended_sender_sp = is_interpreted_frame() ? interpreter_frame_sender_sp() : sender_sp;
138+
139+
// If the sender is a deoptimized nmethod we need to check if the original pc is valid.
140+
nmethod* sender_nm = sender_blob->as_nmethod_or_null();
141+
if (sender_nm != nullptr && sender_nm->is_deopt_pc(sender_pc)) {
142+
address orig_pc = *(address*)((address)unextended_sender_sp + sender_nm->orig_pc_offset());
143+
if (!sender_nm->insts_contains_inclusive(orig_pc)) return false;
144+
}
145+
137146
// It should be safe to construct the sender though it might not be valid.
138147

139-
frame sender(sender_sp, sender_pc, nullptr /* unextended_sp */, nullptr /* fp */, sender_blob);
148+
frame sender(sender_sp, sender_pc, unextended_sender_sp, nullptr /* fp */, sender_blob);
140149

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

0 commit comments

Comments
 (0)
Please sign in to comment.