comparison src/cpu/x86/vm/assembler_x86.cpp @ 6834:bacdc1d5c21c

6884973: java -XX:Atomics=2 crashes Summary: Remove buggy experimental option Reviewed-by: acorn, coleenp Contributed-by: harold.seigel@oracle.com
author coleenp
date Thu, 04 Oct 2012 08:43:14 -0400
parents d8ce2825b193
children d804e148cff8
comparison
equal deleted inserted replaced
6833:ba8fd2fe198b 6834:bacdc1d5c21c
1168 1168
1169 // The 32-bit cmpxchg compares the value at adr with the contents of rax, 1169 // The 32-bit cmpxchg compares the value at adr with the contents of rax,
1170 // and stores reg into adr if so; otherwise, the value at adr is loaded into rax,. 1170 // and stores reg into adr if so; otherwise, the value at adr is loaded into rax,.
1171 // The ZF is set if the compared values were equal, and cleared otherwise. 1171 // The ZF is set if the compared values were equal, and cleared otherwise.
1172 void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg 1172 void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg
1173 if (Atomics & 2) { 1173 InstructionMark im(this);
1174 // caveat: no instructionmark, so this isn't relocatable. 1174 prefix(adr, reg);
1175 // Emit a synthetic, non-atomic, CAS equivalent. 1175 emit_byte(0x0F);
1176 // Beware. The synthetic form sets all ICCs, not just ZF. 1176 emit_byte(0xB1);
1177 // cmpxchg r,[m] is equivalent to rax, = CAS (m, rax, r) 1177 emit_operand(reg, adr);
1178 cmpl(rax, adr);
1179 movl(rax, adr);
1180 if (reg != rax) {
1181 Label L ;
1182 jcc(Assembler::notEqual, L);
1183 movl(adr, reg);
1184 bind(L);
1185 }
1186 } else {
1187 InstructionMark im(this);
1188 prefix(adr, reg);
1189 emit_byte(0x0F);
1190 emit_byte(0xB1);
1191 emit_operand(reg, adr);
1192 }
1193 } 1178 }
1194 1179
1195 void Assembler::comisd(XMMRegister dst, Address src) { 1180 void Assembler::comisd(XMMRegister dst, Address src) {
1196 // NOTE: dbx seems to decode this as comiss even though the 1181 // NOTE: dbx seems to decode this as comiss even though the
1197 // 0x66 is there. Strangly ucomisd comes out correct 1182 // 0x66 is there. Strangly ucomisd comes out correct
1511 emit_byte(0x8D); 1496 emit_byte(0x8D);
1512 emit_operand(dst, src); 1497 emit_operand(dst, src);
1513 } 1498 }
1514 1499
1515 void Assembler::lock() { 1500 void Assembler::lock() {
1516 if (Atomics & 1) { 1501 emit_byte(0xF0);
1517 // Emit either nothing, a NOP, or a NOP: prefix
1518 emit_byte(0x90) ;
1519 } else {
1520 emit_byte(0xF0);
1521 }
1522 } 1502 }
1523 1503
1524 void Assembler::lzcntl(Register dst, Register src) { 1504 void Assembler::lzcntl(Register dst, Register src) {
1525 assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR"); 1505 assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR");
1526 emit_byte(0xF3); 1506 emit_byte(0xF3);