hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp
changeset 38018 1dc6c6f21231
parent 35495 e27da438fa13
child 38699 f8bec5f6b09c
equal deleted inserted replaced
38017:55047d16f141 38018:1dc6c6f21231
   343   //
   343   //
   344 
   344 
   345   __ fld_d(Address(rsp, 1*wordSize));
   345   __ fld_d(Address(rsp, 1*wordSize));
   346   switch (kind) {
   346   switch (kind) {
   347     case Interpreter::java_lang_math_sin :
   347     case Interpreter::java_lang_math_sin :
   348         __ trigfunc('s');
   348         __ subptr(rsp, 2 * wordSize);
       
   349         __ fstp_d(Address(rsp, 0));
       
   350         if (VM_Version::supports_sse2() && StubRoutines::dsin() != NULL) {
       
   351           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin())));
       
   352         } else {
       
   353           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dsin)));
       
   354         }
       
   355         __ addptr(rsp, 2 * wordSize);
   349         break;
   356         break;
   350     case Interpreter::java_lang_math_cos :
   357     case Interpreter::java_lang_math_cos :
   351         __ trigfunc('c');
   358         __ subptr(rsp, 2 * wordSize);
       
   359         __ fstp_d(Address(rsp, 0));
       
   360         if (VM_Version::supports_sse2() && StubRoutines::dcos() != NULL) {
       
   361           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos())));
       
   362         } else {
       
   363           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dcos)));
       
   364         }
       
   365         __ addptr(rsp, 2 * wordSize);
   352         break;
   366         break;
   353     case Interpreter::java_lang_math_tan :
   367     case Interpreter::java_lang_math_tan :
   354         __ trigfunc('t');
   368         __ subptr(rsp, 2 * wordSize);
       
   369         __ fstp_d(Address(rsp, 0));
       
   370         if (StubRoutines::dtan() != NULL) {
       
   371           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtan())));
       
   372         } else {
       
   373           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtan)));
       
   374         }
       
   375         __ addptr(rsp, 2 * wordSize);
   355         break;
   376         break;
   356     case Interpreter::java_lang_math_sqrt:
   377     case Interpreter::java_lang_math_sqrt:
   357         __ fsqrt();
   378         __ fsqrt();
   358         break;
   379         break;
   359     case Interpreter::java_lang_math_abs:
   380     case Interpreter::java_lang_math_abs:
   360         __ fabs();
   381         __ fabs();
   361         break;
   382         break;
   362     case Interpreter::java_lang_math_log:
   383     case Interpreter::java_lang_math_log:
   363         __ subptr(rsp, 2 * wordSize);
   384         __ subptr(rsp, 2 * wordSize);
   364         __ fstp_d(Address(rsp, 0));
   385         __ fstp_d(Address(rsp, 0));
   365         if (VM_Version::supports_sse2()) {
   386         if (StubRoutines::dlog() != NULL) {
   366           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog())));
   387           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog())));
   367         }
   388         } else {
   368         else {
       
   369           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog)));
   389           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog)));
   370         }
   390         }
   371         __ addptr(rsp, 2 * wordSize);
   391         __ addptr(rsp, 2 * wordSize);
   372         break;
   392         break;
   373     case Interpreter::java_lang_math_log10:
   393     case Interpreter::java_lang_math_log10:
   374         __ flog10();
   394         __ subptr(rsp, 2 * wordSize);
   375         // Store to stack to convert 80bit precision back to 64bits
   395         __ fstp_d(Address(rsp, 0));
   376         __ push_fTOS();
   396         if (StubRoutines::dlog10() != NULL) {
   377         __ pop_fTOS();
   397           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog10())));
       
   398         } else {
       
   399           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10)));
       
   400         }
       
   401         __ addptr(rsp, 2 * wordSize);
   378         break;
   402         break;
   379     case Interpreter::java_lang_math_pow:
   403     case Interpreter::java_lang_math_pow:
   380       __ fld_d(Address(rsp, 3*wordSize)); // second argument
   404       __ fld_d(Address(rsp, 3*wordSize)); // second argument
   381       __ subptr(rsp, 4 * wordSize);
   405       __ subptr(rsp, 4 * wordSize);
   382       __ fstp_d(Address(rsp, 0));
   406       __ fstp_d(Address(rsp, 0));
   383       __ fstp_d(Address(rsp, 2 * wordSize));
   407       __ fstp_d(Address(rsp, 2 * wordSize));
   384       if (VM_Version::supports_sse2()) {
   408       if (StubRoutines::dpow() != NULL) {
   385         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow())));
   409         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow())));
   386       } else {
   410       } else {
   387         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dpow)));
   411         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dpow)));
   388       }
   412       }
   389       __ addptr(rsp, 4 * wordSize);
   413       __ addptr(rsp, 4 * wordSize);
   390       break;
   414       break;
   391     case Interpreter::java_lang_math_exp:
   415     case Interpreter::java_lang_math_exp:
   392       __ subptr(rsp, 2*wordSize);
   416       __ subptr(rsp, 2*wordSize);
   393       __ fstp_d(Address(rsp, 0));
   417       __ fstp_d(Address(rsp, 0));
   394       if (VM_Version::supports_sse2()) {
   418       if (StubRoutines::dexp() != NULL) {
   395         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp())));
   419         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp())));
   396       } else {
   420       } else {
   397         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dexp)));
   421         __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dexp)));
   398       }
   422       }
   399       __ addptr(rsp, 2*wordSize);
   423       __ addptr(rsp, 2*wordSize);