changeset 5692:41149ce1422f

Add div test, group loop options in GraalOptions
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 25 Jun 2012 16:26:38 +0200
parents 1d3df3a16940
children 0356d95f01ba
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv3.java
diffstat 2 files changed, 58 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java	Mon Jun 25 12:18:55 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java	Mon Jun 25 16:26:38 2012 +0200
@@ -100,7 +100,10 @@
     public static float   MinimumUsageProbability            = 0.95f;
 
     //loop transform settings
-    public static float   MinimumPeelProbability             = 0.25f;
+    public static float   MinimumPeelProbability             = 0.35f;
+    public static boolean ReassociateInvariants              = true;
+    public static boolean FullUnroll                         = true;
+    public static int     FullUnrollMaxNodes                 = 150; // TODO (gd) tune
 
     // debugging settings
     public static int     MethodEndBreakpointGuards          = 0;
@@ -208,11 +211,6 @@
     public static boolean OptLoopTransform                   = true;
     public static boolean OptSafepointElimination            = true;
 
-    // Loops
-    public static boolean ReassociateInvariants              = true;
-    public static boolean FullUnroll                         = true;
-    public static int FullUnrollMaxNodes                     = 250; // TODO (gd) tune
-
     /**
      * Insert a counter in the method prologue to track the most frequently called methods that were compiled by Graal.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv3.java	Mon Jun 25 16:26:38 2012 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.jtt.bytecode;
+
+import org.junit.*;
+
+/*
+ */
+public class BC_ldiv3 {
+    public static long PLUS7 = 7;
+    public static long PLUS3 = 3;
+    public static long MIN7 = -7;
+    public static long MIN3 = -3;
+
+    public static long test(long a, long b) {
+        return a / b;
+    }
+
+    @Test
+    public void run0() throws Throwable {
+        Assert.assertEquals(3, test(PLUS7, 2));
+        Assert.assertEquals(1, test(PLUS3, 2));
+        Assert.assertEquals(-3, test(MIN7, 2));
+        Assert.assertEquals(-1, test(MIN3, 2));
+    }
+
+    @Test
+    public void run1() throws Throwable {
+        Assert.assertEquals(-1, test(PLUS7, -4));
+        Assert.assertEquals(0, test(PLUS3, -4));
+        Assert.assertEquals(1, test(MIN7, -4));
+        Assert.assertEquals(0, test(MIN3, -4));
+    }
+}