src/cpu/x86/vm/stubGenerator_x86_64.cpp

Print this page
rev 3227 : 7133857: exp() and pow() should use the x87 ISA on x86
Summary: use x87 instructions to implement exp() and pow() in interpreter/c1/c2.
Reviewed-by:


2911       __ fld_d(Address(rsp, 0));
2912       __ trigfunc('c');
2913       __ fstp_d(Address(rsp, 0));
2914       __ movdbl(xmm0, Address(rsp, 0));
2915       __ addq(rsp, 8);
2916       __ ret(0);
2917     }
2918     {
2919       StubCodeMark mark(this, "StubRoutines", "tan");
2920       StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc();
2921 
2922       __ subq(rsp, 8);
2923       __ movdbl(Address(rsp, 0), xmm0);
2924       __ fld_d(Address(rsp, 0));
2925       __ trigfunc('t');
2926       __ fstp_d(Address(rsp, 0));
2927       __ movdbl(xmm0, Address(rsp, 0));
2928       __ addq(rsp, 8);
2929       __ ret(0);
2930     }



2931 
2932     // The intrinsic version of these seem to return the same value as
2933     // the strict version.
2934     StubRoutines::_intrinsic_exp = SharedRuntime::dexp;
2935     StubRoutines::_intrinsic_pow = SharedRuntime::dpow;




















2936   }
2937 
2938 #undef __
2939 #define __ masm->
2940 
2941   // Continuation point for throwing of implicit exceptions that are
2942   // not handled in the current activation. Fabricates an exception
2943   // oop and initiates normal exception dispatching in this
2944   // frame. Since we need to preserve callee-saved values (currently
2945   // only for C2, but done for C1 as well) we need a callee-saved oop
2946   // map and therefore have to make these stubs into RuntimeStubs
2947   // rather than BufferBlobs.  If the compiler needs all registers to
2948   // be preserved between the fault point and the exception handler
2949   // then it must assume responsibility for that in
2950   // AbstractCompiler::continuation_for_implicit_null_exception or
2951   // continuation_for_implicit_division_by_zero_exception. All other
2952   // implicit exceptions (e.g., NullPointerException or
2953   // AbstractMethodError on entry) are either at call sites or
2954   // otherwise assume that stack unwinding will be initiated, so
2955   // caller saved registers were assumed volatile in the compiler.




2911       __ fld_d(Address(rsp, 0));
2912       __ trigfunc('c');
2913       __ fstp_d(Address(rsp, 0));
2914       __ movdbl(xmm0, Address(rsp, 0));
2915       __ addq(rsp, 8);
2916       __ ret(0);
2917     }
2918     {
2919       StubCodeMark mark(this, "StubRoutines", "tan");
2920       StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc();
2921 
2922       __ subq(rsp, 8);
2923       __ movdbl(Address(rsp, 0), xmm0);
2924       __ fld_d(Address(rsp, 0));
2925       __ trigfunc('t');
2926       __ fstp_d(Address(rsp, 0));
2927       __ movdbl(xmm0, Address(rsp, 0));
2928       __ addq(rsp, 8);
2929       __ ret(0);
2930     }
2931     {
2932       StubCodeMark mark(this, "StubRoutines", "exp");
2933       StubRoutines::_intrinsic_exp = (double (*)(double)) __ pc();
2934 
2935       __ subq(rsp, 8);
2936       __ movdbl(Address(rsp, 0), xmm0);
2937       __ fld_d(Address(rsp, 0));
2938       __ pow_or_exp(true, 0);
2939       __ fstp_d(Address(rsp, 0));
2940       __ movdbl(xmm0, Address(rsp, 0));
2941       __ addq(rsp, 8);
2942       __ ret(0);
2943     }
2944     {
2945       StubCodeMark mark(this, "StubRoutines", "pow");
2946       StubRoutines::_intrinsic_pow = (double (*)(double,double)) __ pc();
2947 
2948       __ subq(rsp, 8);
2949       __ movdbl(Address(rsp, 0), xmm1);
2950       __ fld_d(Address(rsp, 0));
2951       __ movdbl(Address(rsp, 0), xmm0);
2952       __ fld_d(Address(rsp, 0));
2953       __ pow_or_exp(false, 0);
2954       __ fstp_d(Address(rsp, 0));
2955       __ movdbl(xmm0, Address(rsp, 0));
2956       __ addq(rsp, 8);
2957       __ ret(0);
2958     }
2959   }
2960 
2961 #undef __
2962 #define __ masm->
2963 
2964   // Continuation point for throwing of implicit exceptions that are
2965   // not handled in the current activation. Fabricates an exception
2966   // oop and initiates normal exception dispatching in this
2967   // frame. Since we need to preserve callee-saved values (currently
2968   // only for C2, but done for C1 as well) we need a callee-saved oop
2969   // map and therefore have to make these stubs into RuntimeStubs
2970   // rather than BufferBlobs.  If the compiler needs all registers to
2971   // be preserved between the fault point and the exception handler
2972   // then it must assume responsibility for that in
2973   // AbstractCompiler::continuation_for_implicit_null_exception or
2974   // continuation_for_implicit_division_by_zero_exception. All other
2975   // implicit exceptions (e.g., NullPointerException or
2976   // AbstractMethodError on entry) are either at call sites or
2977   // otherwise assume that stack unwinding will be initiated, so
2978   // caller saved registers were assumed volatile in the compiler.