# HG changeset patch # User Doug Simon # Date 1431340846 -7200 # Node ID 7740cda9380c1e30b67afe678a3567622dd05cc5 # Parent 23f9cba1f250333e199e08d7eeb5c867830485dd add test for corner case when intrinsifying Math.sin diff -r 23f9cba1f250 -r 7740cda9380c graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Math_sin.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Math_sin.java Mon May 11 12:23:13 2015 +0200 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Math_sin.java Mon May 11 12:40:46 2015 +0200 @@ -44,6 +44,21 @@ } @Test + public void runFirst() throws Throwable { + /* + * Execute Double.isNaN enough times to create a profile indicating that the path returning + * false is never taken. Then compile and execute the test with a NaN value to test that + * deoptimization works in the case of an uncommon trap inlined into an intrinsic. Of + * course, this relies on Double.isNaN never having yet been called with NaN. if it has, + * this test is equivalent to run0. + */ + for (int i = 0; i < 10000; i++) { + Double.isNaN(1D); + } + executeActual(getResolvedJavaMethod("test"), null, java.lang.Double.NaN); + } + + @Test public void run0() throws Throwable { runTest("test", java.lang.Double.NaN); }