Skip to content

Commit 64a6c7f

Browse files
TheRealMDoerrpull[bot]
authored andcommitted
8342701: [PPC64] TestOSRLotsOfLocals.java crashes
Reviewed-by: lucy, rrich
1 parent cdd044c commit 64a6c7f

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,20 @@ void LIR_Assembler::osr_entry() {
133133
// copied into place by code emitted in the IR.
134134

135135
Register OSR_buf = osrBufferPointer()->as_register();
136-
{ assert(frame::interpreter_frame_monitor_size() == BasicObjectLock::size(), "adjust code below");
137-
int monitor_offset = BytesPerWord * method()->max_locals() +
138-
(2 * BytesPerWord) * (number_of_locks - 1);
136+
{
137+
assert(frame::interpreter_frame_monitor_size() == BasicObjectLock::size(), "adjust code below");
138+
139+
const int locals_space = BytesPerWord * method()->max_locals();
140+
int monitor_offset = locals_space + (2 * BytesPerWord) * (number_of_locks - 1);
141+
bool use_OSR_bias = false;
142+
143+
if (!Assembler::is_simm16(monitor_offset + BytesPerWord) && number_of_locks > 0) {
144+
// Offsets too large for ld instructions. Use bias.
145+
__ add_const_optimized(OSR_buf, OSR_buf, locals_space);
146+
monitor_offset -= locals_space;
147+
use_OSR_bias = true;
148+
}
149+
139150
// SharedRuntime::OSR_migration_begin() packs BasicObjectLocks in
140151
// the OSR buffer using 2 word entries: first the lock and then
141152
// the oop.
@@ -161,6 +172,11 @@ void LIR_Assembler::osr_entry() {
161172
__ ld(R0, slot_offset + 1*BytesPerWord, OSR_buf);
162173
__ std(R0, mo.disp(), mo.base());
163174
}
175+
176+
if (use_OSR_bias) {
177+
// Restore.
178+
__ sub_const_optimized(OSR_buf, OSR_buf, locals_space);
179+
}
164180
}
165181
}
166182

0 commit comments

Comments
 (0)