Skip to content

Commit d7d50c3

Browse files
zifeihanRealFYang
authored andcommitted
8301818: RISC-V: Factor out function mvw from MacroAssembler
8302114: RISC-V: Several foreign jtreg tests fail with debug build after JDK-8301818 Reviewed-by: fyang Backport-of: c04a982eb47170f3c613617179fca012bb4d40ae
1 parent ace2c5c commit d7d50c3

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
@@ -460,7 +460,7 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod
460460
switch (c->type()) {
461461
case T_INT:
462462
assert(patch_code == lir_patch_none, "no patching handled here");
463-
__ mvw(dest->as_register(), c->as_jint());
463+
__ mv(dest->as_register(), c->as_jint());
464464
break;
465465

466466
case T_ADDRESS:
@@ -528,7 +528,7 @@ void LIR_Assembler::const2stack(LIR_Opr src, LIR_Opr dest) {
528528
if (c->as_jint_bits() == 0) {
529529
__ sw(zr, frame_map()->address_for_slot(dest->single_stack_ix()));
530530
} else {
531-
__ mvw(t1, c->as_jint_bits());
531+
__ mv(t1, c->as_jint_bits());
532532
__ sw(t1, frame_map()->address_for_slot(dest->single_stack_ix()));
533533
}
534534
break;
@@ -1021,7 +1021,7 @@ void LIR_Assembler::emit_alloc_obj(LIR_OpAllocObj* op) {
10211021
if (op->init_check()) {
10221022
__ lbu(t0, Address(op->klass()->as_register(),
10231023
InstanceKlass::init_state_offset()));
1024-
__ mvw(t1, InstanceKlass::fully_initialized);
1024+
__ mv(t1, (u1)InstanceKlass::fully_initialized);
10251025
add_debug_info_for_null_check_here(op->stub()->info());
10261026
__ bne(t0, t1, *op->stub()->entry(), /* is_far */ true);
10271027
}

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
}
@@ -1495,8 +1495,8 @@ void InterpreterMacroAssembler::profile_switch_case(Register index,
14951495

14961496
// Build the base (index * per_case_size_in_bytes()) +
14971497
// case_array_offset_in_bytes()
1498-
mvw(reg2, in_bytes(MultiBranchData::per_case_size()));
1499-
mvw(t0, in_bytes(MultiBranchData::case_array_offset()));
1498+
mv(reg2, in_bytes(MultiBranchData::per_case_size()));
1499+
mv(t0, in_bytes(MultiBranchData::case_array_offset()));
15001500
Assembler::mul(index, index, reg2);
15011501
Assembler::add(index, index, t0);
15021502

src/hotspot/cpu/riscv/macroAssembler_riscv.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
4-
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
4+
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66
*
77
* This code is free software; you can redistribute it and/or modify it
@@ -2083,7 +2083,7 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src, Register
20832083
return;
20842084
}
20852085

2086-
if (((uint64_t)(uintptr_t)CompressedKlassPointers::base() & 0xffffffff) == 0 &&
2086+
if (((uint64_t)CompressedKlassPointers::base() & 0xffffffff) == 0 &&
20872087
CompressedKlassPointers::shift() == 0) {
20882088
zero_extend(dst, src, 32);
20892089
return;
@@ -2095,15 +2095,15 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src, Register
20952095
}
20962096

20972097
assert_different_registers(src, xbase);
2098-
mv(xbase, (intptr_t)CompressedKlassPointers::base());
2098+
mv(xbase, (uintptr_t)CompressedKlassPointers::base());
20992099
sub(dst, src, xbase);
21002100
if (CompressedKlassPointers::shift() != 0) {
21012101
assert(LogKlassAlignmentInBytes == CompressedKlassPointers::shift(), "decode alg wrong");
21022102
srli(dst, dst, LogKlassAlignmentInBytes);
21032103
}
21042104
}
21052105

2106-
void MacroAssembler::decode_heap_oop_not_null(Register r) {
2106+
void MacroAssembler::decode_heap_oop_not_null(Register r) {
21072107
decode_heap_oop_not_null(r, r);
21082108
}
21092109

src/hotspot/cpu/riscv/macroAssembler_riscv.hpp

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

666666
void li32(Register Rd, int32_t imm);
667667
void li64(Register Rd, int64_t imm);
668-
void li(Register Rd, int64_t imm); // optimized load immediate
668+
void li (Register Rd, int64_t imm); // optimized load immediate
669669

670670
// mv
671671
void mv(Register Rd, address addr) { li(Rd, (int64_t)addr); }
@@ -679,8 +679,6 @@ class MacroAssembler: public Assembler {
679679
template<typename T, ENABLE_IF(std::is_integral<T>::value)>
680680
inline void mv(Register Rd, T o) { li(Rd, (int64_t)o); }
681681

682-
inline void mvw(Register Rd, int32_t imm32) { mv(Rd, imm32); }
683-
684682
void mv(Register Rd, Address dest) {
685683
assert(dest.getMode() == Address::literal, "Address mode should be Address::literal");
686684
relocate(dest.rspec(), [&] {

src/hotspot/cpu/riscv/riscv.ad

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

37943794
opclass iRegIorL2I(iRegI, iRegL2I);
37953795
opclass iRegIorL(iRegI, iRegL);

src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
4-
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
4+
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66
*
77
* This code is free software; you can redistribute it and/or modify it
@@ -434,7 +434,7 @@ static void gen_c2i_adapter(MacroAssembler *masm,
434434

435435
// Two VMREgs|OptoRegs can be T_OBJECT, T_ADDRESS, T_DOUBLE, T_LONG
436436
// T_DOUBLE and T_LONG use two slots in the interpreter
437-
if ( sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
437+
if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
438438
// ld_off == LSW, ld_off+wordSize == MSW
439439
// st_off == MSW, next_off == LSW
440440
__ sd(t0, Address(sp, next_off), /*temp register*/esp);
@@ -2119,7 +2119,7 @@ void SharedRuntime::generate_deopt_blob() {
21192119
map = reg_saver.save_live_registers(masm, 0, &frame_size_in_words);
21202120

21212121
// Normal deoptimization. Save exec mode for unpack_frames.
2122-
__ mvw(xcpool, Deoptimization::Unpack_deopt); // callee-saved
2122+
__ mv(xcpool, Deoptimization::Unpack_deopt); // callee-saved
21232123
__ j(cont);
21242124

21252125
int reexecute_offset = __ pc() - start;
@@ -2130,7 +2130,7 @@ void SharedRuntime::generate_deopt_blob() {
21302130
// No need to update map as each call to save_live_registers will produce identical oopmap
21312131
(void) reg_saver.save_live_registers(masm, 0, &frame_size_in_words);
21322132

2133-
__ mvw(xcpool, Deoptimization::Unpack_reexecute); // callee-saved
2133+
__ mv(xcpool, Deoptimization::Unpack_reexecute); // callee-saved
21342134
__ j(cont);
21352135

21362136
int exception_offset = __ pc() - start;
@@ -2444,7 +2444,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
24442444
// n.b. 3 gp args, 0 fp args, integral return type
24452445

24462446
__ mv(c_rarg0, xthread);
2447-
__ mvw(c_rarg2, (unsigned)Deoptimization::Unpack_uncommon_trap);
2447+
__ mv(c_rarg2, Deoptimization::Unpack_uncommon_trap);
24482448
RuntimeAddress target(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap));
24492449
__ relocate(target.rspec(), [&] {
24502450
int32_t offset;
@@ -2470,7 +2470,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
24702470
#ifdef ASSERT
24712471
{ Label L;
24722472
__ lwu(t0, Address(x14, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()));
2473-
__ mvw(t1, Deoptimization::Unpack_uncommon_trap);
2473+
__ mv(t1, Deoptimization::Unpack_uncommon_trap);
24742474
__ beq(t0, t1, L);
24752475
__ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared");
24762476
__ bind(L);
@@ -2571,7 +2571,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
25712571

25722572
// sp should already be aligned
25732573
__ mv(c_rarg0, xthread);
2574-
__ mvw(c_rarg1, (unsigned)Deoptimization::Unpack_uncommon_trap);
2574+
__ mv(c_rarg1, Deoptimization::Unpack_uncommon_trap);
25752575
target = RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames));
25762576
__ relocate(target.rspec(), [&] {
25772577
int32_t offset;

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
4-
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
4+
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66
*
77
* This code is free software; you can redistribute it and/or modify it
@@ -1835,7 +1835,7 @@ class StubGenerator: public StubCodeGenerator {
18351835
// Handle objArrays completely differently...
18361836
const jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
18371837
__ lw(lh, Address(scratch_src_klass, lh_offset));
1838-
__ mvw(t0, objArray_lh);
1838+
__ mv(t0, objArray_lh);
18391839
__ beq(lh, t0, L_objArray);
18401840

18411841
// if [src->klass() != dst->klass()] then return -1
@@ -1852,7 +1852,7 @@ class StubGenerator: public StubCodeGenerator {
18521852
{
18531853
BLOCK_COMMENT("assert primitive array {");
18541854
Label L;
1855-
__ mvw(t1, Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift);
1855+
__ mv(t1, (int32_t)(Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift));
18561856
__ bge(lh, t1, L);
18571857
__ stop("must be a primitive array");
18581858
__ bind(L);
@@ -1925,7 +1925,7 @@ class StubGenerator: public StubCodeGenerator {
19251925
Label L;
19261926
__ andi(lh, lh, Klass::_lh_log2_element_size_mask); // lh -> x22_elsize
19271927
__ addw(lh, lh, zr);
1928-
__ mvw(t0, LogBytesPerLong);
1928+
__ mv(t0, LogBytesPerLong);
19291929
__ beq(x22_elsize, t0, L);
19301930
__ stop("must be long copy, but elsize is wrong");
19311931
__ bind(L);
@@ -1963,7 +1963,7 @@ class StubGenerator: public StubCodeGenerator {
19631963
{
19641964
// Before looking at dst.length, make sure dst is also an objArray.
19651965
__ lwu(t0, Address(t2, lh_offset));
1966-
__ mvw(t1, objArray_lh);
1966+
__ mv(t1, objArray_lh);
19671967
__ bne(t0, t1, L_failed);
19681968

19691969
// It is safe to examine both src.length and dst.length.

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)