Skip to content

Commit 2121302

Browse files
lkorinthAndrew Haley
andcommitted
8380164: Fix implicit conversion in nativeInst_aarch64.hpp
Co-authored-by: Andrew Haley <[email protected]> Reviewed-by: aph, aseoane
1 parent 9745967 commit 2121302

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class NativeInstruction {
9797
#define MACOS_WX_WRITE MACOS_AARCH64_ONLY(os::thread_wx_enable_write())
9898
void set_char_at(int offset, char c) { MACOS_WX_WRITE; *addr_at(offset) = (u_char)c; }
9999
void set_int_at(int offset, jint i) { MACOS_WX_WRITE; *(jint*)addr_at(offset) = i; }
100-
void set_uint_at(int offset, jint i) { MACOS_WX_WRITE; *(juint*)addr_at(offset) = i; }
100+
void set_uint_at(int offset, juint i) { MACOS_WX_WRITE; *(juint*)addr_at(offset) = i; }
101101
void set_ptr_at(int offset, address ptr) { MACOS_WX_WRITE; *(address*)addr_at(offset) = ptr; }
102102
void set_oop_at(int offset, oop o) { MACOS_WX_WRITE; *(oop*)addr_at(offset) = o; }
103103
#undef MACOS_WX_WRITE
@@ -178,13 +178,11 @@ class NativeCall: public NativeInstruction {
178178
address destination() const;
179179

180180
void set_destination(address dest) {
181-
int offset = dest - instruction_address();
182-
unsigned int insn = 0b100101 << 26;
181+
int64_t offset = dest - instruction_address();
182+
juint insn = 0b100101u << 26u;
183183
assert((offset & 3) == 0, "should be");
184-
offset >>= 2;
185-
offset &= (1 << 26) - 1; // mask off insn part
186-
insn |= offset;
187-
set_int_at(displacement_offset, insn);
184+
Instruction_aarch64::spatch(reinterpret_cast<address>(&insn), 25, 0, offset >> 2);
185+
set_uint_at(displacement_offset, insn);
188186
}
189187

190188
void verify_alignment() { ; }

0 commit comments

Comments
 (0)