changeset 21284:7740cda9380c

add test for corner case when intrinsifying Math.sin
author Doug Simon <doug.simon@oracle.com>
date Mon, 11 May 2015 12:40:46 +0200
parents 23f9cba1f250
children 61c8fbd13cfc
files graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Math_sin.java
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }