diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index 795e6882c6a..7e6fe50e8f8 100644 --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp @@ -2112,7 +2112,7 @@ class StubGenerator: public StubCodeGenerator { // Remaining count is less than 8 bytes. Fill it by a single store. // Note that the total length is no less than 8 bytes. - if (t == T_BYTE || t == T_SHORT) { + if (!AvoidUnalignedAccesses && (t == T_BYTE || t == T_SHORT)) { __ beqz(count, L_exit1); __ shadd(to, count, to, tmp_reg, shift); // points to the end __ sd(value, Address(to, -8)); // overwrite some elements