JDK 9 RFR of 4477961: java.lang.Math.toDegrees(double) could be optimized

Mike Duigou mike.duigou at oracle.com
Mon Sep 22 23:24:30 UTC 2014


Looks fine to me!

Mike

On Sep 22 2014, at 15:34 , Brian Burkhalter <brian.burkhalter at oracle.com> wrote:

> Hi Aleksey,
> 
> On Sep 22, 2014, at 2:43 PM, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
> 
>> Hm, and this compiler transformation works in strictfp context? I hope
>> compilers do the constant folding in strictfp/fdlibm mode…
> 
> Yes.
> 
>> I would probably just go and declare the private compile-time constants.
>> This is safer, since: a) you are not at the mercy of optimizing compiler
>> anymore (have you tried the benchmark with C1?); b) the initializing
>> expressions are FP-strict, less opportunity for hard to diagnose numeric
>> problem.
> 
> I created an alternate webrev using compile-time constants per your suggestion:
> 
> http://cr.openjdk.java.net/~bpb/4477961/webrev.01/
> 
> The performance improvement is similar to that cited for webrev.00.
> 
> If this version is preferable it will need approval from a JDK 9 Reviewer, of course.
> 
> Thanks,
> 
> Brian




More information about the core-libs-dev mailing list