changeset 1664:0a43776437b6

6942223: c1 64 bit fixes Summary: This fixes lir_cmp_l2i on x64 and sparc 64bit, and the debug info generation. Reviewed-by: never
author iveresov
date Thu, 08 Apr 2010 12:13:07 -0700
parents 93767e6a2dfd
children 213fbcf54799
files src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp src/cpu/x86/vm/assembler_x86.cpp src/cpu/x86/vm/c1_LIRAssembler_x86.cpp src/share/vm/c1/c1_LinearScan.cpp
diffstat 4 files changed, 59 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Thu Apr 08 10:55:40 2010 +0200
+++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Thu Apr 08 12:13:07 2010 -0700
@@ -1728,9 +1728,13 @@
       ShouldNotReachHere();
     }
   } else if (code == lir_cmp_l2i) {
+#ifdef _LP64
+    __ lcmp(left->as_register_lo(), right->as_register_lo(), dst->as_register());
+#else
     __ lcmp(left->as_register_hi(),  left->as_register_lo(),
             right->as_register_hi(), right->as_register_lo(),
             dst->as_register());
+#endif
   } else {
     ShouldNotReachHere();
   }
--- a/src/cpu/x86/vm/assembler_x86.cpp	Thu Apr 08 10:55:40 2010 +0200
+++ b/src/cpu/x86/vm/assembler_x86.cpp	Thu Apr 08 12:13:07 2010 -0700
@@ -3365,6 +3365,13 @@
 
 #else // LP64
 
+void Assembler::set_byte_if_not_zero(Register dst) {
+  int enc = prefix_and_encode(dst->encoding(), true);
+  emit_byte(0x0F);
+  emit_byte(0x95);
+  emit_byte(0xE0 | enc);
+}
+
 // 64bit only pieces of the assembler
 // This should only be used by 64bit instructions that can use rip-relative
 // it cannot be used by instructions that want an immediate value.
--- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Apr 08 10:55:40 2010 +0200
+++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Apr 08 12:13:07 2010 -0700
@@ -2690,19 +2690,14 @@
   } else {
     assert(code == lir_cmp_l2i, "check");
 #ifdef _LP64
-      Register dest = dst->as_register();
-      __ xorptr(dest, dest);
-      Label high, done;
-      __ cmpptr(left->as_register_lo(), right->as_register_lo());
-      __ jcc(Assembler::equal, done);
-      __ jcc(Assembler::greater, high);
-      __ decrement(dest);
-      __ jmp(done);
-      __ bind(high);
-      __ increment(dest);
-
-      __ bind(done);
-
+    Label done;
+    Register dest = dst->as_register();
+    __ cmpptr(left->as_register_lo(), right->as_register_lo());
+    __ movl(dest, -1);
+    __ jccb(Assembler::less, done);
+    __ set_byte_if_not_zero(dest);
+    __ movzbl(dest, dest);
+    __ bind(done);
 #else
     __ lcmp2int(left->as_register_hi(),
                 left->as_register_lo(),
--- a/src/share/vm/c1/c1_LinearScan.cpp	Thu Apr 08 10:55:40 2010 +0200
+++ b/src/share/vm/c1/c1_LinearScan.cpp	Thu Apr 08 12:13:07 2010 -0700
@@ -2608,6 +2608,46 @@
     } else if (opr->is_double_xmm()) {
       assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation");
       VMReg rname_first  = opr->as_xmm_double_reg()->as_VMReg();
+#  ifdef _LP64
+      first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
+      second = &_int_0_scope_value;
+#  else
+      first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
+      // %%% This is probably a waste but we'll keep things as they were for now
+      if (true) {
+        VMReg rname_second = rname_first->next();
+        second = new LocationValue(Location::new_reg_loc(Location::normal, rname_second));
+      }
+#  endif
+#endif
+
+    } else if (opr->is_double_fpu()) {
+      // On SPARC, fpu_regnrLo/fpu_regnrHi represents the two halves of
+      // the double as float registers in the native ordering. On X86,
+      // fpu_regnrLo is a FPU stack slot whose VMReg represents
+      // the low-order word of the double and fpu_regnrLo + 1 is the
+      // name for the other half.  *first and *second must represent the
+      // least and most significant words, respectively.
+
+#ifdef X86
+      // the exact location of fpu stack values is only known
+      // during fpu stack allocation, so the stack allocator object
+      // must be present
+      assert(use_fpu_stack_allocation(), "should not have float stack values without fpu stack allocation (all floats must be SSE2)");
+      assert(_fpu_stack_allocator != NULL, "must be present");
+      opr = _fpu_stack_allocator->to_fpu_stack(opr);
+
+      assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation (only fpu_regnrHi is used)");
+#endif
+#ifdef SPARC
+      assert(opr->fpu_regnrLo() == opr->fpu_regnrHi() + 1, "assumed in calculation (only fpu_regnrHi is used)");
+#endif
+
+      VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi());
+#ifdef _LP64
+      first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
+      second = &_int_0_scope_value;
+#else
       first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
       // %%% This is probably a waste but we'll keep things as they were for now
       if (true) {
@@ -2616,37 +2656,6 @@
       }
 #endif
 
-    } else if (opr->is_double_fpu()) {
-      // On SPARC, fpu_regnrLo/fpu_regnrHi represents the two halves of
-      // the double as float registers in the native ordering. On X86,
-      // fpu_regnrLo is a FPU stack slot whose VMReg represents
-      // the low-order word of the double and fpu_regnrLo + 1 is the
-      // name for the other half.  *first and *second must represent the
-      // least and most significant words, respectively.
-
-#ifdef X86
-      // the exact location of fpu stack values is only known
-      // during fpu stack allocation, so the stack allocator object
-      // must be present
-      assert(use_fpu_stack_allocation(), "should not have float stack values without fpu stack allocation (all floats must be SSE2)");
-      assert(_fpu_stack_allocator != NULL, "must be present");
-      opr = _fpu_stack_allocator->to_fpu_stack(opr);
-
-      assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation (only fpu_regnrHi is used)");
-#endif
-#ifdef SPARC
-      assert(opr->fpu_regnrLo() == opr->fpu_regnrHi() + 1, "assumed in calculation (only fpu_regnrHi is used)");
-#endif
-
-      VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi());
-
-      first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
-      // %%% This is probably a waste but we'll keep things as they were for now
-      if (true) {
-        VMReg rname_second = rname_first->next();
-        second = new LocationValue(Location::new_reg_loc(Location::normal, rname_second));
-      }
-
     } else {
       ShouldNotReachHere();
       first = NULL;