[aarch64-port-dev ] jdk9: guarantee failure in javac

Edward Nevill edward.nevill at gmail.com
Thu Nov 5 15:59:24 UTC 2015


Hi,

I am seeing the following guarantee failure with jdk9 javac.

#  Internal Error (assembler_aarch64.hpp:223), pid=42005, tid=1827
#  guarantee(chk == -1 || chk == 0) failed: Field too big for insn

I have trapped this in gdb and the problem is that an adrp to the byte map base is becoming out of range when the code buffer is being relocated.

Here is a snapshot from gdb


#5  0x000003ffb5fbefbc in MacroAssembler::pd_patch_instruction_size (
    branch=0x3ffa664b088 "\353\251\200\220`\001\n\213\n", target=0x3fea6600000 "")
    at /home/ed/new_jdk9/dev/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp:137
137	    Instruction_aarch64::spatch(branch, 23, 5, offset);
(gdb) list
132	        assert(offset_lo == 0, "offset must be 0 for polling page or byte map base");
133	      }
134	    }
135	    int offset_lo = offset & 3;
136	    offset >>= 2;
137	    Instruction_aarch64::spatch(branch, 23, 5, offset);
138	    Instruction_aarch64::patch(branch, 30, 29, offset_lo);
139	  } else if (Instruction_aarch64::extract(insn, 31, 21) == 0b11010010100) {
140	    u_int64_t dest = (u_int64_t)target;
141	    // Move wide constant
(gdb) p/x branch
$27 = 0x3ffa664b088
(gdb) x/10i 0x3ffa664b088-20
   0x3ffa664b074:	ldr	w24, [x26,#16]
   0x3ffa664b078:	sxtb	w29, w21
   0x3ffa664b07c:	str	w13, [x22,#16]
   0x3ffa664b080:	cbz	x10, 0x3ffa664b100
   0x3ffa664b084:	lsr	x10, x11, #9
   0x3ffa664b088:	adrp	x11, 0x3fea7b87000  <<<< Instruction being patched
   0x3ffa664b08c:	add	x0, x11, x10
   0x3ffa664b090:	ldrsb	w10, [x0]
   0x3ffa664b094:	cmp	w10, #0x20
   0x3ffa664b098:	b.eq	0x3ffa664b100
(gdb) p/x target                                    <<<< Byte map base
$28 = 0x3fea6600000
(gdb) p/x 0x3ffa664b088-0x3fea6600000
$29 = 0x10004b088                                   <<<<< Offset > 4G


So, how do we address this?

1) Use lea, but that is 3 instructions (movz, movk, movk)

2) Allocate a permanent register for byte map base

3) Something else?

I am leaning towards 2. We have plenty of callee save registers.

And do we need to do the same thing with the polling page?

Thanks for your help,
Ed.




More information about the aarch64-port-dev mailing list