Skip to content

Commit 074bc9d

Browse files
author
duke
committed
Backport 3bba0f3dc8faf83a3aadcd704ae2ae4967e6daa4
1 parent 9308dec commit 074bc9d

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
@@ -135,9 +135,20 @@ void LIR_Assembler::osr_entry() {
135135
// copied into place by code emitted in the IR.
136136

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

0 commit comments

Comments
 (0)