Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5325,7 +5325,12 @@ void MacroAssembler::set_narrow_klass(Register dst, Klass* k) {
relocate(metadata_Relocation::spec(index), [&] {
li32(dst, nk);
});
zext(dst, dst, 32);
// li32 uses addiw which sign-extends; only need zext when bit 31 is set.
// Safe: narrow klass immediates are never patched at runtime on RISC-V
// (see metadata_Relocation::pd_fix_value).
if ((int32_t)nk < 0) {
zext(dst, dst, 32);
}
}

address MacroAssembler::reloc_call(Address entry, Register tmp) {
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/cpu/riscv/relocInfo_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,8 @@ void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffe
}
}

// Currently a no-op: no immediate patching is performed.
// If this changes, update MacroAssembler::set_narrow_klass accordingly
// (its conditional zext relies on the narrow klass value being immutable).
void metadata_Relocation::pd_fix_value(address x) {
}