Skip to content

Commit

Permalink
8321972: test runtime/Unsafe/InternalErrorTest.java timeout on linux-…
Browse files Browse the repository at this point in the history
…riscv64 platform

Backport-of: e8768ae08dbee9c3e1ed01934142c03ffad5f349
  • Loading branch information
Olga Mikhaltsova committed Jan 18, 2024
1 parent a1f0a3c commit e27e599
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/hotspot/cpu/riscv/assembler_riscv.hpp
Expand Up @@ -2940,6 +2940,17 @@ enum Nf {
return uabs(target - branch) < branch_range;
}

// Decode the given instruction, checking if it's a 16-bit compressed
// instruction and return the address of the next instruction.
static address locate_next_instruction(address inst) {
// Instruction wider than 16 bits has the two least-significant bits set.
if ((0x3 & *inst) == 0x3) {
return inst + instruction_size;
} else {
return inst + compressed_instruction_size;
}
}

Assembler(CodeBuffer* code) : AbstractAssembler(code), _in_compressible_region(true) {}
};

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
Expand Up @@ -232,7 +232,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr;
bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
address next_pc = pc + NativeCall::instruction_size;
address next_pc = Assembler::locate_next_instruction(pc);
if (is_unsafe_arraycopy) {
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
}
Expand Down Expand Up @@ -271,7 +271,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
thread->thread_state() == _thread_in_native) &&
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
thread->doing_unsafe_access()) {
address next_pc = pc + NativeCall::instruction_size;
address next_pc = Assembler::locate_next_instruction(pc);
if (UnsafeCopyMemory::contains_pc(pc)) {
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
}
Expand Down

1 comment on commit e27e599

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.