1 /* 2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 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 6826736 28 * @summary CMS: core dump with -XX:+UseCompressedOops 29 * 30 * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch 31 * -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g 32 * -XX:CompileThreshold=100 -XX:-BlockLayoutRotateLoops 33 * -XX:LoopUnrollLimit=0 -Xmx256m -XX:ParallelGCThreads=4 34 * -XX:CompileCommand=compileonly,compiler.runtime.Test6826736::test 35 * compiler.runtime.Test6826736 36 */ 37 38 package compiler.runtime; 39 40 public class Test6826736 { 41 int[] arr; 42 int[] arr2; 43 int test(int r) { 44 for (int i = 0; i < 100; i++) { 45 for (int j = i; j < 100; j++) { 46 int a = 0; 47 for (long k = 0; k < 100; k++) { 48 a += k; 49 } 50 if (arr != null) 51 a = arr[j]; 52 r += a; 53 } 54 } 55 return r; 56 } 57 58 public static void main(String[] args) { 59 int r = 0; 60 Test6826736 t = new Test6826736(); 61 for (int i = 0; i < 100; i++) { 62 t.arr = new int[100]; 63 r = t.test(r); 64 } 65 System.out.println("Warmup 1 is done."); 66 for (int i = 0; i < 100; i++) { 67 t.arr = null; 68 r = t.test(r); 69 } 70 System.out.println("Warmup 2 is done."); 71 for (int i = 0; i < 100; i++) { 72 t.arr = new int[100]; 73 r = t.test(r); 74 } 75 System.out.println("Warmup is done."); 76 for (int i = 0; i < 100; i++) { 77 t.arr = new int[1000000]; 78 t.arr = null; 79 r = t.test(r); 80 } 81 } 82 }