Thu, 05 May 2016 17:04:35 -0400
TemplateTable::fast_xaccess(): fix unaligned lhu
BCP and offset may both be unaligned.
Two LBU are required.
public class List {
public List next;
public void insert() {
List p = new List();
p.next = this.next;
}
public static void main(String[] args) throws Exception {
List th = new List();
while(true)
th.insert();
}
}
Effect:
- -Xint: 0 unaligned access
src/cpu/mips/vm/assembler_mips.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/cpu/mips/vm/assembler_mips.cpp Thu May 05 14:53:07 2016 -0400 1.2 +++ b/src/cpu/mips/vm/assembler_mips.cpp Thu May 05 17:04:35 2016 -0400 1.3 @@ -3277,22 +3277,17 @@ 1.4 1.5 void MacroAssembler::load_two_bytes_from_at_bcp(Register reg, Register tmp, int offset) 1.6 { 1.7 - 1.8 - if(offset & 1){ 1.9 - lbu(reg, BCP, offset+1); 1.10 - lbu(tmp, BCP, offset); 1.11 + /* 2016/5/6 Jin: the runtime address of BCP may be unaligned. 1.12 + * Refer to the SPARC implementation. */ 1.13 + lbu(reg, BCP, offset+1); 1.14 + lbu(tmp, BCP, offset); 1.15 #ifdef _LP64 1.16 -//FIXME aoqi. indexbyte1 << 8 | indexbyte2? 1.17 - //dsll(tmp, tmp, 8); 1.18 - dsll(reg, reg, 8); 1.19 - daddu(reg, tmp, reg); 1.20 + dsll(reg, reg, 8); 1.21 + daddu(reg, tmp, reg); 1.22 #else 1.23 - sll(reg, reg, 8); 1.24 - addu(reg, tmp, reg); 1.25 + sll(reg, reg, 8); 1.26 + addu(reg, tmp, reg); 1.27 #endif 1.28 - } 1.29 - else 1.30 - lhu(reg, BCP, offset); 1.31 } 1.32 1.33 void MacroAssembler::store_two_byts_to_at_bcp(Register reg, Register tmp, int offset)