Skip to content

Commit c436edb

Browse files
offamitkumarPaul Hohensee
authored andcommitted
8342962: [s390x] TestOSRLotsOfLocals.java crashes
Backport-of: 54327bc4e38773b7461977ce17f2185c068bce9b
1 parent af17bf4 commit c436edb

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
@@ -133,9 +133,19 @@ 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 large_offset = !Immediate::is_simm20(monitor_offset + BytesPerWord) && number_of_locks > 0;
142+
143+
if (large_offset) {
144+
// z_lg can only handle displacement upto 20bit signed binary integer
145+
__ z_algfi(OSR_buf, locals_space);
146+
monitor_offset -= locals_space;
147+
}
148+
139149
// SharedRuntime::OSR_migration_begin() packs BasicObjectLocks in
140150
// the OSR buffer using 2 word entries: first the lock and then
141151
// the oop.
@@ -149,6 +159,10 @@ void LIR_Assembler::osr_entry() {
149159
__ z_lg(Z_R1_scratch, slot_offset + 1*BytesPerWord, OSR_buf);
150160
__ z_stg(Z_R1_scratch, frame_map()->address_for_monitor_object(i));
151161
}
162+
163+
if (large_offset) {
164+
__ z_slgfi(OSR_buf, locals_space);
165+
}
152166
}
153167
}
154168

0 commit comments

Comments
 (0)