Skip to content

Commit e8768ae

Browse files
zifeihanRealFYang
andcommitted
8321972: test runtime/Unsafe/InternalErrorTest.java timeout on linux-riscv64 platform
Co-authored-by: Fei Yang <[email protected]> Reviewed-by: fyang
1 parent f6fe39f commit e8768ae

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/hotspot/cpu/riscv/assembler_riscv.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,17 @@ enum Nf {
29422942
return uabs(target - branch) < branch_range;
29432943
}
29442944

2945+
// Decode the given instruction, checking if it's a 16-bit compressed
2946+
// instruction and return the address of the next instruction.
2947+
static address locate_next_instruction(address inst) {
2948+
// Instruction wider than 16 bits has the two least-significant bits set.
2949+
if ((0x3 & *inst) == 0x3) {
2950+
return inst + instruction_size;
2951+
} else {
2952+
return inst + compressed_instruction_size;
2953+
}
2954+
}
2955+
29452956
Assembler(CodeBuffer* code) : AbstractAssembler(code), _in_compressible_region(true) {}
29462957
};
29472958

src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
232232
CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr;
233233
bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
234234
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
235-
address next_pc = pc + NativeCall::instruction_size;
235+
address next_pc = Assembler::locate_next_instruction(pc);
236236
if (is_unsafe_arraycopy) {
237237
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
238238
}
@@ -271,7 +271,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
271271
thread->thread_state() == _thread_in_native) &&
272272
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
273273
thread->doing_unsafe_access()) {
274-
address next_pc = pc + NativeCall::instruction_size;
274+
address next_pc = Assembler::locate_next_instruction(pc);
275275
if (UnsafeCopyMemory::contains_pc(pc)) {
276276
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
277277
}

0 commit comments

Comments
 (0)