< prev index next >

test/compiler/loopopts/TestMoveStoresOutOfLoops.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 /**
  26  * @test
  27  * @bug 8080289
  28  * @summary Move stores out of loops if possible
  29  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestMoveStoresOutOfLoops::test*  TestMoveStoresOutOfLoops
  30  *



  31  */
  32 
  33 import java.lang.reflect.*;
  34 import java.util.*;
  35 import java.util.function.*;
  36 





  37 public class TestMoveStoresOutOfLoops {
  38 
  39     private static long[] array = new long[10];
  40     private static long[] array2 = new long[10];
  41     private static boolean[] array3 = new boolean[1000];
  42     private static byte[] byte_array = new byte[10];
  43 
  44     // Array store should be moved out of the loop, value stored
  45     // should be 999, the loop should be eliminated
  46     static void test_after_1(int idx) {
  47         for (int i = 0; i < 1000; i++) {
  48             array[idx] = i;
  49         }
  50     }
  51 
  52     // Array store can't be moved out of loop because of following
  53     // non loop invariant array access
  54     static void test_after_2(int idx) {
  55         for (int i = 0; i < 1000; i++) {
  56             array[idx] = i;




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 /**
  26  * @test
  27  * @bug 8080289
  28  * @summary Move stores out of loops if possible

  29  *
  30  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
  31  *      -XX:CompileCommand=dontinline,compiler.loopopts.TestMoveStoresOutOfLoops::test*
  32  *      compiler.loopopts.TestMoveStoresOutOfLoops
  33  */
  34 
  35 package compiler.loopopts;


  36 
  37 import java.lang.reflect.Method;
  38 import java.lang.reflect.Modifier;
  39 import java.util.HashMap;
  40 import java.util.function.Function;
  41 
  42 public class TestMoveStoresOutOfLoops {
  43 
  44     private static long[] array = new long[10];
  45     private static long[] array2 = new long[10];
  46     private static boolean[] array3 = new boolean[1000];
  47     private static byte[] byte_array = new byte[10];
  48 
  49     // Array store should be moved out of the loop, value stored
  50     // should be 999, the loop should be eliminated
  51     static void test_after_1(int idx) {
  52         for (int i = 0; i < 1000; i++) {
  53             array[idx] = i;
  54         }
  55     }
  56 
  57     // Array store can't be moved out of loop because of following
  58     // non loop invariant array access
  59     static void test_after_2(int idx) {
  60         for (int i = 0; i < 1000; i++) {
  61             array[idx] = i;


< prev index next >