Skip to content

8359965: Enable paired pushp and popp instruction usage for APX enabled CPUs #25889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
}
assert(_obj != noreg, "must be a valid register");
Register tmp = rax;
__ push(tmp);
__ paired_push(tmp);
__ movptr(tmp, Address(_obj, java_lang_Class::klass_offset()));
__ cmpptr(r15_thread, Address(tmp, InstanceKlass::init_thread_offset()));
__ pop(tmp); // pop it right away, no matter which path we take
__ paired_pop(tmp); // pop it right away, no matter which path we take
__ jccb(Assembler::notEqual, call_patch);

// access_field patches may execute the patched code before it's
Expand Down
48 changes: 24 additions & 24 deletions src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,11 +1385,11 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
__ cmpptr(klass_RInfo, k_RInfo);
__ jcc(Assembler::equal, *success_target);

__ push(klass_RInfo);
__ push(k_RInfo);
__ paired_push(klass_RInfo);
__ paired_push(k_RInfo);
__ call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id)));
__ pop(klass_RInfo);
__ pop(klass_RInfo);
__ paired_pop(klass_RInfo);
__ paired_pop(klass_RInfo);
// result is a boolean
__ testl(klass_RInfo, klass_RInfo);
__ jcc(Assembler::equal, *failure_target);
Expand All @@ -1399,11 +1399,11 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
// perform the fast part of the checking logic
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, success_target, failure_target, nullptr);
// call out-of-line instance of __ check_klass_subtype_slow_path(...):
__ push(klass_RInfo);
__ push(k_RInfo);
__ paired_push(klass_RInfo);
__ paired_push(k_RInfo);
__ call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id)));
__ pop(klass_RInfo);
__ pop(k_RInfo);
__ paired_pop(klass_RInfo);
__ paired_pop(k_RInfo);
// result is a boolean
__ testl(k_RInfo, k_RInfo);
__ jcc(Assembler::equal, *failure_target);
Expand Down Expand Up @@ -1478,11 +1478,11 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
// perform the fast part of the checking logic
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, success_target, failure_target, nullptr);
// call out-of-line instance of __ check_klass_subtype_slow_path(...):
__ push(klass_RInfo);
__ push(k_RInfo);
__ paired_push(klass_RInfo);
__ paired_push(k_RInfo);
__ call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id)));
__ pop(klass_RInfo);
__ pop(k_RInfo);
__ paired_pop(klass_RInfo);
__ paired_pop(k_RInfo);
// result is a boolean
__ testl(k_RInfo, k_RInfo);
__ jcc(Assembler::equal, *failure_target);
Expand Down Expand Up @@ -2536,26 +2536,26 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
// safely do the copy.
Label cont, slow;

__ push(src);
__ push(dst);
__ paired_push(src);
__ paired_push(dst);

__ load_klass(src, src, tmp_load_klass);
__ load_klass(dst, dst, tmp_load_klass);

__ check_klass_subtype_fast_path(src, dst, tmp, &cont, &slow, nullptr);

__ push(src);
__ push(dst);
__ paired_push(src);
__ paired_push(dst);
__ call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id)));
__ pop(dst);
__ pop(src);
__ paired_pop(dst);
__ paired_pop(src);

__ testl(src, src);
__ jcc(Assembler::notEqual, cont);

__ bind(slow);
__ pop(dst);
__ pop(src);
__ paired_pop(dst);
__ paired_pop(src);

address copyfunc_addr = StubRoutines::checkcast_arraycopy();
if (copyfunc_addr != nullptr) { // use stub if available
Expand Down Expand Up @@ -2904,13 +2904,13 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
if (exact_klass != nullptr) {
Label ok;
__ load_klass(tmp, obj, tmp_load_klass);
__ push(tmp);
__ paired_push(tmp);
__ mov_metadata(tmp, exact_klass->constant_encoding());
__ cmpptr(tmp, Address(rsp, 0));
__ jcc(Assembler::equal, ok);
__ stop("exact klass and actual klass differ");
__ bind(ok);
__ pop(tmp);
__ paired_pop(tmp);
}
#endif
if (!no_conflict) {
Expand Down Expand Up @@ -2975,7 +2975,7 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {

{
Label ok;
__ push(tmp);
__ paired_push(tmp);
__ testptr(mdo_addr, TypeEntries::type_mask);
__ jcc(Assembler::zero, ok);
// may have been set by another thread
Expand All @@ -2986,7 +2986,7 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {

__ stop("unexpected profiling mismatch");
__ bind(ok);
__ pop(tmp);
__ paired_pop(tmp);
}
#else
__ jccb(Assembler::zero, next);
Expand Down
20 changes: 10 additions & 10 deletions src/hotspot/cpu/x86/c1_Runtime1_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,15 +719,15 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
// verify callee-saved register
#ifdef ASSERT
guarantee(thread != rax, "change this code");
__ push(rax);
__ paired_push(rax);
{ Label L;
__ get_thread_slow(rax);
__ cmpptr(thread, rax);
__ jcc(Assembler::equal, L);
__ stop("StubAssembler::call_RT: rdi/r15 not callee saved?");
__ bind(L);
}
__ pop(rax);
__ paired_pop(rax);
#endif
__ reset_last_Java_frame(true);

Expand Down Expand Up @@ -1070,10 +1070,10 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {
};

__ set_info("slow_subtype_check", dont_gc_arguments);
__ push(rdi);
__ push(rsi);
__ push(rcx);
__ push(rax);
__ paired_push(rdi);
__ paired_push(rsi);
__ paired_push(rcx);
__ paired_push(rax);

// This is called by pushing args and not with C abi
__ movptr(rsi, Address(rsp, (klass_off) * VMRegImpl::stack_slot_size)); // subclass
Expand All @@ -1084,10 +1084,10 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {

// fallthrough on success:
__ movptr(Address(rsp, (result_off) * VMRegImpl::stack_slot_size), 1); // result
__ pop(rax);
__ pop(rcx);
__ pop(rsi);
__ pop(rdi);
__ paired_pop(rax);
__ paired_pop(rcx);
__ paired_pop(rsi);
__ paired_pop(rdi);
__ ret(0);

__ bind(miss);
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ static void generate_string_indexof_stubs(StubGenerator *stubgen, address *fnptr
__ movdq(save_r15, r15);
__ movdq(save_rbx, rbx);
#ifdef _WIN64
__ push(rsi);
__ push(rdi);
__ paired_push(rsi);
__ paired_push(rdi);

// Move to Linux-style ABI
__ movq(rdi, rcx);
Expand All @@ -368,7 +368,7 @@ static void generate_string_indexof_stubs(StubGenerator *stubgen, address *fnptr
const Register needle_len = rcx;
const Register save_ndl_len = r12;

__ push(rbp);
__ paired_push(rbp);
__ subptr(rsp, STACK_SPACE);

if (isReallyUL) {
Expand Down Expand Up @@ -459,10 +459,10 @@ static void generate_string_indexof_stubs(StubGenerator *stubgen, address *fnptr
// Restore stack, vzeroupper and return
__ bind(L_return);
__ addptr(rsp, STACK_SPACE);
__ pop(rbp);
__ paired_pop(rbp);
#ifdef _WIN64
__ pop(rdi);
__ pop(rsi);
__ paired_pop(rdi);
__ paired_pop(rsi);
#endif
__ movdq(r12, save_r12);
__ movdq(r13, save_r13);
Expand Down
20 changes: 10 additions & 10 deletions src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
__ prologue("g1_pre_barrier", false);
// arg0 : previous value of memory

__ push(rax);
__ push(rdx);
__ paired_push(rax);
__ paired_push(rdx);

const Register pre_val = rax;
const Register thread = r15_thread;
Expand Down Expand Up @@ -549,8 +549,8 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*

__ bind(done);

__ pop(rdx);
__ pop(rax);
__ paired_pop(rdx);
__ paired_pop(rax);

__ epilogue();
}
Expand All @@ -573,8 +573,8 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));

__ push(rax);
__ push(rcx);
__ paired_push(rax);
__ paired_push(rcx);

const Register cardtable = rax;
const Register card_addr = rcx;
Expand All @@ -599,7 +599,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ movb(Address(card_addr, 0), CardTable::dirty_card_val());

const Register tmp = rdx;
__ push(rdx);
__ paired_push(rdx);

__ movptr(tmp, queue_index);
__ testptr(tmp, tmp);
Expand All @@ -618,11 +618,11 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ pop_call_clobbered_registers();

__ bind(enqueued);
__ pop(rdx);
__ paired_pop(rdx);

__ bind(done);
__ pop(rcx);
__ pop(rax);
__ paired_pop(rcx);
__ paired_pop(rax);

__ epilogue();
}
Expand Down
Loading