Skip to content

Commit 67b86ae

Browse files
committed
WIP
1 parent 18b8b8c commit 67b86ae

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

src/hotspot/cpu/s390/interp_masm_s390.cpp

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
// Major contributions by AHa, AS, JL, ML.
27-
27+
long fubar = 0;
2828
#include "asm/macroAssembler.inline.hpp"
2929
#include "gc/shared/barrierSet.hpp"
3030
#include "gc/shared/barrierSetAssembler.hpp"
@@ -182,10 +182,35 @@ void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result, address
182182
}
183183
#endif // ASSERT
184184

185+
Label resume_pc, not_preempted;
186+
push_cont_fastpath();
187+
188+
assert(arg_1 != Z_ARG1, "register corruption");
189+
load_const_optimized(Z_R1, (uintptr_t)&fubar);
190+
z_agsi(0, Z_R1, 1);
191+
z_lg(Z_ARG1, Address(Z_SP, _z_abi(callers_sp)));
192+
193+
// We set resume_pc as last java pc. It will be saved if the vthread gets preempted.
194+
// Later execution will continue right there.
195+
lr_if_needed(Z_ARG2, arg_1);
196+
197+
call_VM(oop_result, entry_point, false /*check_exceptions*/, &resume_pc /* last_java_pc */);
198+
199+
pop_cont_fastpath();
200+
201+
// Jump to handler if the call was preempted
202+
z_lg(Z_R1_scratch, Address(Z_thread, in_bytes(JavaThread::preempt_alternate_return_offset())));
203+
z_ltgr(Z_R1_scratch, Z_R1_scratch);
204+
z_brz(not_preempted);
205+
206+
z_mvghi(Address(Z_thread, in_bytes(JavaThread::preempt_alternate_return_offset())), 0);
207+
z_br(Z_R1_scratch); // branch to handler in Z_R1_scratch
185208

209+
bind(resume_pc); // Location to resume execution
186210

211+
stop("restore_after_resume");
187212

188-
stop("not yet implemented call_VM_preemptable");
213+
bind(not_preempted);
189214
}
190215

191216
void InterpreterMacroAssembler::call_VM_leaf_base(address entry_point) {

src/hotspot/cpu/s390/macroAssembler_s390.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,12 @@ unsigned long MacroAssembler::patched_branch(address dest_pos, unsigned long ins
19371937
// Only called when binding labels (share/vm/asm/assembler.cpp)
19381938
// Pass arguments as intended. Do not pre-calculate distance.
19391939
void MacroAssembler::pd_patch_instruction(address branch, address target, const char* file, int line) {
1940+
1941+
if (is_load_const(branch)) {
1942+
patch_const(branch, (long)target);
1943+
return;
1944+
}
1945+
19401946
unsigned long stub_inst;
19411947
int inst_len = get_instruction(branch, &stub_inst);
19421948

@@ -3861,7 +3867,7 @@ void MacroAssembler::set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, R
38613867
load_const_optimized(tmp1, target(*jpc));
38623868
}
38633869
} else {
3864-
load_const_optimized(tmp1, *jpc);
3870+
load_const(tmp1, *jpc);
38653871
}
38663872
set_last_Java_frame(/*sp=*/sp, /*pc=*/tmp1, allow_relocation);
38673873
}

0 commit comments

Comments
 (0)