858N/A/*
1472N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
858N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
858N/A *
858N/A * This code is free software; you can redistribute it and/or modify it
858N/A * under the terms of the GNU General Public License version 2 only, as
858N/A * published by the Free Software Foundation.
858N/A *
858N/A * This code is distributed in the hope that it will be useful, but WITHOUT
858N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
858N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
858N/A * version 2 for more details (a copy is included in the LICENSE file that
858N/A * accompanied this code).
858N/A *
858N/A * You should have received a copy of the GNU General Public License version
858N/A * 2 along with this work; if not, write to the Free Software Foundation,
858N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
858N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
858N/A *
858N/A */
858N/A
858N/A/**
858N/A * @test
858N/A * @bug 6826736
858N/A * @summary CMS: core dump with -XX:+UseCompressedOops
858N/A *
901N/A * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g -XX:CompileThreshold=100 -XX:CompileOnly=Test.test -XX:-BlockLayoutRotateLoops -XX:LoopUnrollLimit=0 Test
858N/A */
858N/A
858N/Apublic class Test {
858N/A int[] arr;
858N/A int[] arr2;
858N/A int test(int r) {
858N/A for (int i = 0; i < 100; i++) {
858N/A for (int j = i; j < 100; j++) {
858N/A int a = 0;
858N/A for (long k = 0; k < 100; k++) {
858N/A a += k;
858N/A }
858N/A if (arr != null)
858N/A a = arr[j];
858N/A r += a;
858N/A }
858N/A }
858N/A return r;
858N/A }
858N/A
858N/A public static void main(String[] args) {
858N/A int r = 0;
858N/A Test t = new Test();
858N/A for (int i = 0; i < 100; i++) {
858N/A t.arr = new int[100];
858N/A r = t.test(r);
858N/A }
858N/A System.out.println("Warmup 1 is done.");
858N/A for (int i = 0; i < 100; i++) {
858N/A t.arr = null;
858N/A r = t.test(r);
858N/A }
858N/A System.out.println("Warmup 2 is done.");
858N/A for (int i = 0; i < 100; i++) {
858N/A t.arr = new int[100];
858N/A r = t.test(r);
858N/A }
858N/A System.out.println("Warmup is done.");
858N/A for (int i = 0; i < 100; i++) {
858N/A t.arr = new int[1000000];
858N/A t.arr = null;
858N/A r = t.test(r);
858N/A }
858N/A }
858N/A}