Skip to content

Commit 12f1578

Browse files
author
duke
committed
Backport 54327bc4e38773b7461977ce17f2185c068bce9b
1 parent 01eb688 commit 12f1578

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp

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

136136
Register OSR_buf = osrBufferPointer()->as_register();
137-
{ assert(frame::interpreter_frame_monitor_size() == BasicObjectLock::size(), "adjust code below");
138-
int monitor_offset = BytesPerWord * method()->max_locals() +
139-
(2 * BytesPerWord) * (number_of_locks - 1);
137+
{
138+
assert(frame::interpreter_frame_monitor_size() == BasicObjectLock::size(), "adjust code below");
139+
140+
const int locals_space = BytesPerWord * method() -> max_locals();
141+
int monitor_offset = locals_space + (2 * BytesPerWord) * (number_of_locks - 1);
142+
bool large_offset = !Immediate::is_simm20(monitor_offset + BytesPerWord) && number_of_locks > 0;
143+
144+
if (large_offset) {
145+
// z_lg can only handle displacement upto 20bit signed binary integer
146+
__ z_algfi(OSR_buf, locals_space);
147+
monitor_offset -= locals_space;
148+
}
149+
140150
// SharedRuntime::OSR_migration_begin() packs BasicObjectLocks in
141151
// the OSR buffer using 2 word entries: first the lock and then
142152
// the oop.
@@ -150,6 +160,10 @@ void LIR_Assembler::osr_entry() {
150160
__ z_lg(Z_R1_scratch, slot_offset + 1*BytesPerWord, OSR_buf);
151161
__ z_stg(Z_R1_scratch, frame_map()->address_for_monitor_object(i));
152162
}
163+
164+
if (large_offset) {
165+
__ z_slgfi(OSR_buf, locals_space);
166+
}
153167
}
154168
}
155169

0 commit comments

Comments
 (0)