kevinw@8194: /* kevinw@8194: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. kevinw@8194: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. kevinw@8194: * kevinw@8194: * This code is free software; you can redistribute it and/or modify it kevinw@8194: * under the terms of the GNU General Public License version 2 only, as kevinw@8194: * published by the Free Software Foundation. kevinw@8194: * kevinw@8194: * This code is distributed in the hope that it will be useful, but WITHOUT kevinw@8194: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or kevinw@8194: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License kevinw@8194: * version 2 for more details (a copy is included in the LICENSE file that kevinw@8194: * accompanied this code). kevinw@8194: * kevinw@8194: * You should have received a copy of the GNU General Public License version kevinw@8194: * 2 along with this work; if not, write to the Free Software Foundation, kevinw@8194: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. kevinw@8194: * kevinw@8194: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA kevinw@8194: * or visit www.oracle.com if you need additional information or have any kevinw@8194: * questions. kevinw@8194: */ kevinw@8194: kevinw@8194: /* kevinw@8194: * @test TestConMarkCycleWB kevinw@8194: * @bug 8065579 kevinw@8194: * @requires vm.gc=="null" | vm.gc=="G1" kevinw@8194: * @library /testlibrary /testlibrary/whitebox kevinw@8194: * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestConcMarkCycleWB kevinw@8194: * @run main ClassFileInstaller sun.hotspot.WhiteBox kevinw@8194: * sun.hotspot.WhiteBox$WhiteBoxPermission kevinw@8194: * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC TestConcMarkCycleWB kevinw@8194: * @summary Verifies that ConcurrentMarking-related WB works properly kevinw@8194: */ kevinw@8194: import static com.oracle.java.testlibrary.Asserts.assertFalse; kevinw@8194: import static com.oracle.java.testlibrary.Asserts.assertTrue; kevinw@8194: import sun.hotspot.WhiteBox; kevinw@8194: kevinw@8194: public class TestConcMarkCycleWB { kevinw@8194: kevinw@8194: public static void main(String[] args) throws Exception { kevinw@8194: WhiteBox wb = WhiteBox.getWhiteBox(); kevinw@8194: kevinw@8194: wb.youngGC(); kevinw@8194: assertTrue(wb.g1StartConcMarkCycle()); kevinw@8194: while (wb.g1InConcurrentMark()) { kevinw@8194: Thread.sleep(5); kevinw@8194: } kevinw@8194: kevinw@8194: wb.fullGC(); kevinw@8194: assertTrue(wb.g1StartConcMarkCycle()); kevinw@8194: while (wb.g1InConcurrentMark()) { kevinw@8194: Thread.sleep(5); kevinw@8194: } kevinw@8194: assertTrue(wb.g1StartConcMarkCycle()); kevinw@8194: } kevinw@8194: }