Path: blob/master/test/hotspot/jtreg/gc/CondCardMark/Basic.java
40942 views
/*1* Copyright (c) 2014, 2019, Oracle and/or its affiliates. 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*/2223package gc.CondCardMark;2425/**26* @test27* @bug 807698728* @bug 807843829* @summary Verify UseCondCardMark works30* @modules java.base/jdk.internal.misc31* @run main/othervm -Xint gc.CondCardMark.Basic32* @run main/othervm -Xint -XX:+UseCondCardMark gc.CondCardMark.Basic33* @run main/othervm -XX:TieredStopAtLevel=1 gc.CondCardMark.Basic34* @run main/othervm -XX:TieredStopAtLevel=1 -XX:+UseCondCardMark gc.CondCardMark.Basic35* @run main/othervm -XX:TieredStopAtLevel=4 gc.CondCardMark.Basic36* @run main/othervm -XX:TieredStopAtLevel=4 -XX:+UseCondCardMark gc.CondCardMark.Basic37* @run main/othervm -XX:-TieredCompilation gc.CondCardMark.Basic38* @run main/othervm -XX:-TieredCompilation -XX:+UseCondCardMark gc.CondCardMark.Basic39*/40public class Basic {4142static volatile MyObject sink;4344public static void main(String args[]) {45final int COUNT = 10000000;46for (int c = 0; c < COUNT; c++) {47MyObject o = new MyObject();48o.x = c;49doStore(o);50}5152if (sink.x != COUNT-1) {53throw new IllegalStateException("Failed");54}55}5657public static void doStore(MyObject o) {58sink = o;59}6061static class MyObject {62int x;63}6465}666768