Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestLargeObjectAlignment.java
40942 views
/*1* Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324/*25* @test TestLargeObjectAlignment26* @summary Shenandoah crashes with -XX:ObjectAlignmentInBytes=1627* @key randomness28* @requires vm.gc.Shenandoah29* @requires vm.bits == "64"30* @library /test/lib31*32* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -Xint TestLargeObjectAlignment33* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -XX:-TieredCompilation TestLargeObjectAlignment34* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -XX:TieredStopAtLevel=1 TestLargeObjectAlignment35* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -XX:TieredStopAtLevel=4 TestLargeObjectAlignment36*/3738import java.util.ArrayList;39import java.util.List;40import java.util.Random;41import jdk.test.lib.Utils;4243public class TestLargeObjectAlignment {4445static final int SLABS_COUNT = Integer.getInteger("slabs", 10000);46static final int NODE_COUNT = Integer.getInteger("nodes", 10000);47static final long TIME_NS = 1000L * 1000L * Integer.getInteger("timeMs", 5000);4849static Object[] objects;5051public static void main(String[] args) throws Exception {52objects = new Object[SLABS_COUNT];5354long start = System.nanoTime();55Random rng = Utils.getRandomInstance();56while (System.nanoTime() - start < TIME_NS) {57objects[rng.nextInt(SLABS_COUNT)] = createSome();58}59}6061public static Object createSome() {62List<Integer> result = new ArrayList<Integer>();63for (int c = 0; c < NODE_COUNT; c++) {64result.add(new Integer(c));65}66return result;67}6869}707172