Skip to content

Commit 54327bc

Browse files
committed
8342962: [s390x] TestOSRLotsOfLocals.java crashes
Reviewed-by: lucy, mdoerr
1 parent f0075d5 commit 54327bc

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
@@ -131,9 +131,19 @@ void LIR_Assembler::osr_entry() {
131131
// copied into place by code emitted in the IR.
132132

133133
Register OSR_buf = osrBufferPointer()->as_register();
134-
{ assert(frame::interpreter_frame_monitor_size() == BasicObjectLock::size(), "adjust code below");
135-
int monitor_offset = BytesPerWord * method()->max_locals() +
136-
(2 * BytesPerWord) * (number_of_locks - 1);
134+
{
135+
assert(frame::interpreter_frame_monitor_size() == BasicObjectLock::size(), "adjust code below");
136+
137+
const int locals_space = BytesPerWord * method() -> max_locals();
138+
int monitor_offset = locals_space + (2 * BytesPerWord) * (number_of_locks - 1);
139+
bool large_offset = !Immediate::is_simm20(monitor_offset + BytesPerWord) && number_of_locks > 0;
140+
141+
if (large_offset) {
142+
// z_lg can only handle displacement upto 20bit signed binary integer
143+
__ z_algfi(OSR_buf, locals_space);
144+
monitor_offset -= locals_space;
145+
}
146+
137147
// SharedRuntime::OSR_migration_begin() packs BasicObjectLocks in
138148
// the OSR buffer using 2 word entries: first the lock and then
139149
// the oop.
@@ -147,6 +157,10 @@ void LIR_Assembler::osr_entry() {
147157
__ z_lg(Z_R1_scratch, slot_offset + 1*BytesPerWord, OSR_buf);
148158
__ z_stg(Z_R1_scratch, frame_map()->address_for_monitor_object(i));
149159
}
160+
161+
if (large_offset) {
162+
__ z_slgfi(OSR_buf, locals_space);
163+
}
150164
}
151165
}
152166

0 commit comments

Comments
 (0)