- 
    Type:
Bug
 - 
    Resolution: Fixed
 - 
    Priority:
  P2                     
     - 
    Affects Version/s: 8, 11, 15, 16
 - 
    Component/s: hotspot
 
- 
        b23
 
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8256175 | 11.0.11-oracle | Dukebot | P2 | Closed | Fixed | b01 | 
| JDK-8256395 | 11.0.10 | Aleksey Shipilev | P2 | Resolved | Fixed | b03 | 
                    Compare:
void Assembler::cmpq(Address dst, Register src) {
InstructionMark im(this);
emit_int16(get_prefixq(dst, src), 0x3B);
emit_operand(src, dst);
}
void Assembler::cmpq(Register dst, Address src) {
InstructionMark im(this);
emit_int16(get_prefixq(src, dst), 0x3B);
emit_operand(dst, src);
}
They use the same opcode -- 0x3B, which is for "CMP r, r/m". While cmpq(Address,Register) actually should be using 0x39 for "CMP r/m, r". I also suspect they emit basically the same instruction, because the get_prefixq and emit_operand order is irrelevant.
AFAIU, it does not break horribly, because the cmpq(Address,Register) is not used anywhere except the new code in MacroAssembler::safepoint_poll, added byJDK-8253180. This was found by Zhengyu, when he was trying to enable that new code on x86_32.
We should either encode this cmpq properly, or remove cmpq(Address,Register) and use the other one, cmpq(Register,Address) consistently.
void Assembler::cmpq(Address dst, Register src) {
InstructionMark im(this);
emit_int16(get_prefixq(dst, src), 0x3B);
emit_operand(src, dst);
}
void Assembler::cmpq(Register dst, Address src) {
InstructionMark im(this);
emit_int16(get_prefixq(src, dst), 0x3B);
emit_operand(dst, src);
}
They use the same opcode -- 0x3B, which is for "CMP r, r/m". While cmpq(Address,Register) actually should be using 0x39 for "CMP r/m, r". I also suspect they emit basically the same instruction, because the get_prefixq and emit_operand order is irrelevant.
AFAIU, it does not break horribly, because the cmpq(Address,Register) is not used anywhere except the new code in MacroAssembler::safepoint_poll, added by
We should either encode this cmpq properly, or remove cmpq(Address,Register) and use the other one, cmpq(Register,Address) consistently.
- backported by
 - 
                    
JDK-8256395 x86: Assembler::cmpq(Address dst, Register src) encoding is incorrect
-         
     - Resolved
 
 -         
 - 
                    
JDK-8256175 x86: Assembler::cmpq(Address dst, Register src) encoding is incorrect
-         
     - Closed
 
 -         
 
- is blocked by
 - 
                    
JDK-8255579 x86: Use cmpq(Register,Address) in safepoint_poll
-         
     - Resolved
 
 -