Skip to content

Commit c04a982

Browse files
zifeihanRealFYang
authored andcommitted
8301818: RISC-V: Factor out function mvw from MacroAssembler
Reviewed-by: luhenry, fyang, fjiang
1 parent 787e16b commit c04a982

9 files changed

+28
-30
lines changed

src/hotspot/cpu/riscv/c1_LIRAssembler_arraycopy_riscv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void LIR_Assembler::arraycopy_checkcast(Register src, Register src_pos, Register
150150
Address klass_lh_addr(tmp, lh_offset);
151151
jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
152152
__ lw(t0, klass_lh_addr);
153-
__ mvw(t1, objArray_lh);
153+
__ mv(t1, objArray_lh);
154154
__ bne(t0, t1, *stub->entry(), /* is_far */ true);
155155
}
156156

src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod
450450
switch (c->type()) {
451451
case T_INT:
452452
assert(patch_code == lir_patch_none, "no patching handled here");
453-
__ mvw(dest->as_register(), c->as_jint());
453+
__ mv(dest->as_register(), c->as_jint());
454454
break;
455455

456456
case T_ADDRESS:
@@ -518,7 +518,7 @@ void LIR_Assembler::const2stack(LIR_Opr src, LIR_Opr dest) {
518518
if (c->as_jint_bits() == 0) {
519519
__ sw(zr, frame_map()->address_for_slot(dest->single_stack_ix()));
520520
} else {
521-
__ mvw(t1, c->as_jint_bits());
521+
__ mv(t1, c->as_jint_bits());
522522
__ sw(t1, frame_map()->address_for_slot(dest->single_stack_ix()));
523523
}
524524
break;
@@ -1001,7 +1001,7 @@ void LIR_Assembler::emit_alloc_obj(LIR_OpAllocObj* op) {
10011001
if (op->init_check()) {
10021002
__ lbu(t0, Address(op->klass()->as_register(),
10031003
InstanceKlass::init_state_offset()));
1004-
__ mvw(t1, InstanceKlass::fully_initialized);
1004+
__ mv(t1, InstanceKlass::fully_initialized);
10051005
add_debug_info_for_null_check_here(op->stub()->info());
10061006
__ bne(t0, t1, *op->stub()->entry(), /* is_far */ true);
10071007
}

src/hotspot/cpu/riscv/interp_masm_riscv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
146146
ShouldNotReachHere();
147147
}
148148
// Clean up tos value in the thread object
149-
mvw(t0, (int) ilgl);
149+
mv(t0, (int)ilgl);
150150
sw(t0, tos_addr);
151151
sw(zr, val_addr);
152152
}
@@ -1497,8 +1497,8 @@ void InterpreterMacroAssembler::profile_switch_case(Register index,
14971497

14981498
// Build the base (index * per_case_size_in_bytes()) +
14991499
// case_array_offset_in_bytes()
1500-
mvw(reg2, in_bytes(MultiBranchData::per_case_size()));
1501-
mvw(t0, in_bytes(MultiBranchData::case_array_offset()));
1500+
mv(reg2, in_bytes(MultiBranchData::per_case_size()));
1501+
mv(t0, in_bytes(MultiBranchData::case_array_offset()));
15021502
Assembler::mul(index, index, reg2);
15031503
Assembler::add(index, index, t0);
15041504

src/hotspot/cpu/riscv/macroAssembler_riscv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,7 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src, Register
21702170
}
21712171
}
21722172

2173-
void MacroAssembler::decode_heap_oop_not_null(Register r) {
2173+
void MacroAssembler::decode_heap_oop_not_null(Register r) {
21742174
decode_heap_oop_not_null(r, r);
21752175
}
21762176

src/hotspot/cpu/riscv/macroAssembler_riscv.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ class MacroAssembler: public Assembler {
691691

692692
void li32(Register Rd, int32_t imm);
693693
void li64(Register Rd, int64_t imm);
694-
void li(Register Rd, int64_t imm); // optimized load immediate
694+
void li (Register Rd, int64_t imm); // optimized load immediate
695695

696696
// mv
697697
void mv(Register Rd, address addr) { li(Rd, (int64_t)addr); }
@@ -705,8 +705,6 @@ class MacroAssembler: public Assembler {
705705
template<typename T, ENABLE_IF(std::is_integral<T>::value)>
706706
inline void mv(Register Rd, T o) { li(Rd, (int64_t)o); }
707707

708-
inline void mvw(Register Rd, int32_t imm32) { mv(Rd, imm32); }
709-
710708
void mv(Register Rd, Address dest) {
711709
assert(dest.getMode() == Address::literal, "Address mode should be Address::literal");
712710
relocate(dest.rspec(), [&] {

src/hotspot/cpu/riscv/riscv.ad

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3898,9 +3898,9 @@ opclass memory(indirect, indOffI, indOffL, indirectN, indOffIN, indOffLN);
38983898
// n.b. this does not elide all L2I conversions. if the truncated
38993899
// value is consumed by more than one operation then the ConvL2I
39003900
// cannot be bundled into the consuming nodes so an l2i gets planted
3901-
// (actually a mvw $dst $src) and the downstream instructions consume
3902-
// the result of the l2i as an iRegI input. That's a shame since the
3903-
// mvw is actually redundant but its not too costly.
3901+
// (actually an addiw $dst, $src, 0) and the downstream instructions
3902+
// consume the result of the L2I as an iRegI input. That's a shame since
3903+
// the addiw is actually redundant but its not too costly.
39043904

39053905
opclass iRegIorL2I(iRegI, iRegL2I);
39063906
opclass iRegIorL(iRegI, iRegL);

src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static void gen_c2i_adapter(MacroAssembler *masm,
430430

431431
// Two VMREgs|OptoRegs can be T_OBJECT, T_ADDRESS, T_DOUBLE, T_LONG
432432
// T_DOUBLE and T_LONG use two slots in the interpreter
433-
if ( sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
433+
if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
434434
// ld_off == LSW, ld_off+wordSize == MSW
435435
// st_off == MSW, next_off == LSW
436436
__ sd(t0, Address(sp, next_off), /*temp register*/esp);
@@ -886,7 +886,7 @@ static OopMap* continuation_enter_setup(MacroAssembler* masm, int& stack_slots)
886886
// c_rarg3 -- isVirtualThread
887887
static void fill_continuation_entry(MacroAssembler* masm) {
888888
#ifdef ASSERT
889-
__ mvw(t0, ContinuationEntry::cookie_value());
889+
__ mv(t0, ContinuationEntry::cookie_value());
890890
__ sw(t0, Address(sp, ContinuationEntry::cookie_offset()));
891891
#endif
892892

@@ -2099,7 +2099,7 @@ void SharedRuntime::generate_deopt_blob() {
20992099
map = reg_saver.save_live_registers(masm, 0, &frame_size_in_words);
21002100

21012101
// Normal deoptimization. Save exec mode for unpack_frames.
2102-
__ mvw(xcpool, Deoptimization::Unpack_deopt); // callee-saved
2102+
__ mv(xcpool, Deoptimization::Unpack_deopt); // callee-saved
21032103
__ j(cont);
21042104

21052105
int reexecute_offset = __ pc() - start;
@@ -2116,7 +2116,7 @@ void SharedRuntime::generate_deopt_blob() {
21162116
// No need to update map as each call to save_live_registers will produce identical oopmap
21172117
(void) reg_saver.save_live_registers(masm, 0, &frame_size_in_words);
21182118

2119-
__ mvw(xcpool, Deoptimization::Unpack_reexecute); // callee-saved
2119+
__ mv(xcpool, Deoptimization::Unpack_reexecute); // callee-saved
21202120
__ j(cont);
21212121

21222122
#if INCLUDE_JVMCI
@@ -2139,10 +2139,10 @@ void SharedRuntime::generate_deopt_blob() {
21392139
__ set_last_Java_frame(sp, noreg, retaddr, t0);
21402140

21412141
__ lw(c_rarg1, Address(xthread, in_bytes(JavaThread::pending_deoptimization_offset())));
2142-
__ mvw(t0, -1);
2142+
__ mv(t0, -1);
21432143
__ sw(t0, Address(xthread, in_bytes(JavaThread::pending_deoptimization_offset())));
21442144

2145-
__ mvw(xcpool, (int32_t)Deoptimization::Unpack_reexecute);
2145+
__ mv(xcpool, (int32_t)Deoptimization::Unpack_reexecute);
21462146
__ mv(c_rarg0, xthread);
21472147
__ orrw(c_rarg2, zr, xcpool); // exec mode
21482148
RuntimeAddress target(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap));
@@ -2483,7 +2483,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
24832483
// n.b. 3 gp args, 0 fp args, integral return type
24842484

24852485
__ mv(c_rarg0, xthread);
2486-
__ mvw(c_rarg2, (unsigned)Deoptimization::Unpack_uncommon_trap);
2486+
__ mv(c_rarg2, (unsigned)Deoptimization::Unpack_uncommon_trap);
24872487
RuntimeAddress target(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap));
24882488
__ relocate(target.rspec(), [&] {
24892489
int32_t offset;
@@ -2509,7 +2509,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
25092509
#ifdef ASSERT
25102510
{ Label L;
25112511
__ lwu(t0, Address(x14, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()));
2512-
__ mvw(t1, Deoptimization::Unpack_uncommon_trap);
2512+
__ mv(t1, Deoptimization::Unpack_uncommon_trap);
25132513
__ beq(t0, t1, L);
25142514
__ stop("SharedRuntime::generate_uncommon_trap_blob: expected Unpack_uncommon_trap");
25152515
__ bind(L);
@@ -2610,7 +2610,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
26102610

26112611
// sp should already be aligned
26122612
__ mv(c_rarg0, xthread);
2613-
__ mvw(c_rarg1, (unsigned)Deoptimization::Unpack_uncommon_trap);
2613+
__ mv(c_rarg1, (unsigned)Deoptimization::Unpack_uncommon_trap);
26142614
target = RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames));
26152615
__ relocate(target.rspec(), [&] {
26162616
int32_t offset;

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ class StubGenerator: public StubCodeGenerator {
18491849
// Handle objArrays completely differently...
18501850
const jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
18511851
__ lw(lh, Address(scratch_src_klass, lh_offset));
1852-
__ mvw(t0, objArray_lh);
1852+
__ mv(t0, objArray_lh);
18531853
__ beq(lh, t0, L_objArray);
18541854

18551855
// if [src->klass() != dst->klass()] then return -1
@@ -1866,7 +1866,7 @@ class StubGenerator: public StubCodeGenerator {
18661866
{
18671867
BLOCK_COMMENT("assert primitive array {");
18681868
Label L;
1869-
__ mvw(t1, Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift);
1869+
__ mv(t1, Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift);
18701870
__ bge(lh, t1, L);
18711871
__ stop("must be a primitive array");
18721872
__ bind(L);
@@ -1939,7 +1939,7 @@ class StubGenerator: public StubCodeGenerator {
19391939
Label L;
19401940
__ andi(lh, lh, Klass::_lh_log2_element_size_mask); // lh -> x22_elsize
19411941
__ addw(lh, lh, zr);
1942-
__ mvw(t0, LogBytesPerLong);
1942+
__ mv(t0, LogBytesPerLong);
19431943
__ beq(x22_elsize, t0, L);
19441944
__ stop("must be long copy, but elsize is wrong");
19451945
__ bind(L);
@@ -1977,7 +1977,7 @@ class StubGenerator: public StubCodeGenerator {
19771977
{
19781978
// Before looking at dst.length, make sure dst is also an objArray.
19791979
__ lwu(t0, Address(t2, lh_offset));
1980-
__ mvw(t1, objArray_lh);
1980+
__ mv(t1, objArray_lh);
19811981
__ bne(t0, t1, L_failed);
19821982

19831983
// It is safe to examine both src.length and dst.length.
@@ -3855,7 +3855,7 @@ class StubGenerator: public StubCodeGenerator {
38553855
__ sd(x10, Address(sp, 1 * wordSize));
38563856
}
38573857

3858-
__ mvw(c_rarg1, (return_barrier ? 1 : 0));
3858+
__ mv(c_rarg1, (return_barrier ? 1 : 0));
38593859
__ call_VM_leaf(CAST_FROM_FN_PTR(address, Continuation::prepare_thaw), xthread, c_rarg1);
38603860
__ mv(t1, x10); // x10 contains the size of the frames to thaw, 0 if overflow or no more frames
38613861

@@ -3895,7 +3895,7 @@ class StubGenerator: public StubCodeGenerator {
38953895
}
38963896

38973897
// If we want, we can templatize thaw by kind, and have three different entries
3898-
__ mvw(c_rarg1, (uint32_t)kind);
3898+
__ mv(c_rarg1, (uint32_t)kind);
38993899

39003900
__ call_VM_leaf(Continuation::thaw_entry(), xthread, c_rarg1);
39013901
__ mv(t1, x10); // x10 is the sp of the yielding frame

src/hotspot/cpu/riscv/vtableStubs_riscv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
9090

9191
// check offset vs vtable length
9292
__ lwu(t0, Address(t2, Klass::vtable_length_offset()));
93-
__ mvw(t1, vtable_index * vtableEntry::size());
93+
__ mv(t1, vtable_index * vtableEntry::size());
9494
__ bgt(t0, t1, L);
9595
__ enter();
9696
__ mv(x12, vtable_index);

0 commit comments

Comments
 (0)