8343030: RISC-V: Small assembler cleanups

Reviewed-by: mli, rehn
This commit is contained in:
Fei Yang 2024-10-26 03:32:30 +00:00
parent f1a9a8d25b
commit 1476f6c475
8 changed files with 20 additions and 29 deletions

View File

@ -43,9 +43,7 @@ void C1SafepointPollStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
InternalAddress safepoint_pc(__ pc() - __ offset() + safepoint_offset());
__ relocate(safepoint_pc.rspec(), [&] {
int32_t offset;
__ la(t0, safepoint_pc.target(), offset);
__ addi(t0, t0, offset);
__ la(t0, safepoint_pc.target());
});
__ sd(t0, Address(xthread, JavaThread::saved_exception_pc_offset()));

View File

@ -1406,9 +1406,7 @@ void LIR_Assembler::throw_op(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmit
int pc_for_athrow_offset = __ offset();
InternalAddress pc_for_athrow(__ pc());
__ relocate(pc_for_athrow.rspec(), [&] {
int32_t offset;
__ la(exceptionPC->as_register(), pc_for_athrow.target(), offset);
__ addi(exceptionPC->as_register(), exceptionPC->as_register(), offset);
__ la(exceptionPC->as_register(), pc_for_athrow.target());
});
add_call_info(pc_for_athrow_offset, info); // for exception handler

View File

@ -45,9 +45,7 @@ void C2SafepointPollStub::emit(C2_MacroAssembler& masm) {
__ bind(entry());
InternalAddress safepoint_pc(__ pc() - __ offset() + _safepoint_offset);
__ relocate(safepoint_pc.rspec(), [&] {
int32_t offset;
__ la(t0, safepoint_pc.target(), offset);
__ addi(t0, t0, offset);
__ la(t0, safepoint_pc.target());
});
__ sd(t0, Address(xthread, JavaThread::saved_exception_pc_offset()));
__ far_jump(callback_addr);

View File

@ -193,9 +193,7 @@ void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, i
void InterpreterMacroAssembler::get_dispatch() {
ExternalAddress target((address)Interpreter::dispatch_table());
relocate(target.rspec(), [&] {
int32_t offset;
la(xdispatch, target.target(), offset);
addi(xdispatch, xdispatch, offset);
la(xdispatch, target.target());
});
}

View File

@ -75,9 +75,7 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
Address target(SafepointSynchronize::safepoint_counter_addr());
__ relocate(target.rspec(), [&] {
int32_t offset;
__ la(rcounter_addr, target.target(), offset);
__ addi(rcounter_addr, rcounter_addr, offset);
__ la(rcounter_addr, target.target());
});
Label slow;

View File

@ -530,7 +530,7 @@ void MacroAssembler::_verify_oop(Register reg, const char* s, const char* file,
movptr(t0, (address) b);
}
// call indirectly to solve generation ordering problem
// Call indirectly to solve generation ordering problem
RuntimeAddress target(StubRoutines::verify_oop_subroutine_entry_address());
relocate(target.rspec(), [&] {
int32_t offset;
@ -575,7 +575,7 @@ void MacroAssembler::_verify_oop_addr(Address addr, const char* s, const char* f
movptr(t0, (address) b);
}
// call indirectly to solve generation ordering problem
// Call indirectly to solve generation ordering problem
RuntimeAddress target(StubRoutines::verify_oop_subroutine_entry_address());
relocate(target.rspec(), [&] {
int32_t offset;
@ -2570,7 +2570,6 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
}
SkipIfEqual::SkipIfEqual(MacroAssembler* masm, const bool* flag_addr, bool value) {
int32_t offset = 0;
_masm = masm;
ExternalAddress target((address)flag_addr);
_masm->relocate(target.rspec(), [&] {
@ -2578,6 +2577,7 @@ SkipIfEqual::SkipIfEqual(MacroAssembler* masm, const bool* flag_addr, bool value
_masm->la(t0, target.target(), offset);
_masm->lbu(t0, Address(t0, offset));
});
if (value) {
_masm->bnez(t0, _label);
} else {
@ -4210,7 +4210,7 @@ void MacroAssembler::read_polling_page(Register r, int32_t offset, relocInfo::re
});
}
void MacroAssembler::set_narrow_oop(Register dst, jobject obj) {
void MacroAssembler::set_narrow_oop(Register dst, jobject obj) {
#ifdef ASSERT
{
ThreadInVMfromUnknown tiv;
@ -4511,14 +4511,15 @@ void MacroAssembler::decrementw(const Address dst, int32_t value, Register tmp1,
sw(tmp1, adr);
}
void MacroAssembler::cmpptr(Register src1, Address src2, Label& equal) {
assert_different_registers(src1, t0);
void MacroAssembler::cmpptr(Register src1, const Address &src2, Label& equal, Register tmp) {
assert_different_registers(src1, tmp);
assert(src2.getMode() == Address::literal, "must be applied to a literal address");
relocate(src2.rspec(), [&] {
int32_t offset;
la(t0, src2.target(), offset);
ld(t0, Address(t0, offset));
la(tmp, src2.target(), offset);
ld(tmp, Address(tmp, offset));
});
beq(src1, t0, equal);
beq(src1, tmp, equal);
}
void MacroAssembler::load_method_holder_cld(Register result, Register method) {

View File

@ -1327,7 +1327,7 @@ public:
void decrement(const Address dst, int64_t value = 1, Register tmp1 = t0, Register tmp2 = t1);
void decrementw(const Address dst, int32_t value = 1, Register tmp1 = t0, Register tmp2 = t1);
void cmpptr(Register src1, Address src2, Label& equal);
void cmpptr(Register src1, const Address &src2, Label& equal, Register tmp = t0);
void clinit_barrier(Register klass, Register tmp, Label* L_fast_path = nullptr, Label* L_slow_path = nullptr);
void load_method_holder_cld(Register result, Register method);

View File

@ -2465,7 +2465,7 @@ void TemplateTable::jvmti_post_field_access(Register cache, Register index,
// take the time to call into the VM.
Label L1;
assert_different_registers(cache, index, x10);
ExternalAddress target((address) JvmtiExport::get_field_access_count_addr());
ExternalAddress target(JvmtiExport::get_field_access_count_addr());
__ relocate(target.rspec(), [&] {
int32_t offset;
__ la(t0, target.target(), offset);
@ -2676,7 +2676,7 @@ void TemplateTable::jvmti_post_field_mod(Register cache, Register index, bool is
// we take the time to call into the VM.
Label L1;
assert_different_registers(cache, index, x10);
ExternalAddress target((address)JvmtiExport::get_field_modification_count_addr());
ExternalAddress target(JvmtiExport::get_field_modification_count_addr());
__ relocate(target.rspec(), [&] {
int32_t offset;
__ la(t0, target.target(), offset);
@ -2969,7 +2969,7 @@ void TemplateTable::jvmti_post_fast_field_mod() {
// Check to see if a field modification watch has been set before
// we take the time to call into the VM.
Label L2;
ExternalAddress target((address)JvmtiExport::get_field_modification_count_addr());
ExternalAddress target(JvmtiExport::get_field_modification_count_addr());
__ relocate(target.rspec(), [&] {
int32_t offset;
__ la(t0, target.target(), offset);
@ -3101,7 +3101,7 @@ void TemplateTable::fast_accessfield(TosState state) {
// Check to see if a field access watch has been set before we
// take the time to call into the VM.
Label L1;
ExternalAddress target((address)JvmtiExport::get_field_access_count_addr());
ExternalAddress target(JvmtiExport::get_field_access_count_addr());
__ relocate(target.rspec(), [&] {
int32_t offset;
__ la(t0, target.target(), offset);