Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/TestLargeObjectAlignment.java
32284 views
/*1* Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223/*24* @test TestLargeObjectAlignment25* @summary Shenandoah crashes with -XX:ObjectAlignmentInBytes=1626* @key gc27* @requires (vm.bits == "64")28*29* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -Xint TestLargeObjectAlignment30* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -XX:-TieredCompilation TestLargeObjectAlignment31* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -XX:TieredStopAtLevel=1 TestLargeObjectAlignment32* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ObjectAlignmentInBytes=16 -XX:TieredStopAtLevel=4 TestLargeObjectAlignment33*/3435import java.util.ArrayList;36import java.util.List;37import java.util.concurrent.ThreadLocalRandom;3839public class TestLargeObjectAlignment {4041static final int SLABS_COUNT = Integer.getInteger("slabs", 10000);42static final int NODE_COUNT = Integer.getInteger("nodes", 10000);43static final long TIME_NS = 1000L * 1000L * Integer.getInteger("timeMs", 5000);4445static Object[] objects;4647public static void main(String[] args) throws Exception {48objects = new Object[SLABS_COUNT];4950long start = System.nanoTime();51while (System.nanoTime() - start < TIME_NS) {52objects[ThreadLocalRandom.current().nextInt(SLABS_COUNT)] = createSome();53}54}5556public static Object createSome() {57List<Integer> result = new ArrayList<Integer>();58for (int c = 0; c < NODE_COUNT; c++) {59result.add(new Integer(c));60}61return result;62}6364}656667