diff src/cpu/x86/vm/templateTable_x86_32.cpp @ 2415:09f96c3ff1ad

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
author twisti
date Thu, 31 Mar 2011 00:27:08 -0700
parents 8033953d67ff
children 38fea01eb669
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Wed Mar 30 18:55:04 2011 -0700
+++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Mar 31 00:27:08 2011 -0700
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "asm/assembler.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "interpreter/templateTable.hpp"
@@ -1939,18 +1940,10 @@
     __ movl(temp, Address(array, h, Address::times_8, 0*wordSize));
     __ bswapl(temp);
     __ cmpl(key, temp);
-    if (VM_Version::supports_cmov()) {
-      __ cmovl(Assembler::less        , j, h);   // j = h if (key <  array[h].fast_match())
-      __ cmovl(Assembler::greaterEqual, i, h);   // i = h if (key >= array[h].fast_match())
-    } else {
-      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);                          // }
-    }
+    // j = h if (key <  array[h].fast_match())
+    __ cmov32(Assembler::less        , j, h);
+    // i = h if (key >= array[h].fast_match())
+    __ cmov32(Assembler::greaterEqual, i, h);
     // while (i+1 < j)
     __ bind(entry);
     __ leal(h, Address(i, 1));                   // i+1
@@ -3478,22 +3471,14 @@
 
   // find a free slot in the monitor block (result in rdx)
   { Label entry, loop, exit;
-    __ 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
+    __ 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
     __ jmpb(entry);
 
     __ bind(loop);
     __ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD);  // check if current entry is used
-
-// 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);
-    }
+    __ cmovptr(Assembler::equal, rdx, rcx);      // if not used then remember entry in rdx
     __ 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
     __ addptr(rcx, entry_size);                  // otherwise advance to next entry