提交 fc86975c 编写于 作者: T twisti

7032388: guarantee(VM_Version::supports_cmov()) failed: illegal instruction on i586 after 6919934

Summary: 6919934 added some unguarded cmov instructions which hit a guarantee on older hardware.
Reviewed-by: never, iveresov, kvn, phh
上级 fd5c8d90
...@@ -7769,6 +7769,28 @@ void MacroAssembler::xorps(XMMRegister dst, AddressLiteral src) { ...@@ -7769,6 +7769,28 @@ void MacroAssembler::xorps(XMMRegister dst, AddressLiteral src) {
} }
} }
void MacroAssembler::cmov32(Condition cc, Register dst, Address src) {
if (VM_Version::supports_cmov()) {
cmovl(cc, dst, src);
} else {
Label L;
jccb(negate_condition(cc), L);
movl(dst, src);
bind(L);
}
}
void MacroAssembler::cmov32(Condition cc, Register dst, Register src) {
if (VM_Version::supports_cmov()) {
cmovl(cc, dst, src);
} else {
Label L;
jccb(negate_condition(cc), L);
movl(dst, src);
bind(L);
}
}
void MacroAssembler::verify_oop(Register reg, const char* s) { void MacroAssembler::verify_oop(Register reg, const char* s) {
if (!VerifyOops) return; if (!VerifyOops) return;
...@@ -9019,14 +9041,7 @@ void MacroAssembler::string_compare(Register str1, Register str2, ...@@ -9019,14 +9041,7 @@ void MacroAssembler::string_compare(Register str1, Register str2,
movl(result, cnt1); movl(result, cnt1);
subl(cnt1, cnt2); subl(cnt1, cnt2);
push(cnt1); push(cnt1);
if (VM_Version::supports_cmov()) { cmov32(Assembler::lessEqual, cnt2, result);
cmovl(Assembler::lessEqual, cnt2, result);
} else {
Label GT_LABEL;
jccb(Assembler::greater, GT_LABEL);
movl(cnt2, result);
bind(GT_LABEL);
}
// Is the minimum length zero? // Is the minimum length zero?
testl(cnt2, cnt2); testl(cnt2, cnt2);
......
...@@ -2244,10 +2244,13 @@ public: ...@@ -2244,10 +2244,13 @@ public:
// Data // Data
void cmov(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); } void cmov32( Condition cc, Register dst, Address src);
void cmov32( Condition cc, Register dst, Register src);
void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); } void cmov( Condition cc, Register dst, Register src) { cmovptr(cc, dst, src); }
void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); }
void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); }
void movoop(Register dst, jobject obj); void movoop(Register dst, jobject obj);
void movoop(Address dst, jobject obj); void movoop(Address dst, jobject obj);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "c1/c1_Compilation.hpp" #include "c1/c1_Compilation.hpp"
#include "c1/c1_LIRAssembler.hpp" #include "c1/c1_LIRAssembler.hpp"
#include "c1/c1_MacroAssembler.hpp" #include "c1/c1_MacroAssembler.hpp"
...@@ -569,24 +570,13 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst, ...@@ -569,24 +570,13 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst,
__ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
// compute minimum length (in rax) and difference of lengths (on top of stack) // compute minimum length (in rax) and difference of lengths (on top of stack)
if (VM_Version::supports_cmov()) { __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
__ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes()));
__ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); __ mov (rcx, rbx);
__ mov (rcx, rbx); __ subptr(rbx, rax); // subtract lengths
__ subptr (rbx, rax); // subtract lengths __ push (rbx); // result
__ push (rbx); // result __ cmov (Assembler::lessEqual, rax, rcx);
__ cmov (Assembler::lessEqual, rax, rcx);
} else {
Label L;
__ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
__ movl (rcx, Address(rax, java_lang_String::count_offset_in_bytes()));
__ mov (rax, rbx);
__ subptr (rbx, rcx);
__ push (rbx);
__ jcc (Assembler::lessEqual, L);
__ mov (rax, rcx);
__ bind (L);
}
// is minimum length 0? // is minimum length 0?
Label noLoop, haveResult; Label noLoop, haveResult;
__ testptr (rax, rax); __ testptr (rax, rax);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "c1/c1_Defs.hpp" #include "c1/c1_Defs.hpp"
#include "c1/c1_MacroAssembler.hpp" #include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_Runtime1.hpp" #include "c1/c1_Runtime1.hpp"
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "interpreter/interpreter.hpp" #include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp" #include "interpreter/interpreterRuntime.hpp"
#include "interpreter/templateTable.hpp" #include "interpreter/templateTable.hpp"
...@@ -1939,18 +1940,10 @@ void TemplateTable::fast_binaryswitch() { ...@@ -1939,18 +1940,10 @@ void TemplateTable::fast_binaryswitch() {
__ movl(temp, Address(array, h, Address::times_8, 0*wordSize)); __ movl(temp, Address(array, h, Address::times_8, 0*wordSize));
__ bswapl(temp); __ bswapl(temp);
__ cmpl(key, temp); __ cmpl(key, temp);
if (VM_Version::supports_cmov()) { // j = h if (key < array[h].fast_match())
__ cmovl(Assembler::less , j, h); // j = h if (key < array[h].fast_match()) __ cmov32(Assembler::less , j, h);
__ cmovl(Assembler::greaterEqual, i, h); // i = h if (key >= array[h].fast_match()) // i = h if (key >= array[h].fast_match())
} else { __ cmov32(Assembler::greaterEqual, i, h);
Label set_i, end_of_if;
__ jccb(Assembler::greaterEqual, set_i); // {
__ mov(j, h); // j = h;
__ jmp(end_of_if); // }
__ bind(set_i); // else {
__ mov(i, h); // i = h;
__ bind(end_of_if); // }
}
// while (i+1 < j) // while (i+1 < j)
__ bind(entry); __ bind(entry);
__ leal(h, Address(i, 1)); // i+1 __ leal(h, Address(i, 1)); // i+1
...@@ -3478,22 +3471,14 @@ void TemplateTable::monitorenter() { ...@@ -3478,22 +3471,14 @@ void TemplateTable::monitorenter() {
// find a free slot in the monitor block (result in rdx) // find a free slot in the monitor block (result in rdx)
{ Label entry, loop, exit; { Label entry, loop, exit;
__ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry
__ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block
__ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block
__ jmpb(entry); __ jmpb(entry);
__ bind(loop); __ bind(loop);
__ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used __ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used
__ cmovptr(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx
// TODO - need new func here - kbt
if (VM_Version::supports_cmov()) {
__ cmov(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx
} else {
Label L;
__ jccb(Assembler::notEqual, L);
__ mov(rdx, rcx); // if not used then remember entry in rdx
__ bind(L);
}
__ cmpptr(rax, Address(rcx, BasicObjectLock::obj_offset_in_bytes())); // check if current entry is for same object __ cmpptr(rax, Address(rcx, BasicObjectLock::obj_offset_in_bytes())); // check if current entry is for same object
__ jccb(Assembler::equal, exit); // if same object then stop searching __ jccb(Assembler::equal, exit); // if same object then stop searching
__ addptr(rcx, entry_size); // otherwise advance to next entry __ addptr(rcx, entry_size); // otherwise advance to next entry
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册