United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6849984 Value methods for platform dependent math functions constant fold incorrectly
JDK-6849984 : Value methods for platform dependent math functions constant fold incorrectly

Details
Type:
Bug
Submit Date:
2009-06-10
Status:
Resolved
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2010-01-28
Component:
hotspot
OS:
solaris_9
Sub-Component:
compiler
CPU:
sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs16
Fixed Versions:
hs17 (b08)

Related Reports
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
This is actually a long standing issue but has only recently come to light.  C2 uses platform dependent Nodes to take advantage of hardware instructions for trig and log functions.  All of these nodes have Value methods which will constant fold a constant input.  The problem is that the SharedRuntime version of the functions are the strict ones but the platform dependent ones aren't strict so this can lead to different values being returned.  The fix is to stop constant folding these operations.

                                    

Comments
EVALUATION

Alternatively we could have callable versions of the platform dependent ones but that seems like overkill for such a small benefit.
                                     
2009-06-10
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/ddb7834449d0
                                     
2010-01-15
EVALUATION

This is actually a long standing issue but has only recently come to
light.  C2 uses platform dependent Nodes to take advantage of hardware
instructions for trig and log functions.  All of these nodes have
Value methods which will constant fold a constant input.  The problem
is that the SharedRuntime version of the functions are the strict ones
but the platform dependent ones aren't necessary strict so this can
lead to different values being returned.  The fix is to provide
implementations of these functions that can be used for constant
folding.  Additionally this exposed a problem with Xcomp and
interpreter intrinsics where the interpreter will prefer a compiled
version of a method to the interpreter intrinsic so we have to avoid
compiling them.  Tested with new test case and the Math and StrictMath
regression test from the JDK.  C1 doesn't constant fold these
operations so no changes were needed there.
                                     
2010-01-19



Hardware and Software, Engineered to Work Together