< prev index next >

src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp

Print this page




 360 
 361   // mathematical functions inlined by compiler
 362   // (interpreter must provide identical implementation
 363   // in order to avoid monotonicity bugs when switching
 364   // from interpreter to compiler in the middle of some
 365   // computation)
 366   //
 367   // stack: [ ret adr ] <-- rsp
 368   //        [ lo(arg) ]
 369   //        [ hi(arg) ]
 370   //
 371 
 372 
 373   if (kind == Interpreter::java_lang_math_sqrt) {
 374     __ sqrtsd(xmm0, Address(rsp, wordSize));
 375   } else if (kind == Interpreter::java_lang_math_exp) {
 376     __ movdbl(xmm0, Address(rsp, wordSize));
 377     if (StubRoutines::dexp() != NULL) {
 378       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp())));
 379     } else {
 380       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dexp)));
 381     }
 382   } else if (kind == Interpreter::java_lang_math_log) {
 383     __ movdbl(xmm0, Address(rsp, wordSize));
 384     if (StubRoutines::dlog() != NULL) {
 385       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog())));
 386     } else {
 387       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog)));
 388     }
 389   } else if (kind == Interpreter::java_lang_math_log10) {
 390     __ movdbl(xmm0, Address(rsp, wordSize));
 391     if (StubRoutines::dlog10() != NULL) {
 392       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog10())));
 393     } else {
 394       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10)));
 395     }
 396   } else if (kind == Interpreter::java_lang_math_sin) {
 397     __ movdbl(xmm0, Address(rsp, wordSize));
 398     if (StubRoutines::dsin() != NULL) {
 399       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin())));
 400     } else {
 401       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dsin)));
 402     }
 403   } else if (kind == Interpreter::java_lang_math_cos) {
 404     __ movdbl(xmm0, Address(rsp, wordSize));
 405     if (StubRoutines::dcos() != NULL) {
 406       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos())));
 407     } else {
 408       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dcos)));
 409     }
 410   } else if (kind == Interpreter::java_lang_math_pow) {
 411     __ movdbl(xmm1, Address(rsp, wordSize));
 412     __ movdbl(xmm0, Address(rsp, 3 * wordSize));
 413     if (StubRoutines::dpow() != NULL) {
 414       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow())));
 415     } else {
 416       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dpow)));

 417     }
 418   } else if (kind == Interpreter::java_lang_math_tan) {
 419     __ movdbl(xmm0, Address(rsp, wordSize));
 420     if (StubRoutines::dtan() != NULL) {
 421       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtan())));
 422     } else {
 423       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtan)));
 424     }
 425   } else {
 426     __ fld_d(Address(rsp, wordSize));
 427     switch (kind) {
 428       case Interpreter::java_lang_math_abs:
 429           __ fabs();
 430           break;
 431       default                              :
 432           ShouldNotReachHere();
 433     }
 434 
 435     // return double result in xmm0 for interpreter and compilers.
 436     __ subptr(rsp, 2*wordSize);
 437     // Round to 64bit precision
 438     __ fstp_d(Address(rsp, 0));
 439     __ movdbl(xmm0, Address(rsp, 0));
 440     __ addptr(rsp, 2*wordSize);
 441   }
 442 
 443 
 444   __ pop(rax);
 445   __ mov(rsp, r13);
 446   __ jmp(rax);
 447 
 448   return entry_point;
 449 }



 360 
 361   // mathematical functions inlined by compiler
 362   // (interpreter must provide identical implementation
 363   // in order to avoid monotonicity bugs when switching
 364   // from interpreter to compiler in the middle of some
 365   // computation)
 366   //
 367   // stack: [ ret adr ] <-- rsp
 368   //        [ lo(arg) ]
 369   //        [ hi(arg) ]
 370   //
 371 
 372 
 373   if (kind == Interpreter::java_lang_math_sqrt) {
 374     __ sqrtsd(xmm0, Address(rsp, wordSize));
 375   } else if (kind == Interpreter::java_lang_math_exp) {
 376     __ movdbl(xmm0, Address(rsp, wordSize));
 377     if (StubRoutines::dexp() != NULL) {
 378       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp())));
 379     } else {
 380       __ mathfunc(CAST_FROM_FN_PTR(address, SharedRuntime::dexp));
 381     }
 382   } else if (kind == Interpreter::java_lang_math_log) {
 383     __ movdbl(xmm0, Address(rsp, wordSize));
 384     if (StubRoutines::dlog() != NULL) {
 385       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog())));
 386     } else {
 387       __ mathfunc(CAST_FROM_FN_PTR(address, SharedRuntime::dlog));
 388     }
 389   } else if (kind == Interpreter::java_lang_math_log10) {
 390     __ movdbl(xmm0, Address(rsp, wordSize));
 391     if (StubRoutines::dlog10() != NULL) {
 392       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog10())));
 393     } else {
 394       __ mathfunc(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10));
 395     }
 396   } else if (kind == Interpreter::java_lang_math_sin) {
 397     __ movdbl(xmm0, Address(rsp, wordSize));
 398     if (StubRoutines::dsin() != NULL) {
 399       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin())));
 400     } else {
 401       __ mathfunc(CAST_FROM_FN_PTR(address, SharedRuntime::dsin));
 402     }
 403   } else if (kind == Interpreter::java_lang_math_cos) {
 404     __ movdbl(xmm0, Address(rsp, wordSize));
 405     if (StubRoutines::dcos() != NULL) {
 406       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos())));
 407     } else {
 408       __ mathfunc(CAST_FROM_FN_PTR(address, SharedRuntime::dcos));
 409     }
 410   } else if (kind == Interpreter::java_lang_math_pow) {
 411     __ movdbl(xmm1, Address(rsp, wordSize));
 412     __ movdbl(xmm0, Address(rsp, 3 * wordSize));
 413     if (StubRoutines::dpow() != NULL) {
 414       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow())));
 415     } else {
 416       __ mathfunc(CAST_FROM_FN_PTR(address, SharedRuntime::dpow));
 417       //__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dpow)));
 418     }
 419   } else if (kind == Interpreter::java_lang_math_tan) {
 420     __ movdbl(xmm0, Address(rsp, wordSize));
 421     if (StubRoutines::dtan() != NULL) {
 422       __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtan())));
 423     } else {
 424       __ mathfunc(CAST_FROM_FN_PTR(address, SharedRuntime::dtan));
 425     }
 426   } else {
 427     __ fld_d(Address(rsp, wordSize));
 428     switch (kind) {
 429     case Interpreter::java_lang_math_abs:
 430       __ fabs();
 431       break;
 432     default:
 433       ShouldNotReachHere();
 434     }
 435 
 436     // return double result in xmm0 for interpreter and compilers.
 437     __ subptr(rsp, 2*wordSize);
 438     // Round to 64bit precision
 439     __ fstp_d(Address(rsp, 0));
 440     __ movdbl(xmm0, Address(rsp, 0));
 441     __ addptr(rsp, 2*wordSize);
 442   }
 443 
 444 
 445   __ pop(rax);
 446   __ mov(rsp, r13);
 447   __ jmp(rax);
 448 
 449   return entry_point;
 450 }
 451 
< prev index next >