< prev index next >

src/cpu/x86/vm/stubGenerator_x86_64.cpp

Print this page

        

@@ -2970,39 +2970,10 @@
 
     StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit    = StubRoutines::_oop_disjoint_arraycopy_uninit;
     StubRoutines::_arrayof_oop_arraycopy_uninit             = StubRoutines::_oop_arraycopy_uninit;
   }
 
-  void generate_math_stubs() {
-    {
-      StubCodeMark mark(this, "StubRoutines", "log10");
-      StubRoutines::_intrinsic_log10 = (double (*)(double)) __ pc();
-
-      __ subq(rsp, 8);
-      __ movdbl(Address(rsp, 0), xmm0);
-      __ fld_d(Address(rsp, 0));
-      __ flog10();
-      __ fstp_d(Address(rsp, 0));
-      __ movdbl(xmm0, Address(rsp, 0));
-      __ addq(rsp, 8);
-      __ ret(0);
-    }
-    {
-      StubCodeMark mark(this, "StubRoutines", "tan");
-      StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc();
-
-      __ subq(rsp, 8);
-      __ movdbl(Address(rsp, 0), xmm0);
-      __ fld_d(Address(rsp, 0));
-      __ trigfunc('t');
-      __ fstp_d(Address(rsp, 0));
-      __ movdbl(xmm0, Address(rsp, 0));
-      __ addq(rsp, 8);
-      __ ret(0);
-    }
-  }
-
   // AES intrinsic stubs
   enum {AESBlockSize = 16};
 
   address generate_key_shuffle_mask() {
     __ align(16);

@@ -4743,10 +4714,50 @@
 
     return start;
 
   }
 
+  address generate_libmLog10() {
+    address start = __ pc();
+
+    const XMMRegister x0 = xmm0;
+    const XMMRegister x1 = xmm1;
+    const XMMRegister x2 = xmm2;
+    const XMMRegister x3 = xmm3;
+
+    const XMMRegister x4 = xmm4;
+    const XMMRegister x5 = xmm5;
+    const XMMRegister x6 = xmm6;
+    const XMMRegister x7 = xmm7;
+
+    const Register tmp = r11;
+
+    BLOCK_COMMENT("Entry:");
+    __ enter(); // required for proper stackwalking of RuntimeStub frame
+
+#ifdef _WIN64
+    // save the xmm registers which must be preserved 6-7
+    __ subptr(rsp, 4 * wordSize);
+    __ movdqu(Address(rsp, 0), xmm6);
+    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
+#endif
+    __ fast_log10(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp);
+
+#ifdef _WIN64
+    // restore xmm regs belonging to calling function
+    __ movdqu(xmm6, Address(rsp, 0));
+    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
+    __ addptr(rsp, 4 * wordSize);
+#endif
+
+    __ leave(); // required for proper stackwalking of RuntimeStub frame
+    __ ret(0);
+
+    return start;
+
+  }
+
   address generate_libmPow() {
     address start = __ pc();
 
     const XMMRegister x0 = xmm0;
     const XMMRegister x1 = xmm1;

@@ -4808,10 +4819,12 @@
 
     BLOCK_COMMENT("Entry:");
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
 #ifdef _WIN64
+    __ push(rsi);
+    __ push(rdi);
     // save the xmm registers which must be preserved 6-7
     __ subptr(rsp, 4 * wordSize);
     __ movdqu(Address(rsp, 0), xmm6);
     __ movdqu(Address(rsp, 2 * wordSize), xmm7);
 #endif

@@ -4820,10 +4833,12 @@
 #ifdef _WIN64
     // restore xmm regs belonging to calling function
     __ movdqu(xmm6, Address(rsp, 0));
     __ movdqu(xmm7, Address(rsp, 2 * wordSize));
     __ addptr(rsp, 4 * wordSize);
+    __ pop(rdi);
+    __ pop(rsi);
 #endif
 
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 

@@ -4851,10 +4866,12 @@
 
     BLOCK_COMMENT("Entry:");
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
 #ifdef _WIN64
+    __ push(rsi);
+    __ push(rdi);
     // save the xmm registers which must be preserved 6-7
     __ subptr(rsp, 4 * wordSize);
     __ movdqu(Address(rsp, 0), xmm6);
     __ movdqu(Address(rsp, 2 * wordSize), xmm7);
 #endif

@@ -4863,10 +4880,59 @@
 #ifdef _WIN64
     // restore xmm regs belonging to calling function
     __ movdqu(xmm6, Address(rsp, 0));
     __ movdqu(xmm7, Address(rsp, 2 * wordSize));
     __ addptr(rsp, 4 * wordSize);
+    __ pop(rdi);
+    __ pop(rsi);
+#endif
+
+    __ leave(); // required for proper stackwalking of RuntimeStub frame
+    __ ret(0);
+
+    return start;
+
+  }
+
+  address generate_libmTan() {
+    address start = __ pc();
+
+    const XMMRegister x0 = xmm0;
+    const XMMRegister x1 = xmm1;
+    const XMMRegister x2 = xmm2;
+    const XMMRegister x3 = xmm3;
+
+    const XMMRegister x4 = xmm4;
+    const XMMRegister x5 = xmm5;
+    const XMMRegister x6 = xmm6;
+    const XMMRegister x7 = xmm7;
+
+    const Register tmp1 = r8;
+    const Register tmp2 = r9;
+    const Register tmp3 = r10;
+    const Register tmp4 = r11;
+
+    BLOCK_COMMENT("Entry:");
+    __ enter(); // required for proper stackwalking of RuntimeStub frame
+
+#ifdef _WIN64
+    __ push(rsi);
+    __ push(rdi);
+    // save the xmm registers which must be preserved 6-7
+    __ subptr(rsp, 4 * wordSize);
+    __ movdqu(Address(rsp, 0), xmm6);
+    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
+#endif
+    __ fast_tan(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2, tmp3, tmp4);
+
+#ifdef _WIN64
+    // restore xmm regs belonging to calling function
+    __ movdqu(xmm6, Address(rsp, 0));
+    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
+    __ addptr(rsp, 4 * wordSize);
+    __ pop(rdi);
+    __ pop(rsi);
 #endif
 
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 

@@ -5063,22 +5129,34 @@
       bool supports_clmul = VM_Version::supports_clmul();
       StubRoutines::x86::generate_CRC32C_table(supports_clmul);
       StubRoutines::_crc32c_table_addr = (address)StubRoutines::x86::_crc32c_table;
       StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(supports_clmul);
     }
-    if (VM_Version::supports_sse2()) {
+    if (VM_Version::supports_sse2() && UseLibmIntrinsic) {
+      StubRoutines::x86::_ONEHALF_adr = (address)StubRoutines::x86::_ONEHALF;
+      StubRoutines::x86::_P_2_adr = (address)StubRoutines::x86::_P_2;
+      StubRoutines::x86::_SC_4_adr = (address)StubRoutines::x86::_SC_4;
+      StubRoutines::x86::_Ctable_adr = (address)StubRoutines::x86::_Ctable;
+      StubRoutines::x86::_SC_2_adr = (address)StubRoutines::x86::_SC_2;
+      StubRoutines::x86::_SC_3_adr = (address)StubRoutines::x86::_SC_3;
+      StubRoutines::x86::_SC_1_adr = (address)StubRoutines::x86::_SC_1;
+      StubRoutines::x86::_PI_INV_TABLE_adr = (address)StubRoutines::x86::_PI_INV_TABLE;
+      StubRoutines::x86::_PI_4_adr = (address)StubRoutines::x86::_PI_4;
+      StubRoutines::x86::_PI32INV_adr = (address)StubRoutines::x86::_PI32INV;
+      StubRoutines::x86::_SIGN_MASK_adr = (address)StubRoutines::x86::_SIGN_MASK;
+      StubRoutines::x86::_P_1_adr = (address)StubRoutines::x86::_P_1;
+      StubRoutines::x86::_P_3_adr = (address)StubRoutines::x86::_P_3;
+      StubRoutines::x86::_NEG_ZERO_adr = (address)StubRoutines::x86::_NEG_ZERO;
       StubRoutines::_dexp = generate_libmExp();
       StubRoutines::_dlog = generate_libmLog();
+      StubRoutines::_dlog10 = generate_libmLog10();
       StubRoutines::_dpow = generate_libmPow();
-      if (UseLibmSinIntrinsic) {
+      StubRoutines::_dtan = generate_libmTan();
         StubRoutines::_dsin = generate_libmSin();
-      }
-      if (UseLibmCosIntrinsic) {
         StubRoutines::_dcos = generate_libmCos();
       }
     }
-  }
 
   void generate_all() {
     // Generates all stubs and initializes the entry points
 
     // These entry points require SharedInfo::stack0 to be set up in

@@ -5117,12 +5195,10 @@
     StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
 
     // arraycopy stubs used by compilers
     generate_arraycopy_stubs();
 
-    generate_math_stubs();
-
     // don't bother generating these AES intrinsic stubs unless global flag is set
     if (UseAESIntrinsics) {
       StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask();  // needed by the others
       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
       StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
< prev index next >