Wed, 02 Dec 2015 13:58:34 +0530
8065579: WB method to start G1 concurrent mark cycle should be introduced
Summary: Add a WhiteBox callback to the VM to start a concurrent mark cycle in G1.
Reviewed-by: tschatzl, sjohanss
Contributed-by: Leonid Mesnik <leonid.mesnik@oracle.com>
kevinw@8194 | 1 | /* |
kevinw@8194 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
kevinw@8194 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
kevinw@8194 | 4 | * |
kevinw@8194 | 5 | * This code is free software; you can redistribute it and/or modify it |
kevinw@8194 | 6 | * under the terms of the GNU General Public License version 2 only, as |
kevinw@8194 | 7 | * published by the Free Software Foundation. |
kevinw@8194 | 8 | * |
kevinw@8194 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
kevinw@8194 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
kevinw@8194 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
kevinw@8194 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
kevinw@8194 | 13 | * accompanied this code). |
kevinw@8194 | 14 | * |
kevinw@8194 | 15 | * You should have received a copy of the GNU General Public License version |
kevinw@8194 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
kevinw@8194 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
kevinw@8194 | 18 | * |
kevinw@8194 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
kevinw@8194 | 20 | * or visit www.oracle.com if you need additional information or have any |
kevinw@8194 | 21 | * questions. |
kevinw@8194 | 22 | */ |
kevinw@8194 | 23 | |
kevinw@8194 | 24 | /* |
kevinw@8194 | 25 | * @test TestConMarkCycleWB |
kevinw@8194 | 26 | * @bug 8065579 |
kevinw@8194 | 27 | * @requires vm.gc=="null" | vm.gc=="G1" |
kevinw@8194 | 28 | * @library /testlibrary /testlibrary/whitebox |
kevinw@8194 | 29 | * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestConcMarkCycleWB |
kevinw@8194 | 30 | * @run main ClassFileInstaller sun.hotspot.WhiteBox |
kevinw@8194 | 31 | * sun.hotspot.WhiteBox$WhiteBoxPermission |
kevinw@8194 | 32 | * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC TestConcMarkCycleWB |
kevinw@8194 | 33 | * @summary Verifies that ConcurrentMarking-related WB works properly |
kevinw@8194 | 34 | */ |
kevinw@8194 | 35 | import static com.oracle.java.testlibrary.Asserts.assertFalse; |
kevinw@8194 | 36 | import static com.oracle.java.testlibrary.Asserts.assertTrue; |
kevinw@8194 | 37 | import sun.hotspot.WhiteBox; |
kevinw@8194 | 38 | |
kevinw@8194 | 39 | public class TestConcMarkCycleWB { |
kevinw@8194 | 40 | |
kevinw@8194 | 41 | public static void main(String[] args) throws Exception { |
kevinw@8194 | 42 | WhiteBox wb = WhiteBox.getWhiteBox(); |
kevinw@8194 | 43 | |
kevinw@8194 | 44 | wb.youngGC(); |
kevinw@8194 | 45 | assertTrue(wb.g1StartConcMarkCycle()); |
kevinw@8194 | 46 | while (wb.g1InConcurrentMark()) { |
kevinw@8194 | 47 | Thread.sleep(5); |
kevinw@8194 | 48 | } |
kevinw@8194 | 49 | |
kevinw@8194 | 50 | wb.fullGC(); |
kevinw@8194 | 51 | assertTrue(wb.g1StartConcMarkCycle()); |
kevinw@8194 | 52 | while (wb.g1InConcurrentMark()) { |
kevinw@8194 | 53 | Thread.sleep(5); |
kevinw@8194 | 54 | } |
kevinw@8194 | 55 | assertTrue(wb.g1StartConcMarkCycle()); |
kevinw@8194 | 56 | } |
kevinw@8194 | 57 | } |