1 /* 2 * Copyright (c) 2014, 2015, 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 * @test 26 * @bug 8076987 27 * @bug 8078438 28 * @summary Verify UseCondCardMark works 29 * @modules java.base/jdk.internal.misc 30 * @run main/othervm -Xint Basic 31 * @run main/othervm -Xint -XX:+UseCondCardMark Basic 32 * @run main/othervm -XX:TieredStopAtLevel=1 Basic 33 * @run main/othervm -XX:TieredStopAtLevel=1 -XX:+UseCondCardMark Basic 34 * @run main/othervm -XX:TieredStopAtLevel=4 Basic 35 * @run main/othervm -XX:TieredStopAtLevel=4 -XX:+UseCondCardMark Basic 36 * @run main/othervm -XX:-TieredCompilation Basic 37 * @run main/othervm -XX:-TieredCompilation -XX:+UseCondCardMark Basic 38 */ 39 public class Basic { 40 41 static volatile MyObject sink; 42 43 public static void main(String args[]) { 44 final int COUNT = 10000000; 45 for (int c = 0; c < COUNT; c++) { 46 MyObject o = new MyObject(); 47 o.x = c; 48 doStore(o); 49 } 50 51 if (sink.x != COUNT-1) { 52 throw new IllegalStateException("Failed"); 53 } 54 } 55 56 public static void doStore(MyObject o) { 57 sink = o; 58 } 59 60 static class MyObject { 61 int x; 62 } 63 64 }