Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.
/ jdk22u Public archive

Commit e27e599

Browse files
author
Olga Mikhaltsova
committed
8321972: test runtime/Unsafe/InternalErrorTest.java timeout on linux-riscv64 platform
Backport-of: e8768ae08dbee9c3e1ed01934142c03ffad5f349
1 parent a1f0a3c commit e27e599

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/hotspot/cpu/riscv/assembler_riscv.hpp

+11
Original file line numberDiff line numberDiff line change
@@ -2940,6 +2940,17 @@ enum Nf {
29402940
return uabs(target - branch) < branch_range;
29412941
}
29422942

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

src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp

+2-2
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)