Skip to content

Commit f1e0780

Browse files
committedAug 18, 2020
8251930: Native types mismatch in hotspot
Reviewed-by: aph
1 parent c4bb35e commit f1e0780

5 files changed

+53
-58
lines changed
 

‎src/hotspot/cpu/aarch64/aarch64.ad

+1-1
Original file line numberDiff line numberDiff line change
@@ -3159,7 +3159,7 @@ encode %{
31593159
if (con < (address)(uintptr_t)os::vm_page_size()) {
31603160
__ mov(dst_reg, con);
31613161
} else {
3162-
uintptr_t offset;
3162+
uint64_t offset;
31633163
__ adrp(dst_reg, con, offset);
31643164
__ add(dst_reg, dst_reg, offset);
31653165
}

‎src/hotspot/cpu/aarch64/assembler_aarch64.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ void Address::lea(MacroAssembler *as, Register r) const {
15431543
}
15441544
}
15451545

1546-
void Assembler::adrp(Register reg1, const Address &dest, uintptr_t &byte_offset) {
1546+
void Assembler::adrp(Register reg1, const Address &dest, uint64_t &byte_offset) {
15471547
ShouldNotReachHere();
15481548
}
15491549

@@ -1714,7 +1714,7 @@ void Assembler::add_sub_immediate(Register Rd, Register Rn, unsigned uimm, int o
17141714

17151715
bool Assembler::operand_valid_for_add_sub_immediate(int64_t imm) {
17161716
bool shift = false;
1717-
uint64_t uimm = (uint64_t)uabs(imm);
1717+
uint64_t uimm = (uint64_t)uabs((jlong)imm);
17181718
if (uimm < (1 << 12))
17191719
return true;
17201720
if (uimm < (1 << 24)

‎src/hotspot/cpu/aarch64/assembler_aarch64.hpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,15 @@ class Address {
380380
: _base(r), _index(noreg), _offset(0), _mode(base_plus_offset), _target(0) { }
381381
Address(Register r, int o)
382382
: _base(r), _index(noreg), _offset(o), _mode(base_plus_offset), _target(0) { }
383-
Address(Register r, int64_t o)
383+
Address(Register r, long o)
384384
: _base(r), _index(noreg), _offset(o), _mode(base_plus_offset), _target(0) { }
385-
Address(Register r, uint64_t o)
385+
Address(Register r, long long o)
386+
: _base(r), _index(noreg), _offset(o), _mode(base_plus_offset), _target(0) { }
387+
Address(Register r, unsigned int o)
388+
: _base(r), _index(noreg), _offset(o), _mode(base_plus_offset), _target(0) { }
389+
Address(Register r, unsigned long o)
390+
: _base(r), _index(noreg), _offset(o), _mode(base_plus_offset), _target(0) { }
391+
Address(Register r, unsigned long long o)
386392
: _base(r), _index(noreg), _offset(o), _mode(base_plus_offset), _target(0) { }
387393
#ifdef ASSERT
388394
Address(Register r, ByteSize disp)

‎src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

+35-35
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ void MacroAssembler::far_call(Address entry, CodeBuffer *cbuf, Register tmp) {
389389
assert(CodeCache::find_blob(entry.target()) != NULL,
390390
"destination of far call not found in code cache");
391391
if (far_branches()) {
392-
uintptr_t offset;
392+
uint64_t offset;
393393
// We can use ADRP here because we know that the total size of
394394
// the code cache cannot exceed 2Gb.
395395
adrp(tmp, entry, offset);
@@ -407,7 +407,7 @@ void MacroAssembler::far_jump(Address entry, CodeBuffer *cbuf, Register tmp) {
407407
assert(CodeCache::find_blob(entry.target()) != NULL,
408408
"destination of far call not found in code cache");
409409
if (far_branches()) {
410-
uintptr_t offset;
410+
uint64_t offset;
411411
// We can use ADRP here because we know that the total size of
412412
// the code cache cannot exceed 2Gb.
413413
adrp(tmp, entry, offset);
@@ -1499,7 +1499,7 @@ void MacroAssembler::movptr(Register r, uintptr_t imm64) {
14991499
#ifndef PRODUCT
15001500
{
15011501
char buffer[64];
1502-
snprintf(buffer, sizeof(buffer), "0x%" PRIX64, imm64);
1502+
snprintf(buffer, sizeof(buffer), "0x%" PRIX64, (uint64_t)imm64);
15031503
block_comment(buffer);
15041504
}
15051505
#endif
@@ -2579,43 +2579,43 @@ void MacroAssembler::debug64(char* msg, int64_t pc, int64_t regs[])
25792579
#endif
25802580
if (os::message_box(msg, "Execution stopped, print registers?")) {
25812581
ttyLocker ttyl;
2582-
tty->print_cr(" pc = 0x%016lx", pc);
2582+
tty->print_cr(" pc = 0x%016" PRIx64, pc);
25832583
#ifndef PRODUCT
25842584
tty->cr();
25852585
findpc(pc);
25862586
tty->cr();
25872587
#endif
2588-
tty->print_cr(" r0 = 0x%016lx", regs[0]);
2589-
tty->print_cr(" r1 = 0x%016lx", regs[1]);
2590-
tty->print_cr(" r2 = 0x%016lx", regs[2]);
2591-
tty->print_cr(" r3 = 0x%016lx", regs[3]);
2592-
tty->print_cr(" r4 = 0x%016lx", regs[4]);
2593-
tty->print_cr(" r5 = 0x%016lx", regs[5]);
2594-
tty->print_cr(" r6 = 0x%016lx", regs[6]);
2595-
tty->print_cr(" r7 = 0x%016lx", regs[7]);
2596-
tty->print_cr(" r8 = 0x%016lx", regs[8]);
2597-
tty->print_cr(" r9 = 0x%016lx", regs[9]);
2598-
tty->print_cr("r10 = 0x%016lx", regs[10]);
2599-
tty->print_cr("r11 = 0x%016lx", regs[11]);
2600-
tty->print_cr("r12 = 0x%016lx", regs[12]);
2601-
tty->print_cr("r13 = 0x%016lx", regs[13]);
2602-
tty->print_cr("r14 = 0x%016lx", regs[14]);
2603-
tty->print_cr("r15 = 0x%016lx", regs[15]);
2604-
tty->print_cr("r16 = 0x%016lx", regs[16]);
2605-
tty->print_cr("r17 = 0x%016lx", regs[17]);
2606-
tty->print_cr("r18 = 0x%016lx", regs[18]);
2607-
tty->print_cr("r19 = 0x%016lx", regs[19]);
2608-
tty->print_cr("r20 = 0x%016lx", regs[20]);
2609-
tty->print_cr("r21 = 0x%016lx", regs[21]);
2610-
tty->print_cr("r22 = 0x%016lx", regs[22]);
2611-
tty->print_cr("r23 = 0x%016lx", regs[23]);
2612-
tty->print_cr("r24 = 0x%016lx", regs[24]);
2613-
tty->print_cr("r25 = 0x%016lx", regs[25]);
2614-
tty->print_cr("r26 = 0x%016lx", regs[26]);
2615-
tty->print_cr("r27 = 0x%016lx", regs[27]);
2616-
tty->print_cr("r28 = 0x%016lx", regs[28]);
2617-
tty->print_cr("r30 = 0x%016lx", regs[30]);
2618-
tty->print_cr("r31 = 0x%016lx", regs[31]);
2588+
tty->print_cr(" r0 = 0x%016" PRIx64, regs[0]);
2589+
tty->print_cr(" r1 = 0x%016" PRIx64, regs[1]);
2590+
tty->print_cr(" r2 = 0x%016" PRIx64, regs[2]);
2591+
tty->print_cr(" r3 = 0x%016" PRIx64, regs[3]);
2592+
tty->print_cr(" r4 = 0x%016" PRIx64, regs[4]);
2593+
tty->print_cr(" r5 = 0x%016" PRIx64, regs[5]);
2594+
tty->print_cr(" r6 = 0x%016" PRIx64, regs[6]);
2595+
tty->print_cr(" r7 = 0x%016" PRIx64, regs[7]);
2596+
tty->print_cr(" r8 = 0x%016" PRIx64, regs[8]);
2597+
tty->print_cr(" r9 = 0x%016" PRIx64, regs[9]);
2598+
tty->print_cr("r10 = 0x%016" PRIx64, regs[10]);
2599+
tty->print_cr("r11 = 0x%016" PRIx64, regs[11]);
2600+
tty->print_cr("r12 = 0x%016" PRIx64, regs[12]);
2601+
tty->print_cr("r13 = 0x%016" PRIx64, regs[13]);
2602+
tty->print_cr("r14 = 0x%016" PRIx64, regs[14]);
2603+
tty->print_cr("r15 = 0x%016" PRIx64, regs[15]);
2604+
tty->print_cr("r16 = 0x%016" PRIx64, regs[16]);
2605+
tty->print_cr("r17 = 0x%016" PRIx64, regs[17]);
2606+
tty->print_cr("r18 = 0x%016" PRIx64, regs[18]);
2607+
tty->print_cr("r19 = 0x%016" PRIx64, regs[19]);
2608+
tty->print_cr("r20 = 0x%016" PRIx64, regs[20]);
2609+
tty->print_cr("r21 = 0x%016" PRIx64, regs[21]);
2610+
tty->print_cr("r22 = 0x%016" PRIx64, regs[22]);
2611+
tty->print_cr("r23 = 0x%016" PRIx64, regs[23]);
2612+
tty->print_cr("r24 = 0x%016" PRIx64, regs[24]);
2613+
tty->print_cr("r25 = 0x%016" PRIx64, regs[25]);
2614+
tty->print_cr("r26 = 0x%016" PRIx64, regs[26]);
2615+
tty->print_cr("r27 = 0x%016" PRIx64, regs[27]);
2616+
tty->print_cr("r28 = 0x%016" PRIx64, regs[28]);
2617+
tty->print_cr("r30 = 0x%016" PRIx64, regs[30]);
2618+
tty->print_cr("r31 = 0x%016" PRIx64, regs[31]);
26192619
BREAKPOINT;
26202620
}
26212621
}

‎src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

+7-18
Original file line numberDiff line numberDiff line change
@@ -489,31 +489,20 @@ class MacroAssembler: public Assembler {
489489
// now mov instructions for loading absolute addresses and 32 or
490490
// 64 bit integers
491491

492-
inline void mov(Register dst, address addr)
493-
{
494-
mov_immediate64(dst, (uint64_t)addr);
495-
}
492+
inline void mov(Register dst, address addr) { mov_immediate64(dst, (uint64_t)addr); }
496493

497-
inline void mov(Register dst, uint64_t imm64)
498-
{
499-
mov_immediate64(dst, imm64);
500-
}
494+
inline void mov(Register dst, int imm64) { mov_immediate64(dst, (uint64_t)imm64); }
495+
inline void mov(Register dst, long imm64) { mov_immediate64(dst, (uint64_t)imm64); }
496+
inline void mov(Register dst, long long imm64) { mov_immediate64(dst, (uint64_t)imm64); }
497+
inline void mov(Register dst, unsigned int imm64) { mov_immediate64(dst, (uint64_t)imm64); }
498+
inline void mov(Register dst, unsigned long imm64) { mov_immediate64(dst, (uint64_t)imm64); }
499+
inline void mov(Register dst, unsigned long long imm64) { mov_immediate64(dst, (uint64_t)imm64); }
501500

502501
inline void movw(Register dst, uint32_t imm32)
503502
{
504503
mov_immediate32(dst, imm32);
505504
}
506505

507-
inline void mov(Register dst, int64_t l)
508-
{
509-
mov(dst, (uint64_t)l);
510-
}
511-
512-
inline void mov(Register dst, int i)
513-
{
514-
mov(dst, (int64_t)i);
515-
}
516-
517506
void mov(Register dst, RegisterOrConstant src) {
518507
if (src.is_register())
519508
mov(dst, src.as_register());

0 commit comments

Comments
 (0)
Please sign in to comment.