RFR(M): 7133857: exp() and pow() should use the x87 ISA on x86

Christian Thalinger christian.thalinger at oracle.com
Mon Apr 2 03:01:51 PDT 2012

On Apr 2, 2012, at 10:56 AM, Roland Westrelin wrote:

> Implements Math.exp() and Math.pow() using the x87 ISA. It is based on an existing implementation in C2 that was disabled because it was found to be broken. This change fixes some corner cases of the previous implementation and uses the same code in the interpreter, c1 and c2 so that consistent results are obtained from exp() and pow().
> http://cr.openjdk.java.net/~roland/7133857/webrev.00/

The changes look good.  I'd prefer to not call pow_or_exp directly with a boolean argument:

+  // computes pow(x,y) or exp(x). Fallback to runtime call included.
+  void pow_or_exp(bool is_exp, int num_fpu_regs_in_use);

It's not quite obvious which is which (I'd expected the argument to be is_pow).  Maybe something like:

void pow_with_fallback(...) { pow_or_exp(false, ...); }

-- Chris

> Roland.

More information about the hotspot-compiler-dev mailing list