< prev index next >

src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp

Print this page




 324 
 325   if (!InlineIntrinsics) return NULL; // Generate a vanilla entry
 326 
 327   address entry_point = __ pc();
 328 
 329   // These don't need a safepoint check because they aren't virtually
 330   // callable. We won't enter these intrinsics from compiled code.
 331   // If in the future we added an intrinsic which was virtually callable
 332   // we'd have to worry about how to safepoint so that this code is used.
 333 
 334   // mathematical functions inlined by compiler
 335   // (interpreter must provide identical implementation
 336   // in order to avoid monotonicity bugs when switching
 337   // from interpreter to compiler in the middle of some
 338   // computation)
 339   //
 340   // stack: [ ret adr ] <-- rsp
 341   //        [ lo(arg) ]
 342   //        [ hi(arg) ]
 343   //





















 344 
 345   __ fld_d(Address(rsp, 1*wordSize));
 346   switch (kind) {
 347     case Interpreter::java_lang_math_sin :
 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_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dsin));
 354         }
 355         __ addptr(rsp, 2 * wordSize);
 356         break;
 357     case Interpreter::java_lang_math_cos :
 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_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dcos));




 324 
 325   if (!InlineIntrinsics) return NULL; // Generate a vanilla entry
 326 
 327   address entry_point = __ pc();
 328 
 329   // These don't need a safepoint check because they aren't virtually
 330   // callable. We won't enter these intrinsics from compiled code.
 331   // If in the future we added an intrinsic which was virtually callable
 332   // we'd have to worry about how to safepoint so that this code is used.
 333 
 334   // mathematical functions inlined by compiler
 335   // (interpreter must provide identical implementation
 336   // in order to avoid monotonicity bugs when switching
 337   // from interpreter to compiler in the middle of some
 338   // computation)
 339   //
 340   // stack: [ ret adr ] <-- rsp
 341   //        [ lo(arg) ]
 342   //        [ hi(arg) ]
 343   //
 344   if (kind == Interpreter::java_lang_math_fmaD) {
 345     __ movdbl(xmm2, Address(rsp, 5 * wordSize));
 346     __ movdbl(xmm1, Address(rsp, 3 * wordSize));
 347     __ movdbl(xmm0, Address(rsp, 1 * wordSize));
 348     __ vfmadd231sd(xmm0, xmm1, xmm2);
 349     __ pop(rdi);                               // get return address
 350     __ mov(rsp, rsi);                          // set sp to sender sp
 351     __ jmp(rdi);
 352 
 353     return entry_point;
 354   } else if (kind == Interpreter::java_lang_math_fmaF) {
 355     __ movdbl(xmm2, Address(rsp, 3 * wordSize));
 356     __ movdbl(xmm1, Address(rsp, 2 * wordSize));
 357     __ movdbl(xmm0, Address(rsp, 1 * wordSize));
 358     __ vfmadd231ss(xmm0, xmm1, xmm2);
 359     __ pop(rdi);                               // get return address
 360     __ mov(rsp, rsi);                          // set sp to sender sp
 361     __ jmp(rdi);
 362 
 363     return entry_point;
 364  }
 365 
 366   __ fld_d(Address(rsp, 1*wordSize));
 367   switch (kind) {
 368     case Interpreter::java_lang_math_sin :
 369         __ subptr(rsp, 2 * wordSize);
 370         __ fstp_d(Address(rsp, 0));
 371         if (VM_Version::supports_sse2() && StubRoutines::dsin() != NULL) {
 372           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin())));
 373         } else {
 374           __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dsin));
 375         }
 376         __ addptr(rsp, 2 * wordSize);
 377         break;
 378     case Interpreter::java_lang_math_cos :
 379         __ subptr(rsp, 2 * wordSize);
 380         __ fstp_d(Address(rsp, 0));
 381         if (VM_Version::supports_sse2() && StubRoutines::dcos() != NULL) {
 382           __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos())));
 383         } else {
 384           __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dcos));


< prev index next >